8.19.1. thl Position Commands

The thl command supports a number of position and selection command-line options that can be used to select an individual THL event, or a range of events, to be displayed.

  • -seqno #

    Valid for: thl list

    Output the THL sequence for the specific sequence number. When reviewing or searching for a specific sequence number, for example when the application of a sequence on a Replica has failed, the replication data for that sequence number can be individually viewed. For example:

    From version 5.3.3, the output also includes the filename of the THL file on disk where the THL event is located:

    shell> thl list -seqno 15
    SEQ# = 15 / FRAG# = 0 (last frag)
    - FILE = thl.data.0000000001 
    - TIME = 2013-05-02 11:37:00.0
    - EPOCH# = 7
    - EVENTID = mysql-bin.000004:0000000000003345;0
    - SOURCEID = host1
    - METADATA = [mysql_server_id=1687011;unsafe_for_block_commit;dbms_type=mysql;»
        service=firstrep;shard=cheffy]
    - 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, sql_mode = 'NO_AUTO_VALUE_ON_ZERO', character_set_client = 33, »
        collation_connection = 33, collation_server = 8]
    - SCHEMA = cheffy
    - SQL(0) = CREATE TABLE `access_log` (
      `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `userid` int(10) unsigned DEFAULT NULL,
      `datetime` int(10) unsigned NOT NULL DEFAULT '0',
    ...

    If the sequence number selected contains multiple fragments, each fragment will be output. Depending on the content of the sequence number information, the information can be output containing only the header/metadata information or only the table data (row or SQL) that was contained within the fragment. See -headers and -sql for more information.

    Note

    Unsigned integers are displayed and stored in the THL as their negative equivalents, and translated to the correct unsigned type when the data is applied to the target database.

  • -low # and/or -high #

    -from # and/or -to #

    Valid for: thl list, thl purge

    Specify the start (-from) or end (-to) of the range of sequence numbers to be output. If only -from is specified, then all sequence numbers from that number to the end of the THL are output. If -to is specified, all sequence numbers from the start of the available log file to the specified sequence number are output. If both numbers are specified, output all the sequence numbers within the specified range.

    For example:

    shell> thl list -from 320

    Or:

    shell> thl list -low 320

    Will output all the sequence number fragments from number 320.

    shell> thl list -to 540

    Or:

    shell> thl list -high 540

    Will output all the sequence number fragments up to and including 540.

    shell> thl list -from 320 -to 540

    Or:

    shell> thl list -low 320 -high 540

    Will output all the sequence number fragments from number 320 up to, and including, sequence number 540.

  • -first

    Valid for: thl list, thl purge

    The -first selects only the first stored THL event. For example:

    shell> thl list -first
    SEQ# = 0 / FRAG# = 0 (last frag)
    - TIME = 2017-06-28 13:12:38.0
    - EPOCH# = 0
    ...
  • -first #

    Valid for: thl list, thl purge

    The -first # selects the specified number of events, starting from the first event. For example:

    shell> thl list -first 5

    Would display the first five events from the stored THL.

  • -last

    Valid for: thl list, thl purge

    The -last selects only the last stored THL event. For example:

    shell> thl list -last
    SEQ# = 1601 / FRAG# = 0 (last frag)
    - TIME = 2017-06-29 06:02:23.0
    - EPOCH# = 1601
    ...

    The use of this option can be particularly useful in the event of synchronisation or THL corruption due to a lack of diskspace. Using the thl purge command, the last THL event can be easily removed without having to work out the ranges and index information:

    shell> thl purge -last
  • -last #

    Valid for: thl list, thl purge

    The -last # selects the specified number of events, starting from the last-# event. For example:

    shell> thl list -last 5

    When the THL index contains events from 1558-1601, would display events 1597 through to 1601.