Skip to content

mysql incr - alter table FOREIGN KEY ON DELETE SET NULL ON UPDATE SET NULL, the symbol is differenet #794

@asiroliu

Description

@asiroliu

Description

mysql incr - alter table FOREIGN KEY ON DELETE SET NULL ON UPDATE SET NULL, the symbol is differenet

Steps to reproduce the issue

  1. create table and insert data on src mysql
SQL> CREATE TABLE parent_3 (id INT NOT NULL, PRIMARY KEY (id)); 
SQL> CREATE TABLE child_3 (id INT, parent_id INT);  
SQL> INSERT INTO parent_3 VALUES (1), (2), (3), (4), (5); 
SQL> INSERT INTO child_3 VALUES (1,1), (2,2), (3,3), (4,4), (5,5);
  1. create database level dtle job, set use_my_sql_dependency=false, parallel_workers>1
    3.execute alter sql on src mysql
SQL> ALTER TABLE child_3 ADD CONSTRAINT FOREIGN KEY fk_child_3_1 (parent_id) REFERENCES parent_3(`id`) ON DELETE SET NULL ON UPDATE SET NULL;
  1. check show create, the symbol is differenet. child_3_ibfk_1 and fk_child_3_1
# src mysql
SQL> SHOW CREATE TABLE child_3;
child_3 | CREATE TABLE `child_3` (
  `id` int(11) DEFAULT NULL,
  `parent_id` int(11) DEFAULT NULL,
  KEY `fk_child_3_1` (`parent_id`),
  CONSTRAINT `child_3_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent_3` (`id`) ON DELETE SET NULL ON UPDATE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
# dest mysql
SQL> SHOW CREATE TABLE child_3;
 CREATE TABLE `child_3` (
  `id` int(11) DEFAULT NULL,
  `parent_id` int(11) DEFAULT NULL,
  KEY `fk_child_3_1` (`parent_id`),
  CONSTRAINT `fk_child_3_1` FOREIGN KEY (`parent_id`) REFERENCES `parent_3` (`id`) ON DELETE SET NULL ON UPDATE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
  1. check general log
# src mysql
2021-10-26T07:44:30.041692Z	   57 Query	ALTER TABLE child_3 ADD CONSTRAINT FOREIGN KEY fk_child_3_1 (parent_id) REFERENCES parent_3(`id`) ON DELETE SET NULL ON UPDATE SET NULL
# dest mysql
2021-10-26T07:44:30.056401Z	   41 Query	START TRANSACTION
2021-10-26T07:44:30.056847Z	   41 Query	USE `action_db_1`
2021-10-26T07:44:30.057284Z	   41 Query	ALTER TABLE child_3 ADD CONSTRAINT FOREIGN KEY fk_child_3_1 (parent_id) REFERENCES parent_3(`id`) ON DELETE SET NULL ON UPDATE SET NULL /*dtle_gtid1 ddl_alter_table_fk-migration 967ec286-362f-11ec-8c06-0242ac640903 49 dtle_gtid*/
2021-10-26T07:44:30.065184Z	   41 Execute	replace into dtle.gtid_executed_v4 (job_name,source_uuid,gtid,gtid_set) values (?, ?, ?, null)
2021-10-26T07:44:30.065800Z	   41 Query	COMMIT

Describe the results you expected

the constraint symbol shold be same

Output of ./dtle version:**

9.9.9.9-master-3fa3c54

Additional information

(e.g. issue happens only occasionally)

Additional details (log, config, job config etc):

Metadata

Metadata

Assignees

No one assigned

    Labels

    DDLDDL bug or issueVERIFIEDverified issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions