From 7ff8e3c384df32eaca361cbb77632d04cc64060b Mon Sep 17 00:00:00 2001 From: Sylvain Lebresne Date: Fri, 27 Jul 2012 10:06:33 +0200 Subject: [PATCH] Don't purge columns during upgradesstables patch by slebresne; reviewed by jbellis for CASSANDRA-4462 --- CHANGES.txt | 1 + .../apache/cassandra/db/compaction/CompactionManager.java | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 79278aa9ad..b3fa1a8653 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -12,6 +12,7 @@ * fix 1.0.x node join to mixed version cluster, other nodes >= 1.1 (CASSANDRA-4195) * Fix LCS splitting sstable base on uncompressed size (CASSANDRA-4419) * Push the validation of secondary index values to the SecondaryIndexManager (CASSANDRA-4240) + * Don't purge columns during upgradesstables (CASSANDRA-4462) 1.0.10 * fix maxTimestamp to include row tombstones (CASSANDRA-4116) diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java index 872ce0be3e..2400cfe91f 100644 --- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java +++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java @@ -67,6 +67,9 @@ public class CompactionManager implements CompactionManagerMBean private static final Logger logger = LoggerFactory.getLogger(CompactionManager.class); public static final CompactionManager instance; + public static final int NO_GC = Integer.MIN_VALUE; + public static final int GC_ALL = Integer.MAX_VALUE; + /** * compactionLock has two purposes: * - Compaction acquires its readLock so that multiple compactions can happen simultaneously, @@ -238,7 +241,7 @@ public class CompactionManager implements CompactionManagerMBean { // SSTables are marked by the caller // NOTE: it is important that the task create one and only one sstable, even for Leveled compaction (see LeveledManifest.replace()) - CompactionTask task = new CompactionTask(cfs, Collections.singletonList(sstable), Integer.MAX_VALUE); + CompactionTask task = new CompactionTask(cfs, Collections.singletonList(sstable), NO_GC); task.isUserDefined(true); task.setCompactionType(OperationType.UPGRADE_SSTABLES); task.execute(executor); @@ -974,7 +977,7 @@ public class CompactionManager implements CompactionManagerMBean static int getDefaultGcBefore(ColumnFamilyStore cfs) { return cfs.isIndex() - ? Integer.MAX_VALUE + ? GC_ALL : (int) (System.currentTimeMillis() / 1000) - cfs.metadata.getGcGraceSeconds(); }