cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [3/8] git commit: merge from 1.2
Date Wed, 18 Sep 2013 14:47:15 GMT
merge from 1.2


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8ccd2413
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8ccd2413
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8ccd2413

Branch: refs/heads/trunk
Commit: 8ccd24135233b72f6dd08f6b0eff8e1c414fb373
Parents: 88e3977 d19f802
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Wed Sep 18 09:42:51 2013 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Wed Sep 18 09:42:51 2013 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 -
 .../db/columniterator/SSTableNamesIterator.java | 34 ++++----------------
 2 files changed, 7 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/8ccd2413/CHANGES.txt
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8ccd2413/src/java/org/apache/cassandra/db/columniterator/SSTableNamesIterator.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/columniterator/SSTableNamesIterator.java
index bae43a0,df28c46..3467244
--- a/src/java/org/apache/cassandra/db/columniterator/SSTableNamesIterator.java
+++ b/src/java/org/apache/cassandra/db/columniterator/SSTableNamesIterator.java
@@@ -140,8 -153,7 +140,8 @@@ public class SSTableNamesIterator exten
          List<OnDiskAtom> result = new ArrayList<OnDiskAtom>();
          if (indexList.isEmpty())
          {
 -            readSimpleColumns(file, columns, result);
 +            int columnCount = sstable.descriptor.version.hasRowSizeAndColumnCount ? file.readInt()
: Integer.MAX_VALUE;
-             readSimpleColumns(sstable.metadata, file, columns, result, columnCount);
++            readSimpleColumns(file, columns, result, columnCount);
          }
          else
          {
@@@ -152,24 -175,21 +152,20 @@@
          iter = result.iterator();
      }
  
-     private void readSimpleColumns(CFMetaData metadata,
-                                    FileDataInput file,
-                                    SortedSet<ByteBuffer> columnNames,
-                                    List<OnDiskAtom> result,
-                                    int columnCount)
 -    private void readSimpleColumns(FileDataInput file, SortedSet<ByteBuffer> columnNames,
List<OnDiskAtom> result) throws IOException
++    private void readSimpleColumns(FileDataInput file, SortedSet<ByteBuffer> columnNames,
List<OnDiskAtom> result, int columnCount)
      {
-         AbstractType<?> comparator = metadata.comparator;
 -        OnDiskAtom.Serializer atomSerializer = cf.getOnDiskSerializer();
 -        int count = file.readInt();
 +        Iterator<OnDiskAtom> atomIterator = cf.metadata().getOnDiskIterator(file,
columnCount, sstable.descriptor.version);
-         ByteBuffer maximalColumnName = columnNames.last();
+         int n = 0;
 -        for (int i = 0; i < count; i++)
 +        while (atomIterator.hasNext())
          {
 -            OnDiskAtom column = atomSerializer.deserializeFromSSTable(file, sstable.descriptor.version);
 -            if (column instanceof IColumn)
 +            OnDiskAtom column = atomIterator.next();
-             ByteBuffer columnName = column.name();
 +            if (column instanceof Column)
              {
-                 if (columnNames.contains(columnName))
+                 if (columnNames.contains(column.name()))
                  {
                      result.add(column);
+                     if (++n >= columns.size())
+                         break;
                  }
              }
              else
@@@ -225,23 -235,16 +211,17 @@@
              if (file == null)
                  file = createFileDataInput(positionToSeek);
  
 -            OnDiskAtom.Serializer atomSerializer = cf.getOnDiskSerializer();
 +            // We'll read as much atom as there is in the index block, so provide a bogus
atom count
 +            Iterator<OnDiskAtom> atomIterator = cf.metadata().getOnDiskIterator(file,
Integer.MAX_VALUE, sstable.descriptor.version);
              file.seek(positionToSeek);
              FileMark mark = file.mark();
              // TODO only completely deserialize columns we are interested in
              while (file.bytesPastMark(mark) < indexInfo.width)
              {
 -                OnDiskAtom column = atomSerializer.deserializeFromSSTable(file, sstable.descriptor.version);
 +                OnDiskAtom column = atomIterator.next();
-                 ByteBuffer columnName = column.name();
                  // we check vs the original Set, not the filtered List, for efficiency
-                 if (!(column instanceof Column) || columnNames.contains(columnName))
 -                if (!(column instanceof IColumn) || columnNames.contains(column.name()))
++                if (!(column instanceof Column) || columnNames.contains(column.name()))
                      result.add(column);
- 
-                 // Already consumed all of this block that's going to have columns that
apply to this query.
-                 if (comparator.compare(columnName, maximalColumnName) >= 0)
-                     break;
              }
          }
      }


Mime
View raw message