Skip to content

Commit

Permalink
server: forget to add StmtCommit when loading data (pingcap#5758)
Browse files Browse the repository at this point in the history
  • Loading branch information
zimulala authored and shenli committed Feb 1, 2018
1 parent d95f965 commit ddca655
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions server/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,7 @@ func insertDataWithCommit(goCtx goctx.Context, prevData, curData []byte, loadDat
if !reachLimit {
break
}
terror.Log(loadDataInfo.Ctx.StmtCommit())
// Make sure that there are no retries when committing.
if err = loadDataInfo.Ctx.RefreshTxnCtx(goCtx); err != nil {
return nil, errors.Trace(err)
Expand Down
6 changes: 6 additions & 0 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/go-sql-driver/mysql"
. "github.com/pingcap/check"
"github.com/pingcap/tidb/executor"
"github.com/pingcap/tidb/kv"
tmysql "github.com/pingcap/tidb/mysql"
"github.com/pingcap/tidb/util/logutil"
"github.com/pingcap/tidb/util/printer"
Expand Down Expand Up @@ -322,6 +323,11 @@ func runTestLoadData(c *C, server *Server) {
"xxx row5_col1 - row5_col3")
c.Assert(err, IsNil)

originalTxnTotalSizeLimit := kv.TxnTotalSizeLimit
// If the MemBuffer can't be committed once in each batch, it will return an error like "transaction is too large".
kv.TxnTotalSizeLimit = 10240
defer func() { kv.TxnTotalSizeLimit = originalTxnTotalSizeLimit }()

// support ClientLocalFiles capability
runTestsOnNewDB(c, func(config *mysql.Config) {
config.AllowAllFiles = true
Expand Down

0 comments on commit ddca655

Please sign in to comment.