Skip to content

Commit 95f4e8b

Browse files
author
ffffwh
committed
fix stuck after big tx
1 parent 19f5393 commit 95f4e8b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

drivers/mysql/mysql/applier_incr.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,11 @@ func (a *ApplierIncr) handleEntry(entryCtx *common.BinlogEntryContext) (err erro
307307
} else {
308308
if binlogEntry.Index == 0 {
309309
if rotated {
310-
a.logger.Debug("binlog rotated", "file", a.replayingBinlogFile)
310+
a.logger.Debug("binlog rotated. WaitForAllCommitted before", "file", a.replayingBinlogFile)
311311
if !a.mtsManager.WaitForAllCommitted() {
312312
return nil // TODO shutdown
313313
}
314+
a.logger.Debug("binlog rotated. WaitForAllCommitted after", "file", a.replayingBinlogFile)
314315
a.mtsManager.lastCommitted = 0
315316
a.mtsManager.lastEnqueue = 0
316317
a.wsManager.resetCommonParent(0)
@@ -364,6 +365,9 @@ func (a *ApplierIncr) handleEntry(entryCtx *common.BinlogEntryContext) (err erro
364365
}
365366

366367
if binlogEntry.IsPartOfBigTx() {
368+
if binlogEntry.Index == 0 {
369+
a.mtsManager.lastEnqueue = binlogEntry.Coordinates.SeqenceNumber
370+
}
367371
err = a.ApplyBinlogEvent(0, entryCtx)
368372
if err != nil {
369373
return err

drivers/mysql/mysql/applier_mts.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ func NewMtsManager(shutdownCh chan struct{}, logger g.LoggerType) *MtsManager {
5656

5757
// This function must be called sequentially.
5858
func (mm *MtsManager) WaitForAllCommitted() bool {
59+
g.Logger.Debug("WaitForAllCommitted", "lc", mm.lastCommitted, "le", mm.lastEnqueue)
5960
for {
6061
if mm.lastCommitted == mm.lastEnqueue {
6162
return true
@@ -102,6 +103,7 @@ func (mm *MtsManager) LcUpdater() {
102103
return
103104

104105
case seqNum := <-mm.chExecuted:
106+
// g.Logger.Debug("LcUpdater", "seq", seqNum)
105107
if seqNum <= mm.lastCommitted {
106108
// ignore it
107109
} else {

0 commit comments

Comments
 (0)