Updated Branches: refs/heads/cassandra-2.0.0 3a7d9f873 -> 33fda2db6
add a -no-snapshot option to scrub to be able to run in tight disk space scenarios patch by ltodorov reviewed by dbrosius for cassandra-5891 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/dbb55ebd Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/dbb55ebd Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/dbb55ebd Branch: refs/heads/cassandra-2.0.0 Commit: dbb55ebd685ca36dc962e07d1a33b3354a1ce433 Parents: 1df9823 Author: Dave Brosius <dbros...@apache.org> Authored: Tue Aug 20 17:38:52 2013 -0400 Committer: Dave Brosius <dbros...@apache.org> Committed: Tue Aug 20 17:38:52 2013 -0400 ---------------------------------------------------------------------- CHANGES.txt | 1 + src/java/org/apache/cassandra/db/ColumnFamilyStore.java | 6 ++++-- src/java/org/apache/cassandra/service/StorageService.java | 4 ++-- src/java/org/apache/cassandra/service/StorageServiceMBean.java | 2 +- src/java/org/apache/cassandra/tools/NodeCmd.java | 5 ++++- src/java/org/apache/cassandra/tools/NodeProbe.java | 4 ++-- 6 files changed, 14 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/dbb55ebd/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 7ecf602..7d36c95 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -22,6 +22,7 @@ (CASSANDRA-5856) * Don't announce schema version until we've loaded the changes locally (CASSANDRA-5904) + * Add -no-snapshot option to scrub (CASSANDRA-5891) Merged from 1.1: * Correctly validate sparse composite cells in scrub (CASSANDRA-5855) http://git-wip-us.apache.org/repos/asf/cassandra/blob/dbb55ebd/src/java/org/apache/cassandra/db/ColumnFamilyStore.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java index 0000deb..22b1dd5 100644 --- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java +++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java @@ -967,9 +967,11 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean CompactionManager.instance.performCleanup(ColumnFamilyStore.this, renewer); } - public void scrub() throws ExecutionException, InterruptedException + public void scrub(boolean disableSnapshot) throws ExecutionException, InterruptedException { - snapshotWithoutFlush("pre-scrub-" + System.currentTimeMillis()); + // skip snapshot creation during scrub, SEE JIRA 5891 + if(!disableSnapshot) + snapshotWithoutFlush("pre-scrub-" + System.currentTimeMillis()); CompactionManager.instance.performScrub(ColumnFamilyStore.this); } http://git-wip-us.apache.org/repos/asf/cassandra/blob/dbb55ebd/src/java/org/apache/cassandra/service/StorageService.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java index 588777b..9339132 100644 --- a/src/java/org/apache/cassandra/service/StorageService.java +++ b/src/java/org/apache/cassandra/service/StorageService.java @@ -2149,10 +2149,10 @@ public class StorageService extends NotificationBroadcasterSupport implements IE } } - public void scrub(String tableName, String... columnFamilies) throws IOException, ExecutionException, InterruptedException + public void scrub(boolean disableSnapshot, String tableName, String... columnFamilies) throws IOException, ExecutionException, InterruptedException { for (ColumnFamilyStore cfStore : getValidColumnFamilies(false, false, tableName, columnFamilies)) - cfStore.scrub(); + cfStore.scrub(disableSnapshot); } public void upgradeSSTables(String tableName, boolean excludeCurrentVersion, String... columnFamilies) throws IOException, ExecutionException, InterruptedException http://git-wip-us.apache.org/repos/asf/cassandra/blob/dbb55ebd/src/java/org/apache/cassandra/service/StorageServiceMBean.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/service/StorageServiceMBean.java b/src/java/org/apache/cassandra/service/StorageServiceMBean.java index b831d7d..15f2113 100644 --- a/src/java/org/apache/cassandra/service/StorageServiceMBean.java +++ b/src/java/org/apache/cassandra/service/StorageServiceMBean.java @@ -236,7 +236,7 @@ public interface StorageServiceMBean extends NotificationEmitter * * Scrubbed CFs will be snapshotted first. */ - public void scrub(String tableName, String... columnFamilies) throws IOException, ExecutionException, InterruptedException; + public void scrub(boolean disableSnapshot, String tableName, String... columnFamilies) throws IOException, ExecutionException, InterruptedException; /** * Rewrite all sstables to the latest version. http://git-wip-us.apache.org/repos/asf/cassandra/blob/dbb55ebd/src/java/org/apache/cassandra/tools/NodeCmd.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/tools/NodeCmd.java b/src/java/org/apache/cassandra/tools/NodeCmd.java index f6d4310..4e9f461 100644 --- a/src/java/org/apache/cassandra/tools/NodeCmd.java +++ b/src/java/org/apache/cassandra/tools/NodeCmd.java @@ -70,6 +70,7 @@ public class NodeCmd private static final Pair<String, String> START_TOKEN_OPT = Pair.create("st", "start-token"); private static final Pair<String, String> END_TOKEN_OPT = Pair.create("et", "end-token"); private static final Pair<String, String> UPGRADE_ALL_SSTABLE_OPT = Pair.create("a", "include-all-sstables"); + private static final Pair<String, String> NO_SNAPSHOT = Pair.create("ns", "no-snapshot"); private static final String DEFAULT_HOST = "127.0.0.1"; private static final int DEFAULT_PORT = 7199; @@ -93,6 +94,7 @@ public class NodeCmd options.addOption(START_TOKEN_OPT, true, "token at which repair range starts"); options.addOption(END_TOKEN_OPT, true, "token at which repair range ends"); options.addOption(UPGRADE_ALL_SSTABLE_OPT, false, "includes sstables that are already on the most recent version during upgradesstables"); + options.addOption(NO_SNAPSHOT, false, "disables snapshot creation for scrub"); } public NodeCmd(NodeProbe probe) @@ -1497,7 +1499,8 @@ public class NodeCmd catch (ExecutionException ee) { err(ee, "Error occurred during cleanup"); } break; case SCRUB : - try { probe.scrub(keyspace, columnFamilies); } + boolean disableSnapshot = cmd.hasOption(NO_SNAPSHOT.left); + try { probe.scrub(disableSnapshot, keyspace, columnFamilies); } catch (ExecutionException ee) { err(ee, "Error occurred while scrubbing keyspace " + keyspace); } break; case UPGRADESSTABLES : http://git-wip-us.apache.org/repos/asf/cassandra/blob/dbb55ebd/src/java/org/apache/cassandra/tools/NodeProbe.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/tools/NodeProbe.java b/src/java/org/apache/cassandra/tools/NodeProbe.java index dbcb66e..a9b0bb5 100644 --- a/src/java/org/apache/cassandra/tools/NodeProbe.java +++ b/src/java/org/apache/cassandra/tools/NodeProbe.java @@ -187,9 +187,9 @@ public class NodeProbe ssProxy.forceTableCleanup(tableName, columnFamilies); } - public void scrub(String tableName, String... columnFamilies) throws IOException, ExecutionException, InterruptedException + public void scrub(boolean disableSnapshot, String tableName, String... columnFamilies) throws IOException, ExecutionException, InterruptedException { - ssProxy.scrub(tableName, columnFamilies); + ssProxy.scrub(disableSnapshot, tableName, columnFamilies); } public void upgradeSSTables(String tableName, boolean excludeCurrentVersion, String... columnFamilies) throws IOException, ExecutionException, InterruptedException