- execute these sqls in upstream cluster
DROP DATABASE IF EXISTS test_100;
CREATE DATABASE test_100;
USE test_100;
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1, 2), (2, 3);
ALTER TABLE t1 ADD COLUMN site_code VARCHAR(64) NOT NULL DEFAULT '100';
INSERT INTO t1 VALUES (12, 13, '100');
ALTER TABLE t1 MODIFY COLUMN site_code VARCHAR(64) NOT NULL DEFAULT '';
ALTER TABLE t1 ADD PRIMARY KEY (a, site_code);
DROP DATABASE IF EXISTS test_200;
CREATE DATABASE test_200;
USE test_200;
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1, 2), (2, 3);
ALTER TABLE t1 ADD COLUMN site_code VARCHAR(64) NOT NULL DEFAULT '200';
INSERT INTO t1 VALUES (12, 13, '200');
ALTER TABLE t1 MODIFY COLUMN site_code VARCHAR(64) NOT NULL DEFAULT '';
ALTER TABLE t1 ADD PRIMARY KEY (a, site_code);
- execute these sqls in downstream cluster
DROP DATABASE IF EXISTS test_100;
CREATE DATABASE test_100;
USE test_100;
CREATE TABLE t1 (a INT, b INT, site_code VARCHAR(64) NOT NULL DEFAULT '', PRIMARY KEY (a, site_code));
INSERT INTO t1 VALUES (1, 2, '100'), (2, 3, '100'), (12, 13, '100');
DROP DATABASE IF EXISTS test_200;
CREATE DATABASE test_200;
USE test_200;
CREATE TABLE t1 (a INT, b INT, site_code VARCHAR(64) NOT NULL DEFAULT '', PRIMARY KEY (a, site_code));
INSERT INTO t1 VALUES (1, 2, '200'), (2, 3, '200'), (12, 13, '200');
-
create a changefeed
-
execute these sqls in upstrem cluster
USE test_100;
INSERT INTO t1 (a, b) VALUES (20, 21);
UPDATE t1 SET b = b + 10 WHERE a = 1 AND site_code = '100';
DELETE FROM t1 WHERE a = 2 AND site_code = '100';
UPDATE t1 SET b = b + 1 WHERE a = 12 AND site_code = '100';
USE test_200;
INSERT INTO t1 (a, b) VALUES (20, 21);
UPDATE t1 SET b = b + 10 WHERE a = 1 AND site_code = '200';
DELETE FROM t1 WHERE a = 2 AND site_code = '200';
UPDATE t1 SET b = b + 1 WHERE a = 12 AND site_code = '200';
then you may found data inconsistency in upstream and downstream clusters
create a changefeed
execute these sqls in upstrem cluster
then you may found data inconsistency in upstream and downstream clusters