diff --git a/Makefile b/Makefile index 4a94db3285e..75d880df557 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ ifeq (${CDC_ENABLE_VENDOR}, 1) GOVENDORFLAG := -mod=vendor endif -GOBUILD := CGO_ENABLED=0 $(GO) build $(BUILD_FLAG) -trimpath $(GOVENDORFLAG) +GOBUILD :=GOOS=linux CGO_ENABLED=0 $(GO) build $(BUILD_FLAG) -trimpath $(GOVENDORFLAG) GOBUILDNOVENDOR := CGO_ENABLED=0 $(GO) build $(BUILD_FLAG) -trimpath GOTEST := CGO_ENABLED=1 $(GO) test -p $(P) --race GOTESTNORACE := CGO_ENABLED=1 $(GO) test -p $(P) diff --git a/cdc/owner/changefeed.go b/cdc/owner/changefeed.go index 20e7326d23e..73907a348b2 100644 --- a/cdc/owner/changefeed.go +++ b/cdc/owner/changefeed.go @@ -15,6 +15,7 @@ package owner import ( "context" + "math" "strings" "sync" "time" @@ -500,9 +501,15 @@ func (c *changefeed) handleBarrier(ctx cdcContext.Context) (uint64, error) { c.barriers.Update(ddlJobBarrier, newDDLResolvedTs) case syncPointBarrier: + // clean up barriers if syncpoint disabled when update changefeed + if !ctx.ChangefeedVars().Info.SyncPointEnabled { + c.barriers.Update(syncPointBarrier, math.MaxUint64) + return 0, nil + } if !blocked { return barrierTs, nil } + nextSyncPointTs := oracle.GoTimeToTS(oracle.GetTimeFromTS(barrierTs).Add(c.state.Info.SyncPointInterval)) if err := c.sink.emitSyncPoint(ctx, barrierTs); err != nil { return 0, errors.Trace(err) diff --git a/cdc/sink/mysql_syncpoint_store.go b/cdc/sink/mysql_syncpoint_store.go index 4322fea6243..f97748e5efe 100644 --- a/cdc/sink/mysql_syncpoint_store.go +++ b/cdc/sink/mysql_syncpoint_store.go @@ -96,7 +96,7 @@ func newMySQLSyncpointStore(ctx context.Context, id string, sinkURI *url.URL, so func generateDSNStr(ctx context.Context, id string, uri *url.URL, dsnType string) (string, error) { scheme := strings.ToLower(uri.Scheme) if scheme != "mysql" && scheme != "tidb" && scheme != "mysql+ssl" && scheme != "tidb+ssl" { - return "", errors.New("can create mysql sink with unsupported scheme") + return "", errors.New("can not create mysql sink with unsupported scheme") } params := defaultParams.Clone() diff --git a/cdc/verification/module_verification.go b/cdc/verification/module_verification.go index 642b9117e76..1c99da109c8 100644 --- a/cdc/verification/module_verification.go +++ b/cdc/verification/module_verification.go @@ -248,6 +248,10 @@ func (m *ModuleVerification) GC(ctx context.Context, endTs string) error { default: } + if endTs == "" { + return nil + } + err := m.deleteTrackData(endTs) if err != nil { return err diff --git a/cdc/verification/module_verification_test.go b/cdc/verification/module_verification_test.go index 32738ddf3d9..ef40383662a 100644 --- a/cdc/verification/module_verification_test.go +++ b/cdc/verification/module_verification_test.go @@ -47,6 +47,9 @@ func TestNewModuleVerification(t *testing.T) { defer m4.Close() require.Nil(t, err) require.NotSame(t, m4, m3) + + err = m4.GC(context.Background(), "") + require.Nil(t, err) } func TestModuleVerification_SentTrackData(t *testing.T) { diff --git a/cdc/verification/verification_test.go b/cdc/verification/verification_test.go index 2e78a029c1a..5937be18437 100644 --- a/cdc/verification/verification_test.go +++ b/cdc/verification/verification_test.go @@ -1,3 +1,16 @@ +// Copyright 2022 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + package verification import (