Skip to content

Commit

Permalink
ddl: do not unset involving schema on EntryTooLarge error (#51963)
Browse files Browse the repository at this point in the history
close #51962
  • Loading branch information
tangenta authored Mar 21, 2024
1 parent 2fffb7f commit 2b4134a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
17 changes: 17 additions & 0 deletions pkg/ddl/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1063,3 +1063,20 @@ func TestMDLTruncateTable(t *testing.T) {
require.True(t, timetk2.After(timeMain))
require.True(t, timetk3.After(timeMain))
}

func TestDDLJobErrEntrySizeTooLarge(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)

tk.MustExec("use test")
tk.MustExec("create table t (a int);")

require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/pkg/ddl/mockErrEntrySizeTooLarge", `1*return(true)`))
t.Cleanup(func() {
require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/pkg/ddl/mockErrEntrySizeTooLarge"))
})

tk.MustGetErrCode("rename table t to t1;", errno.ErrEntryTooLarge)
tk.MustExec("create table t1 (a int);")
tk.MustExec("alter table t add column b int;") // Should not block.
}
1 change: 0 additions & 1 deletion pkg/ddl/ddl_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,6 @@ func (w *worker) handleUpdateJobError(t *meta.Meta, job *model.Job, err error) e
}
// Reduce this txn entry size.
job.BinlogInfo.Clean()
job.InvolvingSchemaInfo = nil
job.Error = toTError(err)
job.ErrorCount++
job.SchemaState = model.StateNone
Expand Down

0 comments on commit 2b4134a

Please sign in to comment.