Commit bed9a661 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent c3fd8cf3
...@@ -133,7 +133,7 @@ func (db *DB) get(at Tid) *Connection { ...@@ -133,7 +133,7 @@ func (db *DB) get(at Tid) *Connection {
// nothing found or too distant // nothing found or too distant
const Tnear = 10*time.Minute // XXX hardcoded const Tnear = 10*time.Minute // XXX hardcoded
if jδmin < 0 || tabs(δtid(at, db.connv[jδmin].at)) > Tnear { if jδmin < 0 || tabs(δtid(at, db.connv[jδmin].at)) > Tnear {
return &Connection{stor: db.stor, db: db} return &Connection{stor: db.stor, db: db, at: at}
} }
// reuse the connection // reuse the connection
...@@ -142,8 +142,13 @@ func (db *DB) get(at Tid) *Connection { ...@@ -142,8 +142,13 @@ func (db *DB) get(at Tid) *Connection {
db.connv[l-1] = nil db.connv[l-1] = nil
db.connv = db.connv[:l-1] db.connv = db.connv[:l-1]
// XXX assert conn.txn == nil if !(conn.db == db && conn.txn == nil) {
// XXX assert conn.db == db panic("DB.get: foreign/live connection in the pool")
}
if conn.at != at {
panic("DB.get: TODO: invalidations")
}
return conn return conn
} }
......
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