Updated Branches: refs/heads/cassandra-2.0 0be42463b -> 287745e54
Release sstables upon rebuilding 2i patch by Sergio Bossa; reviewed by Aleksey Yeschenko for CASSANDRA-6635 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/287745e5 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/287745e5 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/287745e5 Branch: refs/heads/cassandra-2.0 Commit: 287745e54ddc5785fa45dfa3903de426b0c1a255 Parents: 0be4246 Author: Aleksey Yeschenko <alek...@apache.org> Authored: Wed Jan 29 14:10:18 2014 -0600 Committer: Aleksey Yeschenko <alek...@apache.org> Committed: Wed Jan 29 14:10:18 2014 -0600 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../cassandra/db/index/SecondaryIndex.java | 22 +++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/287745e5/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index ed32385..4009981 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -13,6 +13,7 @@ * Avoid rare duplicate read repair triggering (CASSANDRA-6606) * Fix paging discardFirst (CASSANDRA-6555) * Fix ArrayIndexOutOfBoundsException in 2ndary index query (CASSANDRA-6470) + * Release sstables upon rebuilding 2i (CASSANDRA-6635) Merged from 1.2: * fsync compression metadata (CASSANDRA-6531) * Validate CF existence on execution for prepared statement (CASSANDRA-6535) http://git-wip-us.apache.org/repos/asf/cassandra/blob/287745e5/src/java/org/apache/cassandra/db/index/SecondaryIndex.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/index/SecondaryIndex.java b/src/java/org/apache/cassandra/db/index/SecondaryIndex.java index 3b4a6ec..fda28f0 100644 --- a/src/java/org/apache/cassandra/db/index/SecondaryIndex.java +++ b/src/java/org/apache/cassandra/db/index/SecondaryIndex.java @@ -180,14 +180,20 @@ public abstract class SecondaryIndex getIndexName(), StringUtils.join(baseCfs.getSSTables(), ", "))); Collection<SSTableReader> sstables = baseCfs.markCurrentSSTablesReferenced(); - SecondaryIndexBuilder builder = new SecondaryIndexBuilder(baseCfs, - Collections.singleton(getIndexName()), - new ReducingKeyIterator(sstables)); - Future<?> future = CompactionManager.instance.submitIndexBuild(builder); - FBUtilities.waitOnFuture(future); - forceBlockingFlush(); - - setIndexBuilt(); + try + { + SecondaryIndexBuilder builder = new SecondaryIndexBuilder(baseCfs, + Collections.singleton(getIndexName()), + new ReducingKeyIterator(sstables)); + Future<?> future = CompactionManager.instance.submitIndexBuild(builder); + FBUtilities.waitOnFuture(future); + forceBlockingFlush(); + setIndexBuilt(); + } + finally + { + SSTableReader.releaseReferences(sstables); + } logger.info("Index build of " + getIndexName() + " complete"); }