The Tungsten Replicator is an extraordinarily powerful and flexible tool capable of moving vast volumes of data from source to target.
In this blog post we will discuss one specific aspect of the THL (Transaction History Log) - the
METADATA unsafe_for_block_commit flag.
What do you mean, Unsafe?
In a recent customer support case, we were asked the meaning of the
unsafe_for_block_commit flag. For example, list the event information for sequence number 3481394254:
[tungsten@tr2-mysql01 (sandbox) ~]$ thl list -seqno 3481394254 | more SEQ# = 3481394254 / FRAG# = 0 (last frag) - TIME = 2018-09-16 06:52:47.0 - EPOCH# = 3480364140 - EVENTID = mysql-bin.001068:0000000294739578;622252 - SOURCEID = tr2-mysql01.sandbox.yourdomain.com - METADATA = [mysql_server_id=1;unsafe_for_block_commit;dbms_type=mysql;tz_aware=true;service=brm;shard=shard_1736] - TYPE = com.continuent.tungsten.replicator.event.ReplDBMSEvent - OPTIONS = [##charset = UTF-8, autocommit = 1, sql_auto_is_null = 0, foreign_key_checks = 0, unique_checks = 0, auto_increment_increment = 5, auto_increment_offset = 1, sql_mode = 'NO_AUTO_VALUE_ON_ZERO', character_set_client = 33, collation_connection = 33, collation_server = 33] - SCHEMA = shard_1736 - SQL(0) = /*!40000 ALTER TABLE `cust_info` ENABLE KEYS */
In the above example, an
ALTER TABLE is executed. In the output, there is a
METADATA line, i.e.:
- METADATA = [mysql_server_id=1;unsafe_for_block_commit;dbms_type=mysql;tz_aware=true;service=brm;shard=shard_1736]
What is the Secret?
If the MySQL binary log entry is marked as a
DROP or is an unrecognized operation, the event is marked as "unsafe for block commit" in the corresponding THL entry.
OK, But Why?
This flag is set to prevent a downstream replicator from performing an operation as part of a block (i.e. group of transactions) commit operation. These operations need to be done in isolation because you can't add date to a
DROP'ed table before the modification has taken place.
unsafe_for_block_commit flag has been present since version 2.x
For more details about using the standalone Tungsten Replicator, please visit the docs page at https://docs.continuent.com/tungsten-replicator-6.0/index.html
We will continue to cover topics of interest in our next "Mastering Tungsten Replicator Series" post...stay tuned!
Click here for more online information about Continuent solutions...
Want to learn more or run a POC? Contact us.
Add new comment