Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

DDL during dumping will cause MySQL dead lock #296

Closed
lance6716 opened this issue Jun 19, 2021 · 1 comment · Fixed by #305
Closed

DDL during dumping will cause MySQL dead lock #296

lance6716 opened this issue Jun 19, 2021 · 1 comment · Fixed by #305

Comments

@lance6716
Copy link
Collaborator

lance6716 commented Jun 19, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? If possible, provide a recipe for reproducing the error.
diff --git a/v4/export/dump.go b/v4/export/dump.go
index 947f187..41ea533 100755
--- a/v4/export/dump.go
+++ b/v4/export/dump.go
@@ -219,6 +219,8 @@ func (d *Dumper) Dump() (dumpErr error) {
                tctx.L().Error("fail to get estimate total count", zap.Error(err))
        }

+       time.Sleep(30*time.Second)
+
        if conf.SQL == "" {
                if err = d.dumpDatabases(writerCtx, metaConn, taskChan); err != nil && !errors.ErrorEqual(err, context.Canceled) {
                        return err

build a dumpling and

./dumpling -h 127.0.0.1 -P 3306 -u root -p 123456 -T all_mode.t1

before 30 seconds pass,

MySQL [all_mode]> alter table t1 add column new_col1 int;
  1. What did you expect to see?

dump success

  1. What did you see instead?

both dumpling and DDL stuck forever.

after kill dumpling, DDL could resume

MySQL [all_mode]> alter table t1 add column new_col1 int;
Query OK, 0 rows affected (1 min 55.673 sec)
  1. Versions of the cluster

master

@dveeden
Copy link
Contributor

dveeden commented Jul 1, 2021

LOCK INSTANCE FOR BACKUP could help here if MySQL 8.0 is used

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants