Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
946fca89
Commit
946fca89
authored
Jul 24, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
29ffb326
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
go/transaction/api.go
go/transaction/api.go
+4
-0
go/transaction/transaction_test.go
go/transaction/transaction_test.go
+16
-3
No files found.
go/transaction/api.go
View file @
946fca89
...
...
@@ -145,12 +145,16 @@ type Transaction interface {
//
// Commit completes the transaction by executing the two-phase commit
// algorithm for all DataManagers associated with the transaction.
//
// Commit must not be called after transaction completion began.
Commit
(
ctx
context
.
Context
)
error
// Abort aborts the transaction.
//
// Abort completes the transaction by executing Abort on all
// DataManagers associated with it.
//
// Abort must not be called after transaction completion began.
Abort
()
// XXX + ctx, error?
// XXX + Doom?
...
...
go/transaction/transaction_test.go
View file @
946fca89
...
...
@@ -27,7 +27,7 @@ func TestBasic(t *testing.T) {
defer
func
()
{
r
:=
recover
()
if
r
==
nil
{
t
.
Fatal
(
"Current(ø) -> no
t paniced
"
)
t
.
Fatal
(
"Current(ø) -> no
panic
"
)
}
if
want
:=
"transaction: no current transaction"
;
r
!=
want
{
...
...
@@ -50,7 +50,7 @@ func TestBasic(t *testing.T) {
defer
func
()
{
r
:=
recover
()
if
r
==
nil
{
t
.
Fatal
(
"New(!ø) -> no
t paniced
"
)
t
.
Fatal
(
"New(!ø) -> no
panic
"
)
}
if
want
:=
"transaction: new: nested transactions not supported"
;
r
!=
want
{
...
...
@@ -99,5 +99,18 @@ func TestAbort(t *testing.T) {
t
.
Fatalf
(
"abort: nabort=%d; txn.Status=%v"
,
dm
.
nabort
,
txn
.
Status
())
}
// txn.Abort() -> panic XXX
// Abort 2nd time -> panic
func
()
{
defer
func
()
{
r
:=
recover
()
if
r
==
nil
{
t
.
Fatal
(
"Abort2 -> no panic"
)
}
if
want
:=
"transaction: abort: transaction completion already began"
;
r
!=
want
{
t
.
Fatalf
(
"Abort2 -> %q; want %q"
,
r
,
want
)
}
}()
txn
.
Abort
()
}()
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment