cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject git commit: keep a local copy of indexInterval in summary builder so we don't need to pass it to maybeAddEntry
Date Sun, 28 Apr 2013 19:22:54 GMT
Updated Branches:
  refs/heads/trunk 385ce13f5 -> facaaf504


keep a local copy of indexInterval in summary builder so we don't need to pass it to maybeAddEntry


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

Branch: refs/heads/trunk
Commit: facaaf504203f303c78fbda039d26e005ec3e74e
Parents: 385ce13
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Sun Apr 28 14:21:32 2013 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Sun Apr 28 14:21:32 2013 -0500

----------------------------------------------------------------------
 .../cassandra/io/sstable/IndexSummaryBuilder.java  |    9 +++++----
 .../apache/cassandra/io/sstable/SSTableReader.java |    2 +-
 .../apache/cassandra/io/sstable/SSTableWriter.java |    4 ++--
 3 files changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/facaaf50/src/java/org/apache/cassandra/io/sstable/IndexSummaryBuilder.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/IndexSummaryBuilder.java b/src/java/org/apache/cassandra/io/sstable/IndexSummaryBuilder.java
index 12be453..7b06ee5 100644
--- a/src/java/org/apache/cassandra/io/sstable/IndexSummaryBuilder.java
+++ b/src/java/org/apache/cassandra/io/sstable/IndexSummaryBuilder.java
@@ -19,7 +19,6 @@ package org.apache.cassandra.io.sstable;
 
 import java.util.ArrayList;
 
-import com.google.common.primitives.Bytes;
 import com.google.common.primitives.Longs;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -35,10 +34,12 @@ public class IndexSummaryBuilder
 
     private final ArrayList<Long> positions;
     private final ArrayList<byte[]> keys;
+    private final int indexInterval;
     private long keysWritten = 0;
 
     public IndexSummaryBuilder(long expectedKeys, int indexInterval)
     {
+        this.indexInterval = indexInterval;
         long expectedEntries = expectedKeys / indexInterval;
         if (expectedEntries > Integer.MAX_VALUE)
         {
@@ -47,13 +48,13 @@ public class IndexSummaryBuilder
             expectedEntries = expectedKeys / effectiveInterval;
             assert expectedEntries <= Integer.MAX_VALUE : expectedEntries;
             logger.warn("Index interval of {} is too low for {} expected keys; using interval
of {} instead",
-                    indexInterval, expectedKeys, effectiveInterval);
+                        indexInterval, expectedKeys, effectiveInterval);
         }
         positions = new ArrayList<Long>((int)expectedEntries);
         keys = new ArrayList<byte[]>((int)expectedEntries);
     }
 
-    public IndexSummaryBuilder maybeAddEntry(DecoratedKey decoratedKey, int indexInterval,
long indexPosition)
+    public IndexSummaryBuilder maybeAddEntry(DecoratedKey decoratedKey, long indexPosition)
     {
         if (keysWritten % indexInterval == 0)
         {
@@ -65,7 +66,7 @@ public class IndexSummaryBuilder
         return this;
     }
 
-    public IndexSummary build(IPartitioner partitioner, int indexInterval)
+    public IndexSummary build(IPartitioner partitioner)
     {
         byte[][] keysArray = new byte[keys.size()][];
         for (int i = 0; i < keys.size(); i++)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/facaaf50/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableReader.java b/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
index 27589f5..bc467c1 100644
--- a/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
@@ -400,7 +400,7 @@ public class SSTableReader extends SSTable
                 // if summary was already read from disk we don't want to re-populate it
using primary index
                 if (!summaryLoaded)
                 {
-                    summaryBuilder.maybeAddEntry(decoratedKey, metadata.getIndexInterval(),
indexPosition);
+                    summaryBuilder.maybeAddEntry(decoratedKey, indexPosition);
                     ibuilder.addPotentialBoundary(indexPosition);
                     dbuilder.addPotentialBoundary(indexEntry.position);
                 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/facaaf50/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java b/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
index c67e868..4b0b756 100644
--- a/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
@@ -339,7 +339,7 @@ public class SSTableWriter extends SSTable
                                                            partitioner,
                                                            ifile,
                                                            dfile,
-                                                           iwriter.summary.build(partitioner,
metadata.getIndexInterval()),
+                                                           iwriter.summary.build(partitioner),
                                                            iwriter.bf,
                                                            maxDataAge,
                                                            sstableMetadata);
@@ -434,7 +434,7 @@ public class SSTableWriter extends SSTable
             if (logger.isTraceEnabled())
                 logger.trace("wrote index entry: " + indexEntry + " at " + indexPosition);
 
-            summary.maybeAddEntry(key, metadata.getIndexInterval(), indexPosition);
+            summary.maybeAddEntry(key, indexPosition);
             builder.addPotentialBoundary(indexPosition);
         }
 


Mime
View raw message