This topic describes how whitelists and blacklists work and how to update them.
Applicable versions
OceanBase Migration Service (OMS) V2.1.2 and later
Working principles of whitelists and blacklists
Whitelists and blacklists provide differentiated configuration capabilities, such as database and table filtering, mapping, and extract, transform, and load (ETL). A blacklist or whitelist is in the following structure:
[{
"name": "db*",
"map": "mdby",
"func": "fn",
"attr": {
"ddl": "mmm",
"hey": "hey"
},
"sub": [{
"name": "mb*",
"map": "tb2222",
"func": "fn",
"sub": [{
"name": "c"
}]
}]
}, {
"name": "db123",
"map": "mdb5",
"all": false,
"attr": {
"ddl": "zzz",
"hey": "hey"
},
"sub": [{
"name": "tb12345"
}]
}]
A blacklist and a whitelist are two JSON arrays with the same semantics. Each element in an array is a JSON object, and each JSON object contains the following attributes:
| Property | Description |
|---|---|
| name | The name of the element at this level. The meaning varies the level. Generally, three levels are used: database, table, and column, with the database name at the uppermost level, the table name at the medium level, and the column names at the bottom level. |
| map | The mapped-to name for this level. If this parameter is not specified, the value is the same as that of name of this level. |
| all | Specifies whether all objects at the lower level are required. Default value: true. For the database level, the attribute specifies whether all tables in the database are required. For the table level, the attribute specifies whether all columns in the table are required. |
| func | The matching rule of the name. func currently supports three modes. The exact mode is used by default, in which all characters must be the same. fn is the fnmatch mode of Linux. Objects starting with '.' cannot be matched. reg is the regular matching mode of Java. Objects are preferentially matched in exact mode, and then in fn and reg modes. |
| attr | The attribute of this level, which is a JSON object. For example, the configurations for filtering the DML type are provided by using this attribute. |
| sub | The object of the lower level, which is the same as the definition of this level. The meaning vary by level. The lower level of a database is tables, and the lower level of a table is columns. |
Notice:
A match takes effect on the premise that it is in the whitelist but not in the blacklist.
Modify a whitelist/blacklist
Take a JDBCWriter component as an example:
Stop the JDBCWriter component. For more information, see Stop a JDBCWriter.
Modify the corresponding fields based on the content to be modified. Examples:
Add a table: Add a JSON object under the sub attribute of the corresponding database, enter the corresponding name, map, and other attributes, and add the object to the sub array.
Delete a table: Find the table that you want to delete and delete it from the whitelist or add the configurations of the table to the blacklist.
Start the JDBCWriter.