Skip to content

Commit

Permalink
dont check startts if it is preset
Browse files Browse the repository at this point in the history
  • Loading branch information
b6g committed Dec 7, 2024
1 parent e3c4981 commit 3ec86a7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/sessiontxn/isolation/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ func (p *baseTxnContextProvider) getTxnStartTS() (uint64, error) {
return txn.StartTS(), nil
}

func (p *baseTxnContextProvider) usePresetStartTS() bool {
return p.constStartTS != 0 || p.sctx.GetSessionVars().SnapshotTS != 0
}

// ActivateTxn activates the transaction and set the relevant context variables.
func (p *baseTxnContextProvider) ActivateTxn() (kv.Transaction, error) {
if p.txn != nil {
Expand Down Expand Up @@ -307,7 +311,7 @@ func (p *baseTxnContextProvider) ActivateTxn() (kv.Transaction, error) {
}

// verify start_ts is later than any previous commit_ts in the session
if sessVars.LastCommitTS > 0 && sessVars.LastCommitTS > sessVars.TxnCtx.StartTS {
if !p.usePresetStartTS() && sessVars.LastCommitTS > 0 && sessVars.LastCommitTS > sessVars.TxnCtx.StartTS {
logutil.BgLogger().Panic("check session lastCommitTS failed",
zap.Uint64("lastCommitTS", sessVars.LastCommitTS),
zap.Uint64("startTS", sessVars.TxnCtx.StartTS),
Expand Down

0 comments on commit 3ec86a7

Please sign in to comment.