Skip to content

Commit

Permalink
session: fix the problem that lost connection in t ... (#18567) (#18724)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-srebot authored Sep 2, 2020
1 parent a1f81f9 commit fcb4274
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions session/txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,17 +545,10 @@ func (s *session) HasDirtyContent(tid int64) bool {
// StmtCommit implements the sessionctx.Context interface.
func (s *session) StmtCommit(memTracker *memory.Tracker) error {
defer func() {
// If StmtCommit is called in batch mode, we need to clear the txn size
// in memTracker to avoid double-counting. If it's not batch mode, this
// work has no effect because that no more data will be appended into
// s.txn.
if memTracker != nil {
memTracker.Consume(int64(-s.txn.Size()))
}
s.txn.cleanup()
}()

st := &s.txn
txnSize := st.Transaction.Size()

if _, err := st.Flush(); err != nil {
return err
Expand All @@ -571,9 +564,6 @@ func (s *session) StmtCommit(memTracker *memory.Tracker) error {
st.doNotCommit = err
return err
}
if memTracker != nil {
memTracker.Consume(int64(st.Transaction.Size() - txnSize))
}

// Need to flush binlog.
for tableID, delta := range st.mutations {
Expand Down

0 comments on commit fcb4274

Please sign in to comment.