1Z0-888 · Question #20
An existing master-slave setup is currently using a delayed replication of one hour. The master has crashed and the slave must be "rolled forward" to provide all the latest data. The SHOW SLAVE…
The correct answer is C. STOP SLAVE; CHANGE MASTER TO MASTER_DELAY=0; START SLAVE. Option C works because when using delayed replication, the slave has already received all relay log events from the master - it just hasn't applied them yet due to the artificial delay. Setting MASTER_DELAY=0 via CHANGE MASTER TO removes that delay, and START SLAVE allows the…
Question
- RELAY_LOG_FILE=hostname-relay-bin.00004
- RELAY_LOG_POS=1383 Which command set would make the slave current?
Options
- ASTOP SLAVE; SET GLOBAL master_delay=0; START SLAVE;
- BSTOP SLAVE; CHANGE MASTER TO RELAY_LOG_FILE = 'hostname-relay-bin.00004', RELAY_LOG_POS = 1383;
- CSTOP SLAVE; CHANGE MASTER TO MASTER_DELAY=0; START SLAVE;
- DSTOP SLAVE; CHANGE MASTER TO MASTER_DELAY=0; RELAY_LOG_FILE = 'hostname-relay-bin.00004', RELAY_LOG_POS = 1383;
How the community answered
(16 responses)- A6% (1)
- B6% (1)
- C69% (11)
- D19% (3)
Explanation
Option C works because when using delayed replication, the slave has already received all relay log events from the master - it just hasn't applied them yet due to the artificial delay. Setting MASTER_DELAY=0 via CHANGE MASTER TO removes that delay, and START SLAVE allows the SQL thread to immediately apply all buffered relay log events, rolling the slave forward to current.
Why the distractors fail:
- A is wrong because
SET GLOBAL master_delayis not valid MySQL syntax - the delay is a replication parameter changed only viaCHANGE MASTER TO. - B is wrong on two counts: it omits
START SLAVE, and explicitly re-specifying the current relay log position serves no purpose - it doesn't remove the delay, so the slave would still wait before applying events. - D has a syntax error: the
RELAY_LOG_FILEandRELAY_LOG_POSclauses appear after a semicolon, making them a separate malformed statement. AllCHANGE MASTER TOoptions must appear in a single comma-separated statement.
Memory tip: Think "received ≠ applied" - in delayed replication the relay logs are already there, so you only need to unlock them by zeroing the delay (MASTER_DELAY=0), not reposition anything.
Topics
Community Discussion
No community discussion yet for this question.