Repository: cassandra
Updated Branches:
  refs/heads/trunk 5dc79aafc -> 335d8371a


Add stress profile yaml with LWT

Patch by Jay Zhuang; reviewed by Jon Haddad for CASSANDRA-7960


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

Branch: refs/heads/trunk
Commit: 335d8371a4953694d5d3753593a541f17100e1dd
Parents: 5dc79aa
Author: Jay Zhuang <[email protected]>
Authored: Wed Apr 19 12:16:42 2017 -0700
Committer: Jason Brown <[email protected]>
Committed: Thu Aug 31 06:42:41 2017 -0700

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 tools/cqlstress-lwt-example.yaml                | 71 ++++++++++++++++++++
 .../apache/cassandra/stress/StressProfile.java  |  7 ++
 3 files changed, 79 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/335d8371/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index a1951b4..78c2947 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 4.0
+ * Add stress profile yaml with LWT (CASSANDRA-7960)
  * Reduce memory copies and object creations when acting on ByteBufs 
(CASSANDRA-13789)
  * simplify mx4j configuration (Cassandra-13578)
  * Fix trigger example on 4.0 (CASSANDRA-13796)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/335d8371/tools/cqlstress-lwt-example.yaml
----------------------------------------------------------------------
diff --git a/tools/cqlstress-lwt-example.yaml b/tools/cqlstress-lwt-example.yaml
new file mode 100644
index 0000000..8f523be
--- /dev/null
+++ b/tools/cqlstress-lwt-example.yaml
@@ -0,0 +1,71 @@
+# Based on https://gist.github.com/tjake/8995058fed11d9921e31
+### DML ###
+
+# Keyspace Name
+keyspace: cqlstress_lwt_example
+
+# The CQL for creating a keyspace (optional if it already exists)
+keyspace_definition: |
+  CREATE KEYSPACE cqlstress_lwt_example WITH replication = {'class': 
'SimpleStrategy', 'replication_factor': 3};
+
+# Table name
+table: blogposts
+
+# The CQL for creating a table you wish to stress (optional if it already 
exists)
+table_definition: |
+  CREATE TABLE blogposts (
+        domain text,
+        published_date timeuuid,
+        url text,
+        author text,
+        title text,
+        body text,
+        PRIMARY KEY(domain, published_date)
+  ) WITH CLUSTERING ORDER BY (published_date DESC)
+    AND compaction = { 'class':'LeveledCompactionStrategy' }
+    AND comment='A table to hold blog posts'
+
+### Column Distribution Specifications ###
+
+columnspec:
+  - name: domain
+    size: gaussian(5..100)       #domain names are relatively short
+    population: uniform(1..10M)  #10M possible domains to pick from
+
+  - name: published_date
+    cluster: fixed(1000)         #under each domain we will have max 1000 posts
+
+  - name: url
+    size: uniform(30..300)
+
+  - name: title                  #titles shouldn't go beyond 200 chars
+    size: gaussian(10..200)
+
+  - name: author
+    size: uniform(5..20)         #author names should be short
+
+  - name: body
+    size: gaussian(100..5000)    #the body of the blog post can be long
+
+### Batch Ratio Distribution Specifications ###
+
+insert:
+  partitions: fixed(1)            # Our partition key is the domain so only 
insert one per batch
+
+  select:    fixed(1)/1000        # We have 1000 posts per domain so 1/1000 
will allow 1 post per batch
+
+  batchtype: UNLOGGED             # Unlogged batches
+
+  condition: IF body = NULL       # LWT: Do not override
+
+
+#
+# A list of queries you wish to run against the schema
+#
+queries:
+   singlepost:
+      cql: select * from blogposts where domain = ? LIMIT 1
+      fields: samerow
+   timeline:
+      cql: select url, title, published_date from blogposts where domain = ? 
LIMIT 10
+      fields: samerow

http://git-wip-us.apache.org/repos/asf/cassandra/blob/335d8371/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 2420d68..15a36dd 100644
--- a/tools/stress/src/org/apache/cassandra/stress/StressProfile.java
+++ b/tools/stress/src/org/apache/cassandra/stress/StressProfile.java
@@ -543,6 +543,11 @@ public class StressProfile implements Serializable
 
                         //Put PK predicates at the end
                         sb.append(pred);
+                        if (insert.containsKey("condition"))
+                        {
+                            sb.append(" " + insert.get("condition"));
+                            insert.remove("condition");
+                        }
                     }
                     else
                     {
@@ -595,6 +600,8 @@ public class StressProfile implements Serializable
                     String query = sb.toString();
 
                     insertStatement = client.prepare(query);
+                    System.out.println("Insert Statement:");
+                    System.out.println("  " + query);
                 }
             }
         }


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

Reply via email to