Commit 59649ba3 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 670bd87a
......@@ -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.
//
......
......@@ -335,7 +335,7 @@ func TestPersistentDB(t *testing.T) {
assert.Equal(conn1.txn, nil)
assert.Equal(db.pool, []*Connection{conn1})
println("BBB")
println("\n\nBBB")
// open new connection - it should be conn1 but at updated database view
txn3, ctx3 := transaction.New(ctx)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment