Skip to content

bug: (Primary/Secondary)The secondary database is disconnected from the primary database due to execution of unsupported DDL statements. #1345

@haitaoguan

Description

@haitaoguan

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

  • I confirm there is no existing issue for this

Describe the problem

###master
mysql> create table ttt(id int primary key,name varchar(10),key idx_name(name));
Query OK, 0 rows affected (0.01 sec)

mysql> show create table ttt\G
*************************** 1. row ***************************
       Table: ttt
Create Table: CREATE TABLE `ttt` (
  `id` int(11) NOT NULL,
  `name` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
1 row in set (0.00 sec)

mysql> alter table ttt rename index idx_name to new_idx_name;
Query OK, 0 rows affected (0.00 sec)
Records: 0  Duplicates: 0  Warnings: 0

###slave
mysql> show slave status\G
.....
      Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
           Master_Retry_Count: 86400
                  Master_Bind:
      Last_IO_Error_Timestamp:
     Last_SQL_Error_Timestamp:
               Master_SSL_Crl:
           Master_SSL_Crlpath:
           Retrieved_Gtid_Set: 4a1f94f1-6fac-11ed-aa3d-46a07fb8ee2c:1-2
            Executed_Gtid_Set: 4a1f94f1-6fac-11ed-aa3d-46a07fb8ee2c:1
                Auto_Position: 1
         Replicate_Rewrite_DB:
                 Channel_Name:
           Master_TLS_Version:
注:可以看到 Executed_Gtid_Set 比 Retrieved_Gtid_Set 少1,这是因为重命名索引的 DDL 被忽略了,下一步在主上删除索引。

###master
mysql> show create table ttt\G
*************************** 1. row ***************************
       Table: ttt
Create Table: CREATE TABLE `ttt` (
  `id` int(11) NOT NULL,
  `name` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `new_idx_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
1 row in set (0.00 sec)

mysql> drop index new_idx_name on ttt;
Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0  Warnings: 0

###slave
mysql> show slave status\G
......
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 1091
               Last_SQL_Error: Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction '4a1f94f1-6fac-11ed-aa3d-46a07fb8ee2c:3' at master log mybinlog.000001, end_log_pos 714. See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 40
                  Master_UUID: 4a1f94f1-6fac-11ed-aa3d-46a07fb8ee2c
             Master_Info_File: /stonedb57/install/data/master.info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State:
           Master_Retry_Count: 86400
                  Master_Bind:
      Last_IO_Error_Timestamp:
     Last_SQL_Error_Timestamp: 230301 14:53:44
               Master_SSL_Crl:
           Master_SSL_Crlpath:
           Retrieved_Gtid_Set: 4a1f94f1-6fac-11ed-aa3d-46a07fb8ee2c:1-3
            Executed_Gtid_Set: 4a1f94f1-6fac-11ed-aa3d-46a07fb8ee2c:1
                Auto_Position: 1
         Replicate_Rewrite_DB:
                 Channel_Name:
           Master_TLS_Version:

mysql> select * from performance_schema.replication_applier_status_by_worker\G
*************************** 1. row ***************************
         CHANNEL_NAME:
            WORKER_ID: 1
            THREAD_ID: NULL
        SERVICE_STATE: OFF
LAST_SEEN_TRANSACTION: 4a1f94f1-6fac-11ed-aa3d-46a07fb8ee2c:3
    LAST_ERROR_NUMBER: 1091
   LAST_ERROR_MESSAGE: Worker 1 failed executing transaction '4a1f94f1-6fac-11ed-aa3d-46a07fb8ee2c:3' at master log mybinlog.000001, end_log_pos 714; Error 'Can't DROP 'new_idx_name'; check that column/key exists' on query. Default database: 'db'. Query: 'drop index new_idx_name on ttt'
 LAST_ERROR_TIMESTAMP: 2023-03-01 14:53:44

Expected behavior

No response

How To Reproduce

No response

Environment

build information as follow:
Repository address: https://github.com/stoneatom/stonedb.git:stonedb-5.7-dev
Branch name: stonedb-5.7-dev
Last commit ID: f8df638
Last commit time: Date: Mon Feb 27 19:36:39 2023 +0800
Build time: Date: Tue Feb 28 10:02:51 CST 2023

Are you interested in submitting a PR to solve the problem?

  • Yes, I will!

Metadata

Metadata

Assignees

Labels

A-bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions