cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [02/15] git commit: cleanup
Date Wed, 24 Apr 2013 01:15:14 GMT
cleanup


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

Branch: refs/heads/trunk
Commit: 98b5195f7eb1f3a88bb86aa95211403dbd73c98d
Parents: a6edfa5
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Mon Apr 22 08:40:33 2013 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Tue Apr 23 10:21:39 2013 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/db/ColumnIndex.java  |    2 +
 .../org/apache/cassandra/db/RowIndexEntry.java     |   28 +++++++--------
 .../apache/cassandra/db/ColumnFamilyStoreTest.java |    2 +-
 .../apache/cassandra/db/RangeTombstoneTest.java    |    4 --
 4 files changed, 16 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/98b5195f/src/java/org/apache/cassandra/db/ColumnIndex.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnIndex.java b/src/java/org/apache/cassandra/db/ColumnIndex.java
index bcd0eef..6eb8833 100644
--- a/src/java/org/apache/cassandra/db/ColumnIndex.java
+++ b/src/java/org/apache/cassandra/db/ColumnIndex.java
@@ -42,6 +42,8 @@ public class ColumnIndex
 
     private ColumnIndex(List<IndexHelper.IndexInfo> columnsIndex, IFilter bloomFilter)
     {
+        assert columnsIndex != null;
+
         this.columnsIndex = columnsIndex;
         this.bloomFilter = bloomFilter;
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/98b5195f/src/java/org/apache/cassandra/db/RowIndexEntry.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/RowIndexEntry.java b/src/java/org/apache/cassandra/db/RowIndexEntry.java
index a831498..2eda558 100644
--- a/src/java/org/apache/cassandra/db/RowIndexEntry.java
+++ b/src/java/org/apache/cassandra/db/RowIndexEntry.java
@@ -50,12 +50,22 @@ public class RowIndexEntry implements IMeasurableMemory
 
     public static RowIndexEntry create(long position, DeletionInfo deletionInfo, ColumnIndex
index)
     {
-        if (index != null && index.columnsIndex != null && index.columnsIndex.size()
> 1)
+        assert index != null;
+        assert deletionInfo != null;
+
+        // we only consider the columns summary when determining whether to create an IndexedEntry,
+        // since if there are insufficient columns to be worth indexing we're going to seek
to
+        // the beginning of the row anyway, so we might as well read the tombstone there
as well.
+        if (index.columnsIndex.size() > 1)
             return new IndexedEntry(position, deletionInfo, index.columnsIndex, index.bloomFilter);
         else
             return new RowIndexEntry(position);
     }
 
+    /**
+     * @return true if this index entry contains the row-level tombstone and column summary.
 Otherwise,
+     * caller should fetch these from the row header.
+     */
     public boolean isIndexed()
     {
         return !columnsIndex().isEmpty();
@@ -68,7 +78,7 @@ public class RowIndexEntry implements IMeasurableMemory
 
     public List<IndexHelper.IndexInfo> columnsIndex()
     {
-        return Collections.<IndexHelper.IndexInfo>emptyList();
+        return Collections.emptyList();
     }
 
     public IFilter bloomFilter()
@@ -89,7 +99,7 @@ public class RowIndexEntry implements IMeasurableMemory
             dos.writeLong(rie.position);
             if (rie.isIndexed())
             {
-                dos.writeInt(((IndexedEntry)rie).serializedSize());
+                dos.writeInt(rie.serializedSize());
                 DeletionInfo.serializer().serializeForSSTable(rie.deletionInfo(), dos);
                 dos.writeInt(rie.columnsIndex().size());
                 for (IndexHelper.IndexInfo info : rie.columnsIndex())
@@ -102,18 +112,6 @@ public class RowIndexEntry implements IMeasurableMemory
             }
         }
 
-        public RowIndexEntry deserializePositionOnly(DataInput dis, Descriptor.Version version)
throws IOException
-        {
-            long position = dis.readLong();
-            if (version.hasPromotedIndexes)
-            {
-                int size = dis.readInt();
-                if (size > 0)
-                    FileUtils.skipBytesFully(dis, size);
-            }
-            return new RowIndexEntry(position);
-        }
-
         public RowIndexEntry deserialize(DataInput dis, Descriptor.Version version) throws
IOException
         {
             long position = dis.readLong();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/98b5195f/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
index fc18b88..a394644 100644
--- a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
+++ b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
@@ -683,7 +683,7 @@ public class ColumnFamilyStoreTest extends SchemaLoader
 
         assertRowAndColCount(1, 6, scfName, false, cfs.getRangeSlice(scfName, Util.range("f",
"g"), 100, ThriftValidation.asIFilter(sp, cfs.getComparator()), null));
 
-        // deeleet.
+        // delete
         RowMutation rm = new RowMutation(table.name, key.key);
         rm.delete(new QueryPath(cfName, scfName), 2);
         rm.apply();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/98b5195f/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java b/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java
index 1bc846b..c531461 100644
--- a/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java
+++ b/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java
@@ -164,10 +164,6 @@ public class RangeTombstoneTest extends SchemaLoader
         return ByteBufferUtil.bytes(i);
     }
 
-    private static void insertData(ColumnFamilyStore cfs, String key) throws Exception
-    {
-    }
-
     private static void add(RowMutation rm, int value, long timestamp)
     {
         rm.add(new QueryPath(CFNAME, null, b(value)), b(value), timestamp);


Mime
View raw message