Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
8
818f19p5
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Peter Keleher
818f19p5
Commits
a4d03d7e
Commit
a4d03d7e
authored
5 years ago
by
keleher
Browse files
Options
Downloads
Patches
Plain Diff
auto
parent
e87ddbad
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+63
-10
63 additions, 10 deletions
README.md
go/src/818f19/p5/DIRID/client/transactionalClient.go
+5
-1
5 additions, 1 deletion
go/src/818f19/p5/DIRID/client/transactionalClient.go
with
68 additions
and
11 deletions
README.md
+
63
−
10
View file @
a4d03d7e
...
@@ -120,30 +120,83 @@ At end-of-text (CTRL-D), `transactionalClient` prints the contents of the K/V
...
@@ -120,30 +120,83 @@ At end-of-text (CTRL-D), `transactionalClient` prints the contents of the K/V
store and committed transactions.
store and committed transactions.
## Testing
## 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.
### Strict Serializability
### Strict Serializability
One example. Time is going downwards. Note that transaction
*1*
of client
*1*
is different from transaction
*1*
of client
*2*
.
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.
R1 R2
R1 R2
1,1,r,A
1,1,w,A,0
1,1,w,B,nice
1,1,w,B,0
1,1,commit
1,2,r,A
1,2,w,B,nice
2,1,r,A
2,1,r,A
2,1,w,
C
,foo
2,1,w,
B
,foo
2,2,w,A
2,2,w,A
,bar
2,2,r,B
2,2,r,B
2,2,commit
2,2,commit
2,1,commit
2,1,commit
1,2,commit
If one of the clients was invoked with option
`-p`
, it should print:
```
trans 1.1 commit
trans 2.2 commit
trans 2.1 abort
trans 1.2 abort
A='bar'
B='0'
```
---
And another:
R1 R2
1,1,w,A,0
1,1,w,B,0
1,1,commit
1,1,commit
1,2,w,A,1
1,1,r,B
2,1,w,B,1
2,1,r,A
2,1,commit
1,2,commit
Your client should print:
Your client
w/
`-p`
should print:
```
```
trans 2.2 commit
trans 1.1 commit
trans 2.1 abort
trans 2.1 commit
trans 1.1 abort
trans 1.2 abort
A='0'
B='1'
```
```
### Snapshot Isolation
Under snapshot isolation, the above two examples will print:
```
trans 1.1 commit
trans 2.2 commit
trans 2.1 commit
trans 1.2 abort
A='bar'
B='foo'
```
and
```
trans 1.1 commit
trans 2.1 commit
trans 1.2 abort
A='1'
B='1'
```
## Submitting
## Submitting
Submit by uploading tarball
`cd /vagrant/go/src/818f19/p5; tar cvfz DIRID.tgz DIRID`
, w/
Submit by uploading tarball
`cd /vagrant/go/src/818f19/p5; tar cvfz DIRID.tgz DIRID`
, w/
your directory ID substituted in for "DIRID".
your directory ID substituted in for "DIRID".
...
...
This diff is collapsed.
Click to expand it.
go/src/818f19/p5/DIRID/client/transactionalClient.go
+
5
−
1
View file @
a4d03d7e
...
@@ -41,6 +41,7 @@ var (
...
@@ -41,6 +41,7 @@ var (
servers
[]
pb
.
KVClient
servers
[]
pb
.
KVClient
log
=
[]
pb
.
CommandString
{}
log
=
[]
pb
.
CommandString
{}
store
=
make
(
map
[
string
]
string
)
store
=
make
(
map
[
string
]
string
)
doPrint
=
false
)
)
//=====================================================================
//=====================================================================
...
@@ -54,7 +55,7 @@ func main() {
...
@@ -54,7 +55,7 @@ func main() {
store
[
"bar"
]
=
"4 2"
store
[
"bar"
]
=
"4 2"
for
{
for
{
if
c
:=
Getopt
(
"c:dN:r:"
);
c
==
EOF
{
if
c
:=
Getopt
(
"c:dN:
p
r:"
);
c
==
EOF
{
break
break
}
else
{
}
else
{
switch
c
{
switch
c
{
...
@@ -68,6 +69,9 @@ func main() {
...
@@ -68,6 +69,9 @@ func main() {
case
'N'
:
case
'N'
:
N
,
_
=
strconv
.
Atoi
(
OptArg
)
N
,
_
=
strconv
.
Atoi
(
OptArg
)
case
'p'
:
doPrint
=
!
doPrint
case
'r'
:
case
'r'
:
repID
,
_
=
strconv
.
Atoi
(
OptArg
)
repID
,
_
=
strconv
.
Atoi
(
OptArg
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment