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
59649ba3
Commit
59649ba3
authored
Jan 28, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
670bd87a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
go/zodb/db.go
go/zodb/db.go
+9
-0
go/zodb/persistent_test.go
go/zodb/persistent_test.go
+1
-1
No files found.
go/zodb/db.go
View file @
59649ba3
...
...
@@ -284,6 +284,7 @@ func (db *DB) Open(ctx context.Context, opt *ConnOptions) (_ *Connection, err er
// must be called with db.mu locked.
// db.mu is unlocked on error.
func
(
db
*
DB
)
openOrDBUnlock
(
ctx
context
.
Context
,
at
Tid
,
noPool
bool
)
(
*
Connection
,
error
)
{
fmt
.
Printf
(
"db.openx %s %v
\t
; δtail (%s, %s]
\n
"
,
at
,
noPool
,
db
.
δtail
.
Tail
(),
db
.
δtail
.
Head
())
// NoPool connection - create one anew
if
noPool
{
conn
:=
newConnection
(
db
,
at
)
...
...
@@ -336,6 +337,8 @@ retry:
}
}
// XXX note: vvv at start δtail.Tail is not covering first committed txn
// at ∈ (δtail, δhead] ; try to get nearby idle connection or make a new one
conn
=
db
.
get
(
δtail
.
Tail
(),
at
)
if
conn
==
nil
{
...
...
@@ -470,6 +473,12 @@ func (db *DB) get(atMin, at Tid) *Connection {
return
at
<
db
.
pool
[
i
]
.
at
})
fmt
.
Printf
(
"pool:
\n
"
)
for
i
:=
0
;
i
<
l
;
i
++
{
fmt
.
Printf
(
"
\t
[%d]: .at = %s
\n
"
,
i
,
db
.
pool
[
i
]
.
at
)
}
fmt
.
Printf
(
"get [%s, %s] -> %d
\n
"
,
atMin
,
at
,
i
)
// search through window of X previous connections and find out the one
// with minimal distance to get to state @at that fits into requested range.
//
...
...
go/zodb/persistent_test.go
View file @
59649ba3
...
...
@@ -335,7 +335,7 @@ func TestPersistentDB(t *testing.T) {
assert
.
Equal
(
conn1
.
txn
,
nil
)
assert
.
Equal
(
db
.
pool
,
[]
*
Connection
{
conn1
})
println
(
"BBB"
)
println
(
"
\n\n
BBB"
)
// open new connection - it should be conn1 but at updated database view
txn3
,
ctx3
:=
transaction
.
New
(
ctx
)
...
...
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