From c3565416fe264dd9baded339d5e16efda0f80010 Mon Sep 17 00:00:00 2001 From: david058 <371369527@qq.com> Date: Mon, 2 Dec 2024 14:27:03 +0800 Subject: [PATCH] =?UTF-8?q?update=20actions/schema=5Ftab=5Fstruct.go=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=B9=E6=AF=94=E6=95=B0=E6=8D=AE=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=E9=97=AE=E9=A2=98=EF=BC=9A1.=E5=85=A8=E5=BA=93?= =?UTF-8?q?=E7=B4=A2=E5=BC=95=E5=AF=B9=E6=AF=94=E8=BF=87=E7=A8=8B=E4=B8=AD?= =?UTF-8?q?=EF=BC=8C=E4=B8=80=E6=97=A6=E5=8F=91=E7=8E=B0=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E8=A1=A8=E7=B4=A2=E5=BC=95=E4=B8=8D=E5=90=8C=EF=BC=8C=E5=90=8E?= =?UTF-8?q?=E7=BB=AD=E6=89=80=E6=9C=89=E8=A1=A8=E5=AF=B9=E6=AF=94=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E9=83=BD=E6=98=AF=E4=B8=8D=E5=90=8C=202.=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Dpartitions=E3=80=81foreign=E3=80=81trigger=E3=80=81fun?= =?UTF-8?q?c=E5=92=8Cproc=20=E6=89=A7=E8=A1=8C=E8=BF=87=E7=A8=8B=E4=B8=AD?= =?UTF-8?q?=E6=8A=A5panic:=20assignment=20to=20entry=20in=20nil=20map?= =?UTF-8?q?=EF=BC=8CtmpM=20=3D=20nil=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- actions/schema_tab_struct.go | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/actions/schema_tab_struct.go b/actions/schema_tab_struct.go index 2ee3453..74684ae 100644 --- a/actions/schema_tab_struct.go +++ b/actions/schema_tab_struct.go @@ -646,7 +646,7 @@ func (stcls *schemaTable) Trigger(dtabS []string, logThreadSeq, logThreadSeq2 in global.Wlog.Debug(vlog) continue } - tmpM = nil + tmpM = make(map[string]int) vlog = fmt.Sprintf("(%d) Start seeking the union of the source and target databases %s Trigger. to dispos it...", logThreadSeq, stcls.schema) global.Wlog.Debug(vlog) for k, _ := range sourceTrigger { @@ -722,7 +722,7 @@ func (stcls *schemaTable) Proc(dtabS []string, logThreadSeq, logThreadSeq2 int64 continue } - tmpM = nil + tmpM = make(map[string]int) vlog = fmt.Sprintf("(%d) Start seeking the union of the source and target databases %s Stored Procedure. to dispos it...", logThreadSeq, stcls.schema) global.Wlog.Debug(vlog) for k, _ := range sourceProc { @@ -821,7 +821,7 @@ func (stcls *schemaTable) Func(dtabS []string, logThreadSeq, logThreadSeq2 int64 continue } - tmpM = nil + tmpM = make(map[string]int) vlog = fmt.Sprintf("(%d) Start seeking the union of the source and target databases %s Stored Function. to dispos it...", logThreadSeq, stcls.schema) global.Wlog.Debug(vlog) for k, _ := range sourceFunc { @@ -952,7 +952,7 @@ func (stcls *schemaTable) Foreign(dtabS []string, logThreadSeq, logThreadSeq2 in global.Wlog.Debug(vlog) continue } - tmpM = nil + tmpM = make(map[string]int) vlog = fmt.Sprintf("(%d) Start seeking the union of the source and target table %s.%s Foreign Name. to dispos it...", logThreadSeq, stcls.schema, stcls.table) global.Wlog.Debug(vlog) for k, _ := range sourceForeign { @@ -1027,7 +1027,7 @@ func (stcls *schemaTable) Partitions(dtabS []string, logThreadSeq, logThreadSeq2 continue } - tmpM = nil + tmpM = make(map[string]int) vlog = fmt.Sprintf("(%d) Start seeking the union of the source and target table %s.%s Partitions Column. to dispos it...", logThreadSeq, stcls.schema, stcls.table) global.Wlog.Debug(vlog) for k, _ := range sourcePartitions { @@ -1138,12 +1138,17 @@ func (stcls *schemaTable) Index(dtabS []string, logThreadSeq, logThreadSeq2 int6 sqlS = append(sqlS, indexGenerate(smul, dmul, aa, "mul")...) vlog = fmt.Sprintf("(%d) %s Compare whether the no-unique key index is consistent and verified.", logThreadSeq, event) global.Wlog.Debug(vlog) + // 应用并清空 sqlS if len(sqlS) > 0 { - pods.Differences = "yes" - } - if err = ApplyDataFix(sqlS, stcls.datefix, stcls.sfile, stcls.destDrive, stcls.djdbc, logThreadSeq); err != nil { - return err - } + pods.Differences = "yes" + + err := ApplyDataFix(sqlS, stcls.datefix, stcls.sfile, stcls.destDrive, stcls.djdbc, logThreadSeq) + if err != nil { + return err + } + sqlS = []string{} // 清空 sqlS 以便下一个表使用 + } + measuredDataPods = append(measuredDataPods, pods) vlog = fmt.Sprintf("(%d) %s The source target segment table %s.%s index column data verification is completed", logThreadSeq, event, stcls.schema, stcls.table) global.Wlog.Info(vlog) -- Gitee