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
0fdfd342
Commit
0fdfd342
authored
Jan 23, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
52157648
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
4 deletions
+28
-4
go/transaction/transaction.go
go/transaction/transaction.go
+3
-2
go/transaction/transaction_test.go
go/transaction/transaction_test.go
+12
-2
go/zodb/persistent_test.go
go/zodb/persistent_test.go
+13
-0
No files found.
go/transaction/transaction.go
View file @
0fdfd342
// Copyright (C) 2018 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
// Copyright (C) 2018
-2019
Nexedi SA and Contributors.
//
Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your
...
...
@@ -160,6 +160,7 @@ func (txn *transaction) Abort() {
syncv
[
i
]
.
AfterCompletion
(
txn
)
}()
}
wg
.
Wait
()
// XXX return error?
}
...
...
go/transaction/transaction_test.go
View file @
0fdfd342
// Copyright (C) 2018 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
// Copyright (C) 2018
-2019
Nexedi SA and Contributors.
//
Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your
...
...
@@ -98,7 +98,17 @@ func TestAbort(t *testing.T) {
dm
.
Modify
()
// XXX +sync
/* XXX test Abort not waiting for AfterCompletion via tracetest (with injected δt shakes):
txn.RegisterSync(AfterCompletion: {eAfterCompletion})
go func() {
eAbortPre
txn.Abort()
eAbortPost
}()
expect(eAbortPre, eAfterCompletion, eAbortPost)
*/
txn
.
Abort
()
if
!
(
dm
.
nabort
==
1
&&
txn
.
Status
()
==
Aborted
)
{
t
.
Fatalf
(
"abort: nabort=%d; txn.Status=%v"
,
dm
.
nabort
,
txn
.
Status
())
...
...
go/zodb/persistent_test.go
View file @
0fdfd342
...
...
@@ -187,6 +187,9 @@ func (cc *zcacheControl) WantEvict(obj IPersistent) bool {
// Persistent tests with storage.
//
// this test covers everything at application-level: Persistent, DB, Connection, LiveCache.
//
// XXX test for cache=y/n (raw data cache)
// XXX test both txn.Abort() and conn.Resync()
func
TestPersistentDB
(
t
*
testing
.
T
)
{
X
:=
exc
.
Raiseif
assert
:=
require
.
New
(
t
)
...
...
@@ -213,6 +216,8 @@ func TestPersistentDB(t *testing.T) {
txn1
,
ctx1
:=
transaction
.
New
(
ctx
)
conn1
,
err
:=
db
.
Open
(
ctx1
,
&
ConnOptions
{});
X
(
err
)
assert
.
Equal
(
conn1
.
db
,
db
)
assert
.
Equal
(
conn1
.
txn
,
txn1
)
// do not evict obj2 from live cache. obj1 is ok to be evicted.
zcache1
:=
conn1
.
Cache
()
...
...
@@ -273,6 +278,8 @@ func TestPersistentDB(t *testing.T) {
// new db connection should see the change
txn2
,
ctx2
:=
transaction
.
New
(
ctx
)
conn2
,
err
:=
db
.
Open
(
ctx2
,
&
ConnOptions
{});
X
(
err
)
assert
.
Equal
(
conn2
.
db
,
db
)
assert
.
Equal
(
conn2
.
txn
,
txn2
)
assert
.
Equal
(
conn2
.
At
(),
at2
)
xc2obj1
,
err
:=
conn2
.
Get
(
ctx2
,
101
);
X
(
err
)
...
...
@@ -308,7 +315,13 @@ func TestPersistentDB(t *testing.T) {
checkObj
(
obj1
,
conn1
,
101
,
InvalidTid
,
GHOST
,
0
,
nil
)
checkObj
(
obj2
,
conn1
,
102
,
at1
,
UPTODATE
,
0
,
nil
)
// txn1 completes - conn1 goes back to db pool
assert
.
Equal
(
conn1
.
txn
,
txn1
)
txn1
.
Abort
()
assert
.
Equal
(
conn1
.
txn
,
nil
)
// XXX conn1.Resync -> c1obj2 invalidated
...
...
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