From c04b9a7f07e75d2929f140c4d1c10b4ad8634386 Mon Sep 17 00:00:00 2001 From: Ewan Chou Date: Thu, 2 Aug 2018 12:23:11 +0800 Subject: [PATCH] binlog: fix bug in load data (#7242) Cherry-pick https://github.com/pingcap/tidb/pull/7074 --- server/conn.go | 2 +- store/tikv/2pc.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/server/conn.go b/server/conn.go index da957c8441ad0..56f9a68d45e88 100644 --- a/server/conn.go +++ b/server/conn.go @@ -814,7 +814,7 @@ func (cc *clientConn) handleLoadData(ctx context.Context, loadDataInfo *executor } return errors.Trace(err) } - return errors.Trace(txn.Commit(sessionctx.SetConnID2Ctx(ctx, loadDataInfo.Ctx))) + return errors.Trace(cc.ctx.CommitTxn(sessionctx.SetConnID2Ctx(ctx, loadDataInfo.Ctx))) } // handleLoadStats does the additional work after processing the 'load stats' query. diff --git a/store/tikv/2pc.go b/store/tikv/2pc.go index 2d7cbf34f4ead..ec191ad77e79e 100644 --- a/store/tikv/2pc.go +++ b/store/tikv/2pc.go @@ -679,6 +679,7 @@ func (c *twoPhaseCommitter) writeFinishBinlog(tp binlog.BinlogType, commitTS int binInfo := c.txn.us.GetOption(kv.BinlogInfo).(*binloginfo.BinlogInfo) binInfo.Data.Tp = tp binInfo.Data.CommitTs = commitTS + binInfo.Data.PrewriteValue = nil go func() { err := binInfo.WriteBinlog(c.store.clusterID) if err != nil {