Browse Source

LockOnceGlobalTrans for boltdb fixed

pull/175/head
yedf2 4 years ago
parent
commit
20e22fa1f2
  1. 3
      dtmsvr/storage/boltdb/boltdb.go

3
dtmsvr/storage/boltdb/boltdb.go

@ -14,6 +14,7 @@ import (
bolt "go.etcd.io/bbolt"
"github.com/dtm-labs/dtm/dtmcli"
"github.com/dtm-labs/dtm/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/dtmcli/logger"
"github.com/dtm-labs/dtm/dtmsvr/config"
@ -386,7 +387,7 @@ func (s *Store) LockOneGlobalTrans(expireIn time.Duration) *storage.TransGlobalS
next := time.Now().Add(time.Duration(conf.RetryInterval) * time.Second)
err := boltGet().Update(func(t *bolt.Tx) error {
cursor := t.Bucket(bucketIndex).Cursor()
for trans == nil {
for trans == nil || trans.Status == dtmcli.StatusSucceed || trans.Status == dtmcli.StatusFailed {
k, v := cursor.First()
if k == nil || string(k) > min {
return storage.ErrNotFound

Loading…
Cancel
Save