Wednesday, February 4, 2026

Rebuilding a Duplicate with MyDumper


When a reproduction fails because of corruption or drift, the usual resolution is to rebuild it from a recent copy of the grasp when pt-table-sync is just not an choice. Historically, when we have to construct a brand new duplicate, we use a bodily backup for velocity, however there are some instances the place you continue to want logical backups. As an example, if you migrate to a particular vendor (i.e.: MariaDB to MySQL) or storage engines (previously MyISAM to InnoDB and these days from InnoDB to RocksDB), improve to a brand new database model or transfer to a cloud based mostly resolution. That is the place a logical backup shines, providing portability and ease, however provided that it may be carried out rapidly. MyDumper emerges because the important, trendy resolution, delivering the most effective of each worlds: the cross-platform, cross-version flexibility of a logical dump mixed with the parallel, multi-threaded velocity beforehand reserved for bodily strategies, making it the clear alternative for quickly rebuilding a constant duplicate.

Step one is to take the backup. We’ve a number of arguments which we are able to use with mydumper, for this instance we’re going to use:

The primary 3 are associated to logging and backup dir, the second line is for ignoring mysql and sys schemas and at last –source-data will instruct mydumper to save lots of within the metadata file, all the information required for the replication configuration after the restore underneath the part [source].
That is an instance of the output:

As we are able to see, this choices are enabled:

Nonetheless, the execution of the instructions are disabled:

Which is required to routinely configure the replication.

By default, the SOURCE_LOG_FILE and SOURCE_LOG_POS will probably be used, however you’ll be able to set the GTID place should you configure SOURCE_AUTO_POSITION = 1.
As you would possibly know, to arrange replication we have to execute CHANGE SOURCE. Nonetheless, relying in your use case, you would possibly must RESET REPLICA and after executing the CHANGE SOURCE you often execute START REPLICA. This may be performed by myloader routinely should you set it up within the metadata file utilizing:

Or you should utilize –source-data=7 as a parameter in myloader. Sure! myloader additionally accepts –source-data.
Relying your use case, you would possibly must configure within the metadata file, this different choices:

As there are a number of use instances:
If you’d like wish to rebuild the duplicate from scratch then you will have to configure like this:

You have already got a replication up and operating and also you wish to rebuild it with out altering the host or credentials, then you’ll be able to configure simply on this means:

SSL is another choice that’s doable to arrange in –source-data on myloader, as an alternative of utilizing SOURCE_SSL on the metadata file. The total record of choices are: exec_start_slave (1), exec_change_master (2), exec_reset_slave (4), SSL (8), auto_position (16) and exec_start_replica_until (32). Relying on the configuration that you just wish to arrange and the statements that you just wish to execute, you will have to sum the values and cross it to –source-data.

After configure the metadata file, you’ll be able to execute the myloader, which is able to appear like:

Within the log, you will see that myloader has ship the instructions:

mydumper is sending the command however is just not checking the output which signifies that if the replication did not configure or it was not capable of begin, you will have to manually verify it and repair it. Nonetheless, it should detect if the command failed, for instance if SUORCE_USER is used as an alternative of SOURCE_USER:

There’s an fascinating use case the place we are able to use START REPLICA UNTIL to repair drift on some tables the place pt-table-sync or rebuilding the entire duplicate will not be doable.
Let’s say now we have a supply and a reproduction, and we discovered that information has drifted on the duplicate and the replication course of has stopped with an error like this:

We checked the binary log and it’s failing due updates over a set of rows:

We verify the database and it’s true, the info has drifted:
Supply:

Duplicate:

With MyDumper we are able to rebuild the desk following this process:
We have to ignore the desk to permit the duplicate to catchup

As soon as that the duplicate is updated we have to cease the duplicate:

and take the backup on the Supply server:

We’re utilizing -T to take the backup of the problematic desk and –source-data will allow the replication variables that we want on the metadata file.
Then, we restore the desk with the proper worth on –source-data

The 32 is to execute the START REPLICA UNTIL.
Lastly, we take away the ignore desk choice and begin the duplicate once more:

The START REPLICA UNTIL executed initially of backup by myloader will drive the duplicate to cease on the level the place we took the backup of the desk, permitting us to proceed the replication in a constant situation.

The shift from legacy dumping strategies to MyDumper represents greater than only a efficiency increase; it represents a modernized method to information integrity and mobility. By decoupling the backup course of from the constraints of single-threaded execution, DBAs can now deal with large datasets with the identical agility they as soon as reserved for small check environments.

Incorporating MyDumper into your customary operational playbook ensures you are ready for the unpredictable—whether or not it’s an emergency duplicate rebuild or a deliberate architectural migration. In an period the place information volumes proceed to scale exponentially, having a software that balances logical flexibility with parallelized velocity, MyDumper turns into a necessity. Preserve it in your toolkit, and the following time you face a “logical-only” restoration situation, you’ll be doing so with a major aggressive benefit.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles