While using the AVRO message format and a partition-by-primary-key, Qlik Replicate tasks that replicate from IBM Db2 for i to a Confluent Kafka target route rows from different tables sharing the same primary key value to different Kafka partitions.
The expected behavior is that a custom primary key column, defined identically across all tables, produces the same AVRO key message, causing Kafka to route all matching rows to the same partition. The observed behavior is that the same key value in two different tables lands in different partitions.
Environment
Qlik Replicate
Resolution
Option 1: Use the enableNamespaces internal parameter
In the Qlik Replicate task, go to the target endpoint Advanced settings.
Add the internal parameter enableNamespaces, and set its value to false.
Save the endpoint setting, and resume the task.
Note: Setting enableNamespaces to false removes the namespace from both the key message schema and the value (data record) message schema.
Option 2: Edit the message format namespace directly
In the task settings, open the Message Format configuration for the AVRO key.
Remove TARGET_TABLE_NAME from the namespace definition. If the tables belong to different owners, also remove TARGET_TABLE_OWNER. If the tables are split across multiple tasks, also remove TASK_NAME.
Make sure the resulting namespace is identical for all tables that must share the same partition.
Save the task settings, and resume the task.
Cause
When producing AVRO messages, Qlik Replicate includes the table namespace in the AVRO key message schema. Because the namespace contains the table name (and, optionally, the table owner and task name), two tables with the same primary key value produce two different AVRO key schemas. Kafka's partitioning logic treats these as distinct keys, and routes them to different partitions, even though the key values are identical.