MXS-2785: Update binlogfilter documentation
Updated the documentation with the regex changes and listed some of the caveats of rewriting SQL with regular expressions.
This commit is contained in:
@ -37,32 +37,27 @@ in the statements. If any of the tables matches the *match* pattern, the event
|
|||||||
is replicated. If any of the tables matches the *exclude* pattern, the event is
|
is replicated. If any of the tables matches the *exclude* pattern, the event is
|
||||||
not replicated.
|
not replicated.
|
||||||
|
|
||||||
### `rewrite_src`
|
### `rewrite_src` and `rewrite_dest`
|
||||||
|
|
||||||
The old database name to a rewritten statement. When database name rewriting is
|
These two parameters control the statement rewriting of the binlogfilter. The
|
||||||
enabled, all occurrences of the old database name (`rewrite_src`) are replaced
|
`rewrite_src` parameter is a PCRE2 regular expression that is matched against
|
||||||
with the new replacement database name (`rewrite_dest`). Both `rewrite_src` and
|
the default database and the SQL of statement based replication events (query
|
||||||
`rewrite_dest` must be defined if database rewriting is to be enabled.
|
events). `rewrite_dest` is the replacement string which supports the normal
|
||||||
|
PCRE2 backreferences (e.g the first capture group is `$1`, the second is `$2`,
|
||||||
|
etc.).
|
||||||
|
|
||||||
The name replacement is done with simple string replacement. This means that the
|
Both `rewrite_src` and `rewrite_dest` must be defined to enable statement rewriting.
|
||||||
database name (`rewrite_src`) **must not** appear as a table name, a field name
|
|
||||||
or any other identifier, as a part of a constant value and must not conflict
|
|
||||||
with SQL keywords. If the name does appear as a non-database identifier,
|
|
||||||
replication will either break or behave in an undefined manner.
|
|
||||||
|
|
||||||
We highly recommend using
|
When statement rewriting is enabled
|
||||||
[GTID-based replication](https://mariadb.com/kb/en/library/gtid/#setting-up-a-new-slave-server-with-global-transaction-id)
|
[GTID-based replication](https://mariadb.com/kb/en/library/gtid/#setting-up-a-new-slave-server-with-global-transaction-id)
|
||||||
when using statement rewriting. If `rewrite_dest` is longer than `rewrite_src`,
|
must be used. The filter will disallow replication for all slaves that attempt
|
||||||
the replication must use GTID coordinates. Otherwise, the replication can break
|
to replicate with traditional file-and-position based replication.
|
||||||
down when a slave server is disconnected. The filter will disallow replication
|
|
||||||
for all slaves that attempt to replicate with traditional file-and-position
|
|
||||||
based replication when the new database name is longer than the old name.
|
|
||||||
|
|
||||||
### `rewrite_dest`
|
The replacement is done both on the default database as well as the SQL
|
||||||
|
statement in the query event. This means that great care must be taken when
|
||||||
The new database name of a rewritten statement. Both `rewrite_src` and
|
defining the rewriting rules. To prevent accidental modification of the SQL into
|
||||||
`rewrite_dest` must be defined if database rewriting is to be enabled. See
|
a form that is no longer valid, use database and table names that never occur in
|
||||||
[`rewrite_src`](#rewrite_src) for details on how this feature works.
|
the inserted data and is never used as a constant value.
|
||||||
|
|
||||||
## Example Configuration
|
## Example Configuration
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user