Mastering Tungsten Replicator Series: Tasty THL Tips - unsafe_for_block_commit

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
- 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 CREATE, ALTER, 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 CREATE and ALTER or DROP'ed table before the modification has taken place.

The 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

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.

About the Author

Eric M. Stone

Eric is a veteran of fast-paced, large-scale enterprise environments with 35 years of Information Technology experience. With a focus on HA/DR, from building data centers and trading floors to world-wide deployments, Eric has architected, coded, deployed and administered systems for a wide variety of disparate customers, from Fortune 500 financial institutions to SMB’s.

Add new comment