From 09392e10c6e6f0a5a3202e869c950e58e4753b9a Mon Sep 17 00:00:00 2001 From: luancheng Date: Wed, 26 Aug 2020 17:18:27 +0800 Subject: [PATCH] fix switch mode bug in restore --- pkg/restore/client.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/restore/client.go b/pkg/restore/client.go index a9cfaa952..dd1258293 100644 --- a/pkg/restore/client.go +++ b/pkg/restore/client.go @@ -714,6 +714,14 @@ func (rc *Client) SwitchToImportMode(ctx context.Context) { // so we need ping tikv in less than 10 minute go func() { tick := time.NewTicker(rc.switchModeInterval) + defer tick.Stop() + + // [important!] switch tikv mode into import at the beginning + log.Info("switch to import mode at beginning") + err := rc.switchTiKVMode(ctx, import_sstpb.SwitchMode_Import) + if err != nil { + log.Warn("switch to import mode failed", zap.Error(err)) + } for { select {