Repository: cassandra
Updated Branches:
  refs/heads/trunk 4e744e768 -> 71a27ee2b


This commit fixes NPE when the 'insert' section is missing from user-defined 
profile

Fixes #221

Patch by Alex Ott; Reviewed by Jeff Jirsa for CASSANDRA-14426


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/71a27ee2
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/71a27ee2
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/71a27ee2

Branch: refs/heads/trunk
Commit: 71a27ee2b93a47e177edc16571f91bb5d592899e
Parents: 4e744e7
Author: Alex Ott <[email protected]>
Authored: Sat Apr 28 20:04:13 2018 +0200
Committer: Jeff Jirsa <[email protected]>
Committed: Sat Apr 28 14:02:43 2018 -0700

----------------------------------------------------------------------
 CHANGES.txt                                                  | 1 +
 .../src/org/apache/cassandra/stress/StressProfile.java       | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/71a27ee2/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index fe03ae1..15c2c2e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 4.0
+ * cassandra-stress throws NPE if insert section isn't specified in user 
profile (CASSSANDRA-14426)
  * Improve LatencyMetrics performance by reducing write path processing 
(CASSANDRA-14281)
  * Add network authz (CASSANDRA-13985)
  * Use the correct IP/Port for Streaming when localAddress is left unbound 
(CASSANDAR-14389)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/71a27ee2/tools/stress/src/org/apache/cassandra/stress/StressProfile.java
----------------------------------------------------------------------
diff --git a/tools/stress/src/org/apache/cassandra/stress/StressProfile.java 
b/tools/stress/src/org/apache/cassandra/stress/StressProfile.java
index 15a36dd..2338873 100644
--- a/tools/stress/src/org/apache/cassandra/stress/StressProfile.java
+++ b/tools/stress/src/org/apache/cassandra/stress/StressProfile.java
@@ -499,6 +499,10 @@ public class StressProfile implements Serializable
                         }
                     }
 
+                    if (insert == null)
+                        insert = new HashMap<>();
+                    lowerCase(insert);
+
                     //Non PK Columns
                     StringBuilder sb = new StringBuilder();
                     if (!isKeyOnlyTable)
@@ -563,10 +567,6 @@ public class StressProfile implements Serializable
                         sb.append(") 
").append("values(").append(value).append(')');
                     }
 
-                    if (insert == null)
-                        insert = new HashMap<>();
-                    lowerCase(insert);
-
                     partitions = select(settings.insert.batchsize, 
"partitions", "fixed(1)", insert, OptionDistribution.BUILDER);
                     selectchance = select(settings.insert.selectRatio, 
"select", "fixed(1)/1", insert, OptionRatioDistribution.BUILDER);
                     rowPopulation = select(settings.insert.rowPopulationRatio, 
"row-population", "fixed(1)/1", insert, OptionRatioDistribution.BUILDER);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to