WL#2860: INFORMATION_SCHEMA table for SHOW SLAVE HOSTSAffects: Server-9.x — Status: On-Hold — Priority: MediumSUMMARY
-------
Master should store information about slaves which have been connected
in a table instead of memory.
REQUIREMENTS
------------
- (Elliot) The merlin folks definitely want to see slaves which are
not currently connected. Since Merlin monitors health, it is valuable
for it to connect to a master, and then draw some picture with a big
alert showing the slaves that were not able to be contacted
DECISIONS REGARDING THIS WL
---------------------------
- Elliot 9 Nov 2005:
In the September 2005 Chicago dev-mtx planning meeting, during a
Merlin discussion, it was decided that we should change SHOW SLAVE
HOSTS to store information about slaves which have been connected in a
table instead of memory. This should be done in 5.1, and is needed
for Merlin advisors.
- Lars 21 Feb 2006:
According to Scrum meeting this should be in 5.2.
OPEN ISSUES
-----------
- How to purge table?
- What format of table?
- How to update table?
DRAFT (TO BE DISCUSSED)
----------------------
1. What should be done
MySQL is extended with a new INFORMATION_SCHEMA.SLAVEHOSTS table.
The table has the same columns as displayed by SHOW SLAVE HOSTS
statement plus an additional column CONNECTED which defines whether
the connection to the slave is OK.
Column name Description
----------- -----------
MASTER_ID integer
SERVER_ID integer
HOST varchar
PORT integer
USER varchar
PASSWORD varchar
RPL_RECOVERY_RANK integer
CONNECTED bool
REMARK.
SLAVEHOSTS and SHOW SLAVE HOSTS display slaves which are "registered"
within the master. Currently, registration of a slave occurs each time
the slave connects to the master. A slave can become unregistered only
on master restart. Because of that SLAVE HOSTS generally does not display
the overall "replication topology" (as defined by which master and
slaves are installed and how they are configured). E.g.,
- Suppose the following occurs: slave Si shutdowns, master M shutdowns,
master M restarts. In this case, Si will not be displayed by
SLAVE HOSTS until Si restart.
- Suppose Si is uninstalled. In this case Si will stay visible by
SLAVE HOSTS until master M shutdown.
Note also, that it is not quite obvious how to add a direct slave
unregistering (consider the case when slave wants to unregister itself
but cannot connect to master).
REMARK
When connections are to be checked?
One alternative is to check connections during SLAVEHOSTS table
filling (like other INFORMATION_SCHEMA tables, SLAVEHOSTS is filled
when a reference to this table is encountered in a query). But this
can make the table filling too slow (checking is based on waiting
for response from slave).
Other alternative is to check periodically the connections to all
registered slaves in a separate thread and to use the result of the
last check in the SLAVEHOST.
Yet one more alternative is to use the result of each attempt of the
master to connect to a slave (e.g. when sending an event).
2. Merlin's case
The overall "replication topology" is to be described by an ordinary
table, say 'repology', created within master server. It defines which
slaves are configured to this master. Something like this:
CREATE TABLE repology (name VARCHAR, server_id INT);
The table is managed by an administrator who adds/deletes entries
according to changes in the topology):
INSERT INTO repology ('slave01', 101);
INSERT INTO repology ('slave02', 102);
INSERT INTO repology ('slave03', 103);
...
DELETE FROM repology WHERE name='slave12';
...
To get the current state of slaves some kind of outer join can be used,
e.g.
SELECT * FROM repology AS t1
LEFT JOIN INFORMATION_SCHEMA.SLAVEHOSTS AS t2
ON (t1.server_id=t2.server_id);
+---------+-----------+-----------+-----+-----------+
| name | server_id | SERVER_ID | ... | CONNECTED |
+---------+-----------+-----------+-----+-----------+
| slave01 | 101 | 101 | ... | 1 | - connected
| slave02 | 102 | 102 | ... | 0 | - registered, not
connected
| slave03 | 103 | NULL | ... | NULL | - not registered
| ... | ... | ... | ... | ... |
+---------+-----------+-----------+-----+-----------+
REMARK.
Using right join instead of the left one above will show the slaves
which are registered to the master but are not included into the repology:
SELECT * FROM repology AS t1
RIGHT JOIN INFORMATION_SCHEMA.SLAVEHOSTS AS t2
ON (t1.server_id=t2.server_id);
+---------+-----------+-----------+-----+
| name | server_id | SERVER_ID | ... |
+---------+-----------+-----------+-----+
| slave01 | 101 | 101 | ... |
| slave02 | 102 | 102 | ... |
| ... | ... | ... | ... |
| NULL | NULL | 200 | ... | - not included in repology
| ... | ... | ... | ... |
+---------+-----------+-----------+-----+
SEMANTICS OF SHOW SLAVE HOSTS No Comments yet |
VotesWatches0 members are watching this worklog
You must be logged in to track this worklog.
Provide Feedback
You must be logged in to comment
|