An alternative to sharding
by sequence number is to create a shard ID based on the individual
database and table. The shardbytable
filter achieves this at a row level by combining the schema and table
information to form the shard ID. For all other events, including
statement based events, the shard ID
#UNKNOWN is used.
| Pre-configured filter name |
shardbytable
| ||
| JavaScript Filter File |
tungsten-replicator/support/filters-javascript/shardbytable.js
| ||
| Property prefix |
replicator.filter.shardbytable
| ||
| Stage compatibility |
q-to-dbms
| ||
| tpm Option compatibility |
--svc-applier-filters
| ||
| Data compatibility | Any event | ||
| Parameters | |||
| Parameter | Type | Default | Description |
The key part of the filter is the extraction and construction of the ID, which occurs during row processing:
oneRowChange = rowChanges.get(j);
schemaName = oneRowChange.getSchemaName();
tableName = oneRowChange.getTableName();
id = schemaName + "_" + tableName;
if (proposedShardId == null)
{
proposedShardId = id;
}