expunge row cache post-truncate patch by jbellis; reviewed by slebresne for CASSANDRA-4940
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/a05f6766 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/a05f6766 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/a05f6766 Branch: refs/heads/cassandra-1.2 Commit: a05f6766e292769fde3b7536e5586cf324a1cb17 Parents: f32110c Author: Jonathan Ellis <jbel...@apache.org> Authored: Mon Nov 12 08:27:16 2012 -0600 Committer: Jonathan Ellis <jbel...@apache.org> Committed: Mon Nov 12 08:27:16 2012 -0600 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../cassandra/db/compaction/CompactionManager.java | 8 ++++++++ 2 files changed, 9 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/a05f6766/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 2f945bb..088daa7 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 1.1.7 + * expunge row cache post-truncate (CASSANDRA-4940) * remove IAuthority2 (CASSANDRA-4875) * add get[Row|Key]CacheEntries to CacheServiceMBean (CASSANDRA-4859) * fix get_paged_slice to wrap to next row correctly (CASSANDRA-4816) http://git-wip-us.apache.org/repos/asf/cassandra/blob/a05f6766/src/java/org/apache/cassandra/db/compaction/CompactionManager.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java index fcdf45b..edfea0a 100644 --- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java +++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java @@ -32,6 +32,7 @@ import javax.management.MBeanServer; import javax.management.ObjectName; import org.apache.cassandra.cache.AutoSavingCache; +import org.apache.cassandra.cache.RowCacheKey; import org.apache.cassandra.concurrent.DebuggableThreadPoolExecutor; import org.apache.cassandra.concurrent.NamedThreadFactory; import org.apache.cassandra.config.CFMetaData; @@ -48,6 +49,7 @@ import org.apache.cassandra.io.sstable.*; import org.apache.cassandra.io.util.FileUtils; import org.apache.cassandra.io.util.RandomAccessReader; import org.apache.cassandra.service.AntiEntropyService; +import org.apache.cassandra.service.CacheService; import org.apache.cassandra.service.StorageService; import org.apache.cassandra.utils.*; import org.slf4j.Logger; @@ -813,6 +815,12 @@ public class CompactionManager implements CompactionManagerMBean for (SecondaryIndex index : main.indexManager.getIndexes()) index.truncate(truncatedAt); + + for (RowCacheKey key : CacheService.instance.rowCache.getKeySet()) + { + if (key.cfId == main.metadata.cfId) + CacheService.instance.rowCache.remove(key); + } } finally {