pt-heartbeat should detect master-server-id
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Opinion
|
Undecided
|
Unassigned |
Bug Description
The documentation says:
"examines the replicated heartbeat record from its immediate master or the specified --master-
Thus, this leaves one to believe, that in the case of simple Master->Slave replication, pt-heartbeat should grab the server_id from SHOW SLAVE STATUS.
Only if there is doubt, like Master_Server_Id NOT FOUND from SELECT * FROM heartbeat WHERE server_id = XX should the script abort with the error about not being able to determine masters id.
Yes, there is an existing wishlist, #1097997 for this, however, this seems to be more of a bug as the app doesn't behave like the documentation suggests.
In any case, pt-heartbeat --monitor/--check should FIRST get the Master ID from slave status. Then, query the heartbeat table. If multiple serverids are found, fail and ask user to specify. If serverid not found, fail and ask. If found, and 1 row continue as normal.
The idea here is to make pt-heartbeat easier to use, not harder/more complicated.
Unable to reproduce the same. After I ran pt-heartbeat on slave, I would able to see server-id in heartbeat table.
Here, 1 is master server-id and 101 is slave server-id.
nilnandan@ Dell-XPS: ~$ pt-heartbeat -D test --check h=localhost, u=root, p=msandbox, S=/tmp/ mysql_sandbox20 083.sock Dell-XPS: ~$ ------- ------- -+----- ------+ ------+ ------- ---+--- ------- ------- ------+ ------- ------- ------- + log_file | exec_master_log_pos | ------- ------- -+----- ------+ ------+ ------- ---+--- ------- ------- ------+ ------- ------- ------- + ------- ------- -+----- ------+ ------+ ------- ---+--- ------- ------- ------+ ------- ------- ------- +
105.00
nilnandan@
mysql> select * from heartbeat;
+------
| ts | server_id | file | position | relay_master_
+------
| 2014-09-15 13:06:26 | 1 | NULL | NULL | NULL | NULL |
| 2014-09-15 13:06:26 | 101 | NULL | NULL | NULL | NULL |
+------
2 rows in set (0.01 sec)
Can you please explain what exactly you want us to check? testcase with steps will be helpful.