Advanced MySQL Replication Techniques
Subject:   wrong master_log_pos, master_log_name
Date:   2006-05-03 10:21:24
From:   MarkSwanson
I know the code is for example purposes, but hard coding these values will not work. The manual seems to imply that if no values (master_log_pos, master_log-name) are used the slave will use the same coordinates it was using with the old master. The manual further states this will ensure no discontinuity in replication.

I wasn't able to find anything in the documentation that stated that the log filenames and their contents were byte-for-byte in sync between machines. The log filenames are definately different on my master compared to my slave.

So does an existing slave - when changed to a master - rename its log files and adjust the log file contents so that when a slave connects with previous file/offset coordinates everything will work?

I somehow don't think it works this way, but can't find the documentation on how it does work. Please post if you know.


Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • Giuseppe Maxia photo wrong master_log_pos, master_log_name
    2006-05-03 11:16:01  Giuseppe Maxia | O'Reilly Blogger [View]

    Hi, thanks for your comments.

    Please have a look at the code in the Replication Playground, ( where there is a working sample (not perfect, but it should work in many cases).

    As I said in the article, there are some bits that still prevent an all-SQL solution, namely the lack of slave related data from the information schema, without which it is impossible to set the slave to the current log file and position in the master.
    However, with the technology at hand today, it is possible to ask the would be master to do a RESET MASTER (see the example in the replication playground).
    According to my sources, this limitation should go away before MySQL 5.1 is released as generally available (I was promised a fix to the information schema by June). Thus, the techniques shown in this articles should be available for general consumption in a more reliable form.

    I will post something in my blog as soon as this solution becomes available.