From 29ff2d26f87f5977aa919d037ca3bbb67e40bdb0 Mon Sep 17 00:00:00 2001 From: T Jake Luciani Date: Mon, 22 Dec 2014 08:59:12 -0500 Subject: [PATCH] Cassandra stress user defined writes should populate sequentially Patch by tjake; reviewed by Benedict for CASSANDRA-8524 --- CHANGES.txt | 1 + .../cassandra/stress/settings/SettingsCommandUser.java | 5 +++++ .../apache/cassandra/stress/settings/SettingsPopulation.java | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index f7b47e8257b9..64bdb62e1d37 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 2.1.3 + * Stress - user defined writes should populate sequentally (CASSANDRA-8524) * Fix regression in SSTableRewriter causing some rows to become unreadable during compaction (CASSANDRA-8429) * Run major compactions for repaired/unrepaired in parallel (CASSANDRA-8510) diff --git a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommandUser.java b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommandUser.java index 9841433696ef..d5b221c71420 100644 --- a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommandUser.java +++ b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommandUser.java @@ -65,6 +65,11 @@ public SettingsCommandUser(Options options) throw new IllegalArgumentException("Must specify at least one command with a non-zero ratio"); } + public boolean hasInsertOnly() + { + return ratios.size() == 1 && ratios.containsKey("insert"); + } + public OpDistributionFactory getFactory(final StressSettings settings) { final SeedManager seeds = new SeedManager(settings); diff --git a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsPopulation.java b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsPopulation.java index da4c282ad74e..e57faea9b212 100644 --- a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsPopulation.java +++ b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsPopulation.java @@ -134,6 +134,11 @@ public static SettingsPopulation get(Map clArgs, SettingsComma String[] params = clArgs.remove("-pop"); if (params == null) { + if (command instanceof SettingsCommandUser && ((SettingsCommandUser)command).hasInsertOnly()) + { + return new SettingsPopulation(new SequentialOptions(defaultLimit)); + } + // return defaults: switch(command.type) {