10.4.43. shardbytable.js Filter

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 remote-to-thl
tpm Option compatibility --svc-remote-filters
Data compatibility ROW
Parameters
Parameter Type Default Description

Note

For this filter to function, you will need to ensure your database is configured for ROW based binary logging

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;
}