Skip to content
/ server Public

MDEV-15327 Reset Master_Server_Id to 0 on CHANGE MASTER#4666

Open
varundeepsaini wants to merge 1 commit intoMariaDB:mainfrom
varundeepsaini:MDEV-15327-master-server-id-fix
Open

MDEV-15327 Reset Master_Server_Id to 0 on CHANGE MASTER#4666
varundeepsaini wants to merge 1 commit intoMariaDB:mainfrom
varundeepsaini:MDEV-15327-master-server-id-fix

Conversation

@varundeepsaini
Copy link
Contributor

  • The Jira issue number for this PR is: MDEV-15327

Description

Reset Master_Server_Id to 0 on CHANGE MASTER TO and RESET SLAVE. Previously the stale value from the previous master persisted in SHOW SLAVE STATUS until the slave reconnected.

Release Notes

CHANGE MASTER TO and RESET SLAVE now reset Master_Server_Id to 0, so SHOW SLAVE STATUS no longer reports a stale server ID from the previous master.

How can this PR be tested?

./mysql-test/mtr --suite=rpl rpl_change_master_server_id

Basing the PR against the correct MariaDB version

  • [] This is a new feature and the PR is based against the main branch.
  • This is a bug fix.

PR quality check

  • I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

@varundeepsaini varundeepsaini force-pushed the MDEV-15327-master-server-id-fix branch from 32a74f7 to 9c49da8 Compare February 18, 2026 18:29
@gkodinov gkodinov added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Feb 19, 2026
Copy link
Member

@gkodinov gkodinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution!
This is a preliminary review.

Please merge your changes into a single commit and have a commit message in it that follow CODING_STANDARDS.md.

I also have some cleanup suggestions below.

@varundeepsaini varundeepsaini force-pushed the MDEV-15327-master-server-id-fix branch from 9c49da8 to d88902b Compare February 19, 2026 12:13
Copy link
Member

@gkodinov gkodinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Looks much better now. Please wait for the final review.

Master_Server_Id was not cleared after CHANGE MASTER or RESET SLAVE,
showing a stale value until the slave reconnected. Reset master_id
and prev_master_id to 0 in both code paths.
@varundeepsaini varundeepsaini force-pushed the MDEV-15327-master-server-id-fix branch from d88902b to 3b70619 Compare February 19, 2026 14:42
Copy link
Contributor

@andrelkin andrelkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Howdy Varun!

The patch is quite good and must be safe to my checking.
I have a couple of notes to the test part.

Also in the commit message please explain more after

Reset master_id...

that

the reset value will be present in Show-Slave-Status until it is re-evaluated to
the id of a new connected master server.

Cheers!

Andrei


--replace_result $SERVER_MYPORT_1 MYPORT_1 $read_master_log_pos <read_master_log_pos> $relay_log_pos <relay_log_pos> $relay_log_space <relay_log_space>
show slave 'master1' status;
--query_vertical show slave 'master1' status
Copy link
Contributor

@andrelkin andrelkin Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this block is driven by the fixes introduce it with #-comment:s
explaining what to expect from Master_Server_id:s.

Copy link
Contributor

@andrelkin andrelkin Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can comfortably settle the following tests at the end of an existing suite/rpl/t/rpl_change_master.test.
With one less test file naturally that optimizes mtr runs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements.

Development

Successfully merging this pull request may close these issues.

3 participants

Comments