All Products
Search
Document Center

PolarDB:CHANGE REPLICATION FILTER

Last Updated:Jun 06, 2024

This topic describes how to execute the CHANGE REPLICATION FILTER statement to modify the filter configurations of primary/secondary replication links.

Syntax

CHANGE REPLICATION FILTER option [, option] ... [ channel_option ]

option: {
    REPLICATE_DO_DB = (do_db_list)
  | REPLICATE_IGNORE_DB = (ignore_db_list)
  | REPLICATE_DO_TABLE = (do_table_list)
  | REPLICATE_IGNORE_TABLE = (ignore_table_list)
  | REPLICATE_WILD_DO_TABLE = (wild_do_table_list)
  | REPLICATE_WILD_IGNORE_TABLE = (wile_ignore_table_list)
  | REPLICATE_SKIP_TSO = 'tso_num'
  | REPLICATE_SKIP_UNTIL_TSO = 'tso_num'
  | REPLICATE_ENABLE_DDL = {TRUE|FALSE}
}

channel_option:
    FOR CHANNEL channel

Usage notes

  • This SQL statement is supported by PolarDB-X V5.4.19 or later.

  • You must use a privileged account of the current instance to execute the CHANGE REPLICATION FILTER statement.

  • If the channel_option parameter is specified, this statement takes effect only on the specified primary/secondary replication link. If the channel_option parameter is not specified, this statement takes effect on all primary/secondary replication links of the current instance.

  • Make sure that the primary/secondary replication link on which the statement is executed is disabled. You can execute the STOP SLAVE statement to disable primary/secondary replication links.

Parameters

  • REPLICATE_SKIP_TSO: the Timestamp Oracle (TSO) at which the binlog event is skipped. For more information about TSO, see Distributed transactions.

  • REPLICATE_SKIP_UNTIL_TSO: the TSO before which all binlog events are skipped.

  • REPLICATE_ENABLE_DDL: specifies whether to synchronize DDL statements. Default value: TRUE.

  • For more information about the following parameters, see CHANGE REPLICATION FILTER.

    • REPLICATE_DO_DB

    • REPLICATE_IGNORE_DB

    • REPLICATE_DO_TABLE

    • REPLICATE_IGNORE_TABLE

    • REPLICATE_WILD_DO_TABLE

    • REPLICATE_WILD_IGNORE_TABLE

Example 1

Execute the following statement to modify replication links to synchronize only the changes in the TEST database:

CHANGE REPLICATION FILTER REPLICATE_DO_DB=(TEST);

Example 2

Obtain TSOs

Execute the SHOW BINLOGS EVENTS statement to obtain the TSOs of binlog events. The following figure shows a sample response.

image

The numeric string that follows CTS:: in the INFO column is the TSO of an event.

Skip the event corresponding to a TSO

Execute the following statement to modify replication links to skip the bin event corresponding to the following TSO: 716669064683978758416977558623632834560000000000000000. In this case, the binlog event whose value in the POS column is 372 is skipped.

CHANGE REPLICATION FILTER REPLICATE_SKIP_TSO='716669064683978758416977558623632834560000000000000000';

For more information, see CHANGE REPLICATION FILTER.