|
|
@ -7,6 +7,7 @@ import (
|
|
|
|
"reflect"
|
|
|
|
"reflect"
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
"sync/atomic"
|
|
|
|
"sync/atomic"
|
|
|
|
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
var (
|
|
|
@ -181,6 +182,12 @@ func (t *MDBTable) StartTxn(readonly bool, mdbTxn *MDBTxn) (*MDBTxn, error) {
|
|
|
|
var tx *mdb.Txn
|
|
|
|
var tx *mdb.Txn
|
|
|
|
var err error
|
|
|
|
var err error
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Panic if we deadlock acquiring a transaction
|
|
|
|
|
|
|
|
timeout := time.AfterFunc(5*time.Second, func() {
|
|
|
|
|
|
|
|
panic("Timeout starting MDB transaction, potential deadlock")
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
defer timeout.Stop()
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure the modes agree
|
|
|
|
// Ensure the modes agree
|
|
|
|
if mdbTxn != nil {
|
|
|
|
if mdbTxn != nil {
|
|
|
|
if mdbTxn.readonly != readonly {
|
|
|
|
if mdbTxn.readonly != readonly {
|
|
|
|