Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
02292d4b
Commit
02292d4b
authored
Feb 04, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
1d44d1d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
18 deletions
+31
-18
go/zodb/persistent_test.go
go/zodb/persistent_test.go
+31
-18
No files found.
go/zodb/persistent_test.go
View file @
02292d4b
...
@@ -234,9 +234,25 @@ func (t *tPersistentDB) PActivate(obj IPersistent) {
...
@@ -234,9 +234,25 @@ func (t *tPersistentDB) PActivate(obj IPersistent) {
}
}
}
}
//
XXX
//
checkObj state of obj and that it belongs to t.conn.
func
(
t
*
tPersistentDB
)
checkObj
(
obj
IPersistent
,
oid
Oid
,
serial
Tid
,
state
ObjectState
,
refcnt
int32
,
loading
*
loadState
)
{
func
(
t
*
tPersistentDB
)
checkObj
(
obj
IPersistent
,
oid
Oid
,
serial
Tid
,
state
ObjectState
,
refcnt
int32
,
loading
*
loadState
)
{
t
.
Helper
()
t
.
Helper
()
// any object with live pointer to it must be also in conn's cache.
connObj
:=
t
.
conn
.
Cache
()
.
Get
(
oid
)
if
obj
!=
connObj
{
t
.
Fatalf
(
"cache.get %s -> not same object:
\n
have: %#v
\n
want: %#v"
,
oid
,
connObj
,
oid
)
}
// and conn.Get must return it
connObj
,
err
:=
t
.
conn
.
Get
(
t
.
ctx
,
oid
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
obj
!=
connObj
{
t
.
Fatalf
(
"conn.get %s -> not same object:
\n
have: %#v
\n
want: %#v"
,
oid
,
connObj
,
oid
)
}
_checkObj
(
t
.
T
,
obj
,
t
.
conn
,
oid
,
serial
,
state
,
refcnt
,
loading
)
_checkObj
(
t
.
T
,
obj
,
t
.
conn
,
oid
,
serial
,
state
,
refcnt
,
loading
)
}
}
...
@@ -422,14 +438,10 @@ func TestPersistentDB(t0 *testing.T) {
...
@@ -422,14 +438,10 @@ func TestPersistentDB(t0 *testing.T) {
assert
.
Equal
(
db
.
pool
,
[]
*
Connection
{})
assert
.
Equal
(
db
.
pool
,
[]
*
Connection
{})
// obj2 should be invalidated
// obj2 should be invalidated
assert
.
Equal
(
t
.
conn
.
Cache
()
.
Get
(
101
),
obj1
)
// XXX is
assert
.
Equal
(
t
.
conn
.
Cache
()
.
Get
(
102
),
obj2
)
// XXX is
t
.
checkObj
(
obj1
,
101
,
InvalidTid
,
GHOST
,
0
,
nil
)
t
.
checkObj
(
obj1
,
101
,
InvalidTid
,
GHOST
,
0
,
nil
)
t
.
checkObj
(
obj2
,
102
,
InvalidTid
,
GHOST
,
0
,
nil
)
t
.
checkObj
(
obj2
,
102
,
InvalidTid
,
GHOST
,
0
,
nil
)
// obj2 data should be new
// obj2 data should be new
assert
.
Exactly
(
obj1
,
t
.
Get
(
101
))
// XXX is
assert
.
Exactly
(
obj2
,
t
.
Get
(
102
))
// XXX is
t
.
PActivate
(
obj1
);
t
.
PActivate
(
obj1
);
t
.
PActivate
(
obj2
);
t
.
PActivate
(
obj2
);
t
.
checkObj
(
obj1
,
101
,
at1
,
UPTODATE
,
1
,
nil
)
t
.
checkObj
(
obj1
,
101
,
at1
,
UPTODATE
,
1
,
nil
)
...
@@ -486,14 +498,10 @@ func TestPersistentDB(t0 *testing.T) {
...
@@ -486,14 +498,10 @@ func TestPersistentDB(t0 *testing.T) {
assert
.
Equal
(
db
.
pool
,
[]
*
Connection
{
t1
.
conn
,
t2
.
conn
})
assert
.
Equal
(
db
.
pool
,
[]
*
Connection
{
t1
.
conn
,
t2
.
conn
})
// obj2 should be invalidated
// obj2 should be invalidated
assert
.
Equal
(
t
.
conn
.
Cache
()
.
Get
(
101
),
robj1
)
// XXX is
assert
.
Equal
(
t
.
conn
.
Cache
()
.
Get
(
102
),
robj2
)
// XXX is
t
.
checkObj
(
robj1
,
101
,
InvalidTid
,
GHOST
,
0
,
nil
)
t
.
checkObj
(
robj1
,
101
,
InvalidTid
,
GHOST
,
0
,
nil
)
t
.
checkObj
(
robj2
,
102
,
InvalidTid
,
GHOST
,
0
,
nil
)
t
.
checkObj
(
robj2
,
102
,
InvalidTid
,
GHOST
,
0
,
nil
)
// obj2 data should be old
// obj2 data should be old
assert
.
Exactly
(
robj1
,
t
.
Get
(
101
))
// XXX is
assert
.
Exactly
(
robj2
,
t
.
Get
(
102
))
// XXX is
t
.
PActivate
(
robj1
)
t
.
PActivate
(
robj1
)
t
.
PActivate
(
robj2
)
t
.
PActivate
(
robj2
)
t
.
checkObj
(
robj1
,
101
,
at1
,
UPTODATE
,
1
,
nil
)
t
.
checkObj
(
robj1
,
101
,
at1
,
UPTODATE
,
1
,
nil
)
...
@@ -513,13 +521,9 @@ func TestPersistentDB(t0 *testing.T) {
...
@@ -513,13 +521,9 @@ func TestPersistentDB(t0 *testing.T) {
assert
.
Equal
(
db
.
pool
,
[]
*
Connection
{
t1
.
conn
,
t2
.
conn
})
assert
.
Equal
(
db
.
pool
,
[]
*
Connection
{
t1
.
conn
,
t2
.
conn
})
// obj2 should be invalidated
// obj2 should be invalidated
assert
.
Equal
(
t
.
conn
.
Cache
()
.
Get
(
101
),
robj1
)
// XXX is
assert
.
Equal
(
t
.
conn
.
Cache
()
.
Get
(
102
),
robj2
)
// XXX is
t
.
checkObj
(
robj1
,
101
,
InvalidTid
,
GHOST
,
0
,
nil
)
t
.
checkObj
(
robj1
,
101
,
InvalidTid
,
GHOST
,
0
,
nil
)
t
.
checkObj
(
robj2
,
102
,
InvalidTid
,
GHOST
,
0
,
nil
)
t
.
checkObj
(
robj2
,
102
,
InvalidTid
,
GHOST
,
0
,
nil
)
assert
.
Exactly
(
robj1
,
t
.
Get
(
101
))
// XXX is
assert
.
Exactly
(
robj2
,
t
.
Get
(
102
))
// XXX is
t
.
PActivate
(
robj1
)
t
.
PActivate
(
robj1
)
t
.
PActivate
(
robj2
)
t
.
PActivate
(
robj2
)
t
.
checkObj
(
robj1
,
101
,
at1
,
UPTODATE
,
1
,
nil
)
t
.
checkObj
(
robj1
,
101
,
at1
,
UPTODATE
,
1
,
nil
)
...
@@ -532,20 +536,16 @@ func TestPersistentDB(t0 *testing.T) {
...
@@ -532,20 +536,16 @@ func TestPersistentDB(t0 *testing.T) {
t
.
checkObj
(
robj1
,
101
,
InvalidTid
,
GHOST
,
0
,
nil
)
t
.
checkObj
(
robj1
,
101
,
InvalidTid
,
GHOST
,
0
,
nil
)
t
.
checkObj
(
robj2
,
102
,
at2
,
UPTODATE
,
0
,
nil
)
t
.
checkObj
(
robj2
,
102
,
at2
,
UPTODATE
,
0
,
nil
)
// Resync ↓
(at1 -> at0; to outside δtail coverage)
// Resync ↓
(at1 -> at0; to outside δtail coverage)
t
.
Abort
()
t
.
Abort
()
assert
.
Equal
(
db
.
pool
,
[]
*
Connection
{
t1
.
conn
,
t2
.
conn
})
assert
.
Equal
(
db
.
pool
,
[]
*
Connection
{
t1
.
conn
,
t2
.
conn
})
t
.
Resync
(
at0
)
t
.
Resync
(
at0
)
assert
.
Equal
(
db
.
pool
,
[]
*
Connection
{
t1
.
conn
,
t2
.
conn
})
assert
.
Equal
(
db
.
pool
,
[]
*
Connection
{
t1
.
conn
,
t2
.
conn
})
// obj2 should be invalidated
// obj2 should be invalidated
assert
.
Equal
(
t
.
conn
.
Cache
()
.
Get
(
101
),
robj1
)
// XXX is
assert
.
Equal
(
t
.
conn
.
Cache
()
.
Get
(
102
),
robj2
)
// XXX is
t
.
checkObj
(
robj1
,
101
,
InvalidTid
,
GHOST
,
0
,
nil
)
t
.
checkObj
(
robj1
,
101
,
InvalidTid
,
GHOST
,
0
,
nil
)
t
.
checkObj
(
robj2
,
102
,
InvalidTid
,
GHOST
,
0
,
nil
)
t
.
checkObj
(
robj2
,
102
,
InvalidTid
,
GHOST
,
0
,
nil
)
assert
.
Exactly
(
robj1
,
t
.
Get
(
101
))
// XXX is
assert
.
Exactly
(
robj2
,
t
.
Get
(
102
))
// XXX is
t
.
PActivate
(
robj1
)
t
.
PActivate
(
robj1
)
t
.
PActivate
(
robj2
)
t
.
PActivate
(
robj2
)
t
.
checkObj
(
robj1
,
101
,
at0
,
UPTODATE
,
1
,
nil
)
t
.
checkObj
(
robj1
,
101
,
at0
,
UPTODATE
,
1
,
nil
)
...
@@ -558,6 +558,19 @@ func TestPersistentDB(t0 *testing.T) {
...
@@ -558,6 +558,19 @@ func TestPersistentDB(t0 *testing.T) {
t
.
checkObj
(
robj1
,
101
,
InvalidTid
,
GHOST
,
0
,
nil
)
t
.
checkObj
(
robj1
,
101
,
InvalidTid
,
GHOST
,
0
,
nil
)
t
.
checkObj
(
robj2
,
102
,
at0
,
UPTODATE
,
0
,
nil
)
t
.
checkObj
(
robj2
,
102
,
at0
,
UPTODATE
,
0
,
nil
)
// Resync ↑ (at0 -> at2; from outside δtail coverage)
t
.
Abort
()
assert
.
Equal
(
db
.
pool
,
[]
*
Connection
{
t1
.
conn
,
t2
.
conn
})
t
.
Resync
(
at2
)
assert
.
Equal
(
db
.
pool
,
[]
*
Connection
{
t1
.
conn
,
t2
.
conn
})
// obj2 should be invalidated
assert
.
Equal
(
t
.
conn
.
Cache
()
.
Get
(
101
),
robj1
)
// XXX is
assert
.
Equal
(
t
.
conn
.
Cache
()
.
Get
(
102
),
robj2
)
// XXX is
t
.
checkObj
(
robj1
,
101
,
InvalidTid
,
GHOST
,
0
,
nil
)
t
.
checkObj
(
robj2
,
102
,
InvalidTid
,
GHOST
,
0
,
nil
)
// XXX DB.Open with at on and +-1 δtail edges
// XXX DB.Open with at on and +-1 δtail edges
...
...
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