Type:
Technical task
Priority:
Minor
Resolution:
Won't Fix
Affects Version/s:
None
Fix Version/s:
None
Component/s:
None
Currently multisource replication setup is possible even if masters have the same server_id: the slave doesn't complain either on configuration or on replication start. As a result, there might be problems with further replication, e.g. if we want to setup master1,master2 => slave => master2 configuration: updates from master1 won't be replicated on master2, because they will have the same server_id in the slave binary log.
The safer way would be not to allow to configure or start replication from several masters with the same server-id.
The test below shows it. It's not ready to be put into the test suite as is, because if the problem is fixed, the second slave startup won't happen, and the remaining part of the test will be redundant; that's why the test doesn't have a "cleanup" part. However, it can be used as a stub of the future test. Please note that the test requires its own cnf file (also provided here).
cat suite/multi_source/same_server_id.cnf
# cat t/multisource1.cnf
!include include/default_mysqld.cnf
!include include/default_client.cnf
[mysqld.1]
server-id=1
log-bin=master-bin
[mysqld.2]
server-id=1
log-bin=master-bin
[mysqld.3]
server-id=3
log-slave-updates
log-bin=master-bin
[ENV]
SERVER_MYPORT_1= @mysqld.1.port
SERVER_MYSOCK_1= @mysqld.1.socket
SERVER_MYPORT_2= @mysqld.2.port
SERVER_MYSOCK_2= @mysqld.2.socket
SERVER_MYPORT_3= @mysqld.3.port
SERVER_MYSOCK_3= @mysqld.3.socket
cat suite/multi_source/same_server_id.test
# In the cnf file for this test, mysqld.1 and mysqld.2 have
# the same server-id=1, and mysqld.3 has server-id=3
--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
# Start replication from the first master
--replace_result $SERVER_MYPORT_1 MYPORT_1
eval change master 'master1' to
master_port=$SERVER_MYPORT_1,
master_host='127.0.0.1',
master_user='root';
start slave 'master1';
set default_master_connection = 'master1';
--source include/wait_for_slave_to_start.inc
# Start replication from the second master
--replace_result $SERVER_MYPORT_2 MYPORT_2
eval change master 'master2' to
master_port=$SERVER_MYPORT_2,
master_host='127.0.0.1',
master_user='root';
start slave 'master2';
set default_master_connection = 'master2';
--source include/wait_for_slave_to_start.inc
set default_master_connection = '';
--connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1)
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (i int) engine=MyISAM;
--save_master_pos
--connection slave
--sync_with_master 0,'master1'
--connect (master2,127.0.0.1,root,,,$SERVER_MYPORT_2)
--disable_warnings
drop table if exists t2;
--enable_warnings
create table t2 (j int) engine=MyISAM;
--save_master_pos
--connection slave
--sync_with_master 0,'master2'
--echo
--echo # See that all entries are written with the same
--echo # server_id = 1
show binlog events;
--save_master_pos
# Now set up replication from the slave to the second master
# (the 'circular' part)
--connection master2
--replace_result $SERVER_MYPORT_3 MYPORT_3
eval change master to
master_port=$SERVER_MYPORT_3,
master_host='127.0.0.1',
master_user='root';
start slave;
--sync_with_master 0
--echo
--echo # See that t1 was not replicated
--echo # (because the entry had the same server_id)
show tables;
Transition
Time In Source Status
Execution Times
Open
Closed
6d 4h 1m
1
{"report":{"fcp":795.8000000119209,"ttfb":192.4000000357628,"pageVisibility":"visible","entityId":19628,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"8b326e7b-1ccb-40cd-985e-b7d5e514d948","navigationType":0,"readyForUser":872.4000000357628,"redirectCount":0,"resourceLoadedEnd":501.30000001192093,"resourceLoadedStart":199.5,"resourceTiming":[{"duration":23.400000035762787,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":199.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":199.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":222.9000000357628,"responseStart":0,"secureConnectionStart":0},{"duration":23.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":199.80000001192093,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":199.80000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":223.30000001192093,"responseStart":0,"secureConnectionStart":0},{"duration":176.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":200,"connectEnd":200,"connectStart":200,"domainLookupEnd":200,"domainLookupStart":200,"fetchStart":200,"redirectEnd":0,"redirectStart":0,"requestStart":225.19999998807907,"responseEnd":376.60000002384186,"responseStart":236.5,"secureConnectionStart":200},{"duration":301.19999998807907,"initiatorType":"script","name":"https://jira.mariadb.org/s/c32eb0da7ad9831253f8397e6cc26afd-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":200.10000002384186,"connectEnd":200.10000002384186,"connectStart":200.10000002384186,"domainLookupEnd":200.10000002384186,"domainLookupStart":200.10000002384186,"fetchStart":200.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":228.80000001192093,"responseEnd":501.30000001192093,"responseStart":244.5,"secureConnectionStart":200.10000002384186},{"duration":50,"initiatorType":"script","name":"https://jira.mariadb.org/s/bc0bcb146314416123c992714ee00ff7-CDN/lu2bv2/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":200.30000001192093,"connectEnd":200.30000001192093,"connectStart":200.30000001192093,"domainLookupEnd":200.30000001192093,"domainLookupStart":200.30000001192093,"fetchStart":200.30000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":229.19999998807907,"responseEnd":250.30000001192093,"responseStart":246.60000002384186,"secureConnectionStart":200.30000001192093},{"duration":50.40000003576279,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":200.5,"connectEnd":200.5,"connectStart":200.5,"domainLookupEnd":200.5,"domainLookupStart":200.5,"fetchStart":200.5,"redirectEnd":0,"redirectStart":0,"requestStart":231.19999998807907,"responseEnd":250.9000000357628,"responseStart":247.69999998807907,"secureConnectionStart":200.5},{"duration":54.19999998807907,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":200.60000002384186,"connectEnd":200.60000002384186,"connectStart":200.60000002384186,"domainLookupEnd":200.60000002384186,"domainLookupStart":200.60000002384186,"fetchStart":200.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":232.60000002384186,"responseEnd":254.80000001192093,"responseStart":251.69999998807907,"secureConnectionStart":200.60000002384186},{"duration":27.899999976158142,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bv2/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":200.80000001192093,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":200.80000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":228.69999998807907,"responseStart":0,"secureConnectionStart":0},{"duration":54.19999998807907,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":201,"connectEnd":201,"connectStart":201,"domainLookupEnd":201,"domainLookupStart":201,"fetchStart":201,"redirectEnd":0,"redirectStart":0,"requestStart":232.80000001192093,"responseEnd":255.19999998807907,"responseStart":252.10000002384186,"secureConnectionStart":201},{"duration":29.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bv2/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":201.19999998807907,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":201.19999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":230.69999998807907,"responseStart":0,"secureConnectionStart":0},{"duration":55.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/719848dd97ebe0663199f49a3936487a-CDN/lu2bv2/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":201.19999998807907,"connectEnd":201.19999998807907,"connectStart":201.19999998807907,"domainLookupEnd":201.19999998807907,"domainLookupStart":201.19999998807907,"fetchStart":201.19999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":233.10000002384186,"responseEnd":256.80000001192093,"responseStart":252.69999998807907,"secureConnectionStart":201.19999998807907},{"duration":271.10000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":208,"connectEnd":208,"connectStart":208,"domainLookupEnd":208,"domainLookupStart":208,"fetchStart":208,"redirectEnd":0,"redirectStart":0,"requestStart":264.4000000357628,"responseEnd":479.10000002384186,"responseStart":472,"secureConnectionStart":208},{"duration":272.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":208,"connectEnd":208,"connectStart":208,"domainLookupEnd":208,"domainLookupStart":208,"fetchStart":208,"redirectEnd":0,"redirectStart":0,"requestStart":277.80000001192093,"responseEnd":480.5,"responseStart":475.10000002384186,"secureConnectionStart":208},{"duration":65.59999996423721,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":519.6000000238419,"connectEnd":519.6000000238419,"connectStart":519.6000000238419,"domainLookupEnd":519.6000000238419,"domainLookupStart":519.6000000238419,"fetchStart":519.6000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":547.8000000119209,"responseEnd":585.1999999880791,"responseStart":584.5,"secureConnectionStart":519.6000000238419}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":23,"responseStart":192,"responseEnd":207,"domLoading":196,"domInteractive":942,"domContentLoadedEventStart":942,"domContentLoadedEventEnd":984,"domComplete":1701,"loadEventStart":1701,"loadEventEnd":1702,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":925},{"name":"bigPipe.sidebar-id.end","time":925.8000000119209},{"name":"bigPipe.activity-panel-pipe-id.start","time":926},{"name":"bigPipe.activity-panel-pipe-id.end","time":926.9000000357628},{"name":"activityTabFullyLoaded","time":997.1999999880791}],"measures":[],"correlationId":"231335da11882","effectiveType":"4g","downlink":9.8,"rtt":0,"serverDuration":92,"dbReadsTimeInMs":12,"dbConnsTimeInMs":20,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}