Repository: cassandra Updated Branches: refs/heads/trunk 04f351d57 -> db900a374
Clearer logic for first index summary entry in builder Patch by Tyler Hobbs; reviewed by Benedict Elliot Smith as a follow up for CASSANDRA-8993 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f7856c22 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f7856c22 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f7856c22 Branch: refs/heads/trunk Commit: f7856c225857e8bb975289f46e2b9b001888ea0c Parents: bd48424 Author: Tyler Hobbs <[email protected]> Authored: Fri Mar 27 10:00:37 2015 -0500 Committer: Tyler Hobbs <[email protected]> Committed: Fri Mar 27 10:02:44 2015 -0500 ---------------------------------------------------------------------- .../org/apache/cassandra/io/sstable/IndexSummaryBuilder.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/f7856c22/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 54e8dd2..ff06c10 100644 --- a/src/java/org/apache/cassandra/io/sstable/IndexSummaryBuilder.java +++ b/src/java/org/apache/cassandra/io/sstable/IndexSummaryBuilder.java @@ -109,7 +109,10 @@ public class IndexSummaryBuilder implements AutoCloseable maxExpectedEntries = Math.max(1, (maxExpectedEntries * samplingLevel) / BASE_SAMPLING_LEVEL); offsets = new SafeMemoryWriter(4 * maxExpectedEntries).withByteOrder(ByteOrder.nativeOrder()); entries = new SafeMemoryWriter(40 * maxExpectedEntries).withByteOrder(ByteOrder.nativeOrder()); - setNextSamplePosition(-minIndexInterval); + + // the summary will always contain the first index entry (downsampling will never remove it) + nextSamplePosition = 0; + indexIntervalMatches++; } // the index file has been flushed to the provided position; stash it and use that to recalculate our max readable boundary
