kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdcry...@apache.org
Subject [1/3] kudu git commit: [kudu-jepsen] updated client model for Jepsen tests
Date Thu, 06 Apr 2017 21:46:14 GMT
Repository: kudu
Updated Branches:
  refs/heads/master 4568f2a4c -> 2eba7001a


[kudu-jepsen] updated client model for Jepsen tests

Use a single Kudu client object across all test actors.  This is
to achieve automatic timestamp propagation between all operations.

Prior to this patch, every test actor operated in the context of a
separate Kudu client.  That did not make much sense for running
consistency tests: by design, in Kudu the consistency for operations
performed by multiple clients can be achieved only if passing timestamp
between them.

Change-Id: If67328230cc821129babcb5fa40fcbbb503eea39
Reviewed-on: http://gerrit.cloudera.org:8080/6565
Tested-by: Kudu Jenkins
Reviewed-by: David Ribeiro Alves <dralves@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/678a309b
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/678a309b
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/678a309b

Branch: refs/heads/master
Commit: 678a309b5d88e2fe9c6a0674ba7de00daee35cac
Parents: 4568f2a
Author: Alexey Serbin <aserbin@cloudera.com>
Authored: Wed Apr 5 16:59:05 2017 -0700
Committer: Alexey Serbin <aserbin@cloudera.com>
Committed: Thu Apr 6 18:24:35 2017 +0000

----------------------------------------------------------------------
 .../src/main/clojure/jepsen/kudu/register.clj   | 33 ++++++++++----------
 1 file changed, 16 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/678a309b/java/kudu-jepsen/src/main/clojure/jepsen/kudu/register.clj
----------------------------------------------------------------------
diff --git a/java/kudu-jepsen/src/main/clojure/jepsen/kudu/register.clj b/java/kudu-jepsen/src/main/clojure/jepsen/kudu/register.clj
index b0753ba..c7fe45e 100644
--- a/java/kudu-jepsen/src/main/clojure/jepsen/kudu/register.clj
+++ b/java/kudu-jepsen/src/main/clojure/jepsen/kudu/register.clj
@@ -37,27 +37,26 @@
 (defn w   [_ _] {:type :invoke, :f :write, :value (rand-int 10)})
 
 (defn client
-  [table-created? kclient ktable]
+  [client-atom kclient ktable]
   (reify client/Client
     (setup! [_ test _]
-      ;; Create the client and create/open the table.
-      (let [kclient (kc/sync-client (:master-addresses test))
-            table-name (:table-name test)
-            ktable (locking table-created?
-                     (when (compare-and-set! table-created? false true)
-                       (kc/create-table
-                         kclient
-                         table-name
-                         kt/kv-table-schema
+      "Create the client and the test table. Use the same Kudu client instance "
+      "across all test actors to achieve timestamp propagation for all "
+      "operations."
+      (let [table-name (:table-name test)
+            kclient (locking client-atom
+                     (when (compare-and-set!
+                             client-atom nil (kc/sync-client (:master-addresses test)))
+                       (kc/create-table @client-atom table-name kt/kv-table-schema
                          (let [ranges (:table-ranges test)
                                rep-factor (:num-replicas test)]
                            (if (nil? ranges)
-                             (kt/kv-table-options-hash
-                               rep-factor (count (:tservers test)))
-                             (kt/kv-table-options-range
-                               rep-factor ranges)))))
-                       (kc/open-table kclient table-name))]
-        (client table-created? kclient ktable)))
+                             (kt/kv-table-options-hash rep-factor (count (:tservers test)))
+                             (kt/kv-table-options-range rep-factor ranges))))
+                       @client-atom)
+                       @client-atom)
+            ktable (kc/open-table kclient table-name)]
+        (client client-atom kclient ktable)))
 
     (invoke! [_ _ op]
       (case (:f op)
@@ -74,7 +73,7 @@
   (kudu/kudu-test
     (merge
       {:name    "rw-register"
-       :client (client (atom false) nil nil)
+       :client (client (atom nil) nil nil)
        :concurrency 10
        :num-replicas 5
        :nemesis  nemesis/noop


Mime
View raw message