From f9049dff2a822e197f6c18628f61df8d40b9d772 Mon Sep 17 00:00:00 2001 From: keleher <keleher@cs.umd.edu> Date: Tue, 3 Dec 2019 18:35:31 -0500 Subject: [PATCH] auto --- README.md | 16 ++++++++---- .../p5/DIRID/client/transactionalClient.go | 25 +++++++++++-------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 3b1eb70..e8c5b60 100644 --- a/README.md +++ b/README.md @@ -121,13 +121,19 @@ At end-of-text (CTRL-D), `transactionalClient` prints the contents of the K/V store and committed transactions. ## Testing -Your `transactionalClient.go` should take a `-p` option, which will tell your code to do -two things: -- write a commit/abort notification for each transaction as it's fate is decided -- at end-of-text write out the contents of your KV store, ordered lexicographically by key value. Only - written values need be printed. + +Your `transactionalClient.go` takes several arguments (see code), but the two important ones +are: +- `-p` - tells your code to do two things: + - write a commit/abort notification for each transaction as it's fate is decided + - at end-of-text write out the contents of your KV store, ordered lexicographically by key value. Only + written values need be printed. +- `-s` use snapshot isolation instead serializable isolation ### Strict Serializability +I will run the replica set as `run.rb 3`, and the client as `go run transactionalClient.go +-p` or `go run transactionalClient.go -p -s`. + One example. Time is going downwards. Note that transaction *1* of client *1* is different from transaction *1* of client *2*. You can type these in interactively. Note that the commands could be written by different instantiations of `transactionalClient.go`, but diff --git a/go/src/818f19/p5/DIRID/client/transactionalClient.go b/go/src/818f19/p5/DIRID/client/transactionalClient.go index 8742cf4..edec800 100644 --- a/go/src/818f19/p5/DIRID/client/transactionalClient.go +++ b/go/src/818f19/p5/DIRID/client/transactionalClient.go @@ -32,16 +32,17 @@ type ConfigFile struct { } var ( - N = 3 - configFile = "../config.json" - debug = false - repID = 0 - hostname string - identity string - servers []pb.KVClient - log = []pb.CommandString{} - store = make(map[string]string) - doPrint = false + N = 3 + configFile = "../config.json" + debug = false + repID = 0 + hostname string + identity string + servers []pb.KVClient + log = []pb.CommandString{} + store = make(map[string]string) + doPrint = false + snapshotIsolation = false ) //===================================================================== @@ -55,7 +56,7 @@ func main() { store["bar"] = "4 2" for { - if c := Getopt("c:dN:pr:"); c == EOF { + if c := Getopt("c:dN:pr:s"); c == EOF { break } else { switch c { @@ -75,6 +76,8 @@ func main() { case 'r': repID, _ = strconv.Atoi(OptArg) + case 's': + snapshotIsolation = true } } } -- GitLab