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
4c999c89
Commit
4c999c89
authored
Mar 06, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
0b792ca5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
go/zodb/db.go
go/zodb/db.go
+9
-7
No files found.
go/zodb/db.go
View file @
4c999c89
...
...
@@ -385,7 +385,15 @@ func (db *DB) Open(ctx context.Context, opt *ConnOptions) (_ *Connection, err er
// Must be called with at ≤ db.Head .
// Must be called with db.mu locked.
func
(
db
*
DB
)
open
(
at
Tid
,
noPool
bool
)
*
Connection
{
fmt
.
Printf
(
"db.open @%s nopool=%v
\t
; δtail (%s, %s]
\n
"
,
at
,
noPool
,
db
.
δtail
.
Tail
(),
db
.
δtail
.
Head
())
δtail
:=
db
.
δtail
.
fmt
.
Printf
(
"db.open @%s nopool=%v
\t
; δtail (%s, %s]
\n
"
,
at
,
noPool
,
δtail
.
Tail
(),
δtail
.
Head
())
// at should be ≤ head (caller waited for it before invoking us)
if
head
:=
δtail
.
Head
();
at
>
head
{
panic
(
fmt
.
Sprintf
(
"open: at (%s) > head (%s)"
,
at
,
head
))
}
// NoPool connection - create one anew
if
noPool
{
conn
:=
newConnection
(
db
,
at
)
...
...
@@ -400,7 +408,6 @@ func (db *DB) open(at Tid, noPool bool) *Connection {
}
// no exact match - let's try to find nearest
δtail
:=
db
.
δtail
// too far in the past, and we know there is no exact match
// -> new historic connection.
...
...
@@ -408,11 +415,6 @@ func (db *DB) open(at Tid, noPool bool) *Connection {
return
newConnection
(
db
,
at
)
}
// at should be ≤ head (caller waited for it before invoking us)
if
head
:=
δtail
.
Head
();
at
>
head
{
panic
(
fmt
.
Sprintf
(
"open: at (%s) > head (%s)"
,
at
,
head
))
}
// at ∈ (δtail, δhead] ; try to get nearby idle connection or make a new one
conn
=
db
.
get
(
δtail
.
Tail
(),
at
)
if
conn
==
nil
{
...
...
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