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
f4ebe975
Commit
f4ebe975
authored
Feb 01, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
9f4ac6f7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
go/zodb/db.go
go/zodb/db.go
+2
-1
go/zodb/persistent_test.go
go/zodb/persistent_test.go
+6
-2
No files found.
go/zodb/db.go
View file @
f4ebe975
...
@@ -268,7 +268,7 @@ func (db *DB) Open(ctx context.Context, opt *ConnOptions) (_ *Connection, err er
...
@@ -268,7 +268,7 @@ func (db *DB) Open(ctx context.Context, opt *ConnOptions) (_ *Connection, err er
db
.
mu
.
Lock
()
// unlocked in *DBUnlock
db
.
mu
.
Lock
()
// unlocked in *DBUnlock
/*
/*
err := db.needHeadOrDBUnlock(ctx, at)
err := db.needHeadOrDBUnlock(ctx, at)
XXX wait for δtail.head >= at
if err != nil {
if err != nil {
return nil, err
return nil, err
}
}
...
@@ -528,6 +528,7 @@ func (db *DB) put(conn *Connection) {
...
@@ -528,6 +528,7 @@ func (db *DB) put(conn *Connection) {
defer
db
.
mu
.
Unlock
()
defer
db
.
mu
.
Unlock
()
// XXX check if len(pool) > X, and drop conn if yes
// XXX check if len(pool) > X, and drop conn if yes
// [i-1].at ≤ at < [i].at
// [i-1].at ≤ at < [i].at
i
:=
sort
.
Search
(
len
(
db
.
pool
),
func
(
i
int
)
bool
{
i
:=
sort
.
Search
(
len
(
db
.
pool
),
func
(
i
int
)
bool
{
return
conn
.
at
<
db
.
pool
[
i
]
.
at
return
conn
.
at
<
db
.
pool
[
i
]
.
at
...
...
go/zodb/persistent_test.go
View file @
f4ebe975
...
@@ -313,6 +313,8 @@ func TestPersistentDB(t *testing.T) {
...
@@ -313,6 +313,8 @@ func TestPersistentDB(t *testing.T) {
// conn1 stays at older view for now
// conn1 stays at older view for now
checkObj
(
obj1
,
conn1
,
101
,
InvalidTid
,
GHOST
,
0
,
nil
)
checkObj
(
obj2
,
conn1
,
102
,
InvalidTid
,
GHOST
,
0
,
nil
)
err
=
obj1
.
PActivate
(
ctx1
);
X
(
err
)
err
=
obj1
.
PActivate
(
ctx1
);
X
(
err
)
err
=
obj2
.
PActivate
(
ctx1
);
X
(
err
)
err
=
obj2
.
PActivate
(
ctx1
);
X
(
err
)
checkObj
(
obj1
,
conn1
,
101
,
at1
,
UPTODATE
,
1
,
nil
)
checkObj
(
obj1
,
conn1
,
101
,
at1
,
UPTODATE
,
1
,
nil
)
...
@@ -363,10 +365,12 @@ func TestPersistentDB(t *testing.T) {
...
@@ -363,10 +365,12 @@ func TestPersistentDB(t *testing.T) {
assert
.
Equal
(
obj1
.
value
,
"hello"
)
assert
.
Equal
(
obj1
.
value
,
"hello"
)
assert
.
Equal
(
obj2
.
value
,
"kitty"
)
assert
.
Equal
(
obj2
.
value
,
"kitty"
)
// finish tnx3 and txn2 - conn1 and conn2 go back to db pool
// XXX
txn3
.
Abort
()
txn3
.
Abort
()
txn2
.
Abort
()
txn2
.
Abort
()
assert
.
Equal
(
conn1
.
txn
,
nil
)
assert
.
Equal
(
conn2
.
txn
,
nil
)
assert
.
Equal
(
db
.
pool
,
[]
*
Connection
{
conn1
,
conn2
})
// 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