Skip to content

Commit

Permalink
fix typo and refactor
Browse files Browse the repository at this point in the history
Signed-off-by: ekexium <[email protected]>
  • Loading branch information
ekexium committed Oct 10, 2024
1 parent a0e8ccc commit 79c2af1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions txnkv/transaction/2pc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1342,14 +1342,17 @@ func keepAlive(
tm.close()
}
return
continue

Check failure on line 1345 in txnkv/transaction/2pc.go

View workflow job for this annotation

GitHub Actions / golangci

unreachable: unreachable code (govet)
}
} else {
keepFail = 0
metrics.TxnHeartBeatHistogramOK.Observe(time.Since(startTime).Seconds())
}

// broadcast to all stores
if err != nil && isPipelinedTxn {
keepFail = 0
metrics.TxnHeartBeatHistogramOK.Observe(time.Since(startTime).Seconds())
// Broadcast to all stores only when the heartbeat succeeds.
// This ensures that PK is the single source of truth for transaction status on the
// TiKV side. It prevents potential inconsistencies where the cached information might
// be more up-to-date than the info stored in the PK.
if isPipelinedTxn {
broadcastToAllStores(
c.txn,
c.store,
Expand Down

0 comments on commit 79c2af1

Please sign in to comment.