From 3bf577c5063b27fb5b38acd3201382df36fcf15b Mon Sep 17 00:00:00 2001 From: qupeng Date: Wed, 22 Dec 2021 18:38:36 +0800 Subject: [PATCH] address comments Signed-off-by: qupeng --- ddl/table_test.go | 2 +- parser/model/ddl.go | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ddl/table_test.go b/ddl/table_test.go index 1353da26bab64..78be85a8dbd97 100644 --- a/ddl/table_test.go +++ b/ddl/table_test.go @@ -389,7 +389,7 @@ func TestRenameTables(t *testing.T) { txn, _ := ctx.Txn(true) historyJob, _ := meta.NewMeta(txn).GetHistoryDDLJob(job.ID) - wantTblInfos := historyJob.BinlogInfo.MultipleTableInfo + wantTblInfos := historyJob.BinlogInfo.MultipleTableInfos require.Equal(t, wantTblInfos[0].Name.L, "tt1") require.Equal(t, wantTblInfos[1].Name.L, "tt2") } diff --git a/parser/model/ddl.go b/parser/model/ddl.go index 2ad98980410c0..9716cea38cd23 100644 --- a/parser/model/ddl.go +++ b/parser/model/ddl.go @@ -176,8 +176,8 @@ type HistoryInfo struct { TableInfo *TableInfo FinishedTS uint64 - // MultipleTableInfo is like TableInfo but only for operations updating multiple DBs. - MultipleTableInfo []*TableInfo + // MultipleTableInfos is like TableInfo but only for operations updating multiple tables. + MultipleTableInfos []*TableInfo } // AddDBInfo adds schema version and schema information that are used for binlog. @@ -199,6 +199,7 @@ func (h *HistoryInfo) Clean() { h.SchemaVersion = 0 h.DBInfo = nil h.TableInfo = nil + h.MultipleTableInfos = nil } // DDLReorgMeta is meta info of DDL reorganization. @@ -288,7 +289,8 @@ func (job *Job) FinishMultipleTableJob(jobState JobState, schemaState SchemaStat job.State = jobState job.SchemaState = schemaState job.BinlogInfo.SchemaVersion = ver - job.BinlogInfo.MultipleTableInfo = tblInfos + job.BinlogInfo.MultipleTableInfos = tblInfos + job.BinlogInfo.TableInfo = tblInfos[len(tblInfos)-1] } // FinishDBJob is called when a job is finished.