Ordering in Debezium

937 views
Skip to first unread message

Shuguang Xiang

unread,
Jul 27, 2020, 7:21:08 AM7/27/20
to debezium
Hi team,

From Debezium docs, we find that binlog event from Debezium can be pushed into Kafka topics in two ways:
  1. Round robin
  2. Partition by primary key (which is primary key),  ensuring ordering for same primary key within a topic partition
Is option 2 default behaviour in Debezium?
And is primary key configurable? For example, can I choose a column as a partition key in Kafka when pushing message to kafka topic?

Best regards,
Shuguang

Chris Cranford

unread,
Jul 27, 2020, 12:21:19 PM7/27/20
to debe...@googlegroups.com
Hi Shuguang,

Yes, by default Debezium emits messages based on the primary key columns of a table as the message key.  This means for a single partitioned topic, not only will the order of operations against the same key be preserved, but all operations against that table will be emitted in order.  If your topic uses a multiple partition scheme, then the order is only preserved for messages with the same primary key / message key; where-as the order for rows with differing primary keys won't be possible.  If you want to alter the message key, this can be done by applying a custom SMT that modifies the emitted message from Debezium to fit whatever business use case you need.  For details on routing by topic or key manipulation, see
https://debezium.io/documentation/reference/1.2/configuration/topic-routing.html.

Thanks,
Chris C.

By communicating with Grab Inc and/or its subsidiaries, associate companies and jointly controlled entities (“Grab Group”), you are deemed to have consented to the processing of your personal data as set out in the Privacy Notice which can be viewed at https://grab.com/privacy/

This email contains confidential information and is only for the intended recipient(s). If you are not the intended recipient(s), please do not disseminate, distribute or copy this email Please notify Grab Group immediately if you have received this by mistake and delete this email from your system. Email transmission cannot be guaranteed to be secure or error-free as any information therein could be intercepted, corrupted, lost, destroyed, delayed or incomplete, or contain viruses. Grab Group do not accept liability for any errors or omissions in the contents of this email arises as a result of email transmission. All intellectual property rights in this email and attachments therein shall remain vested in Grab Group, unless otherwise provided by law.
--
You received this message because you are subscribed to the Google Groups "debezium" group.
To unsubscribe from this group and stop receiving emails from it, send an email to debezium+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/debezium/8313c6d7-5fcc-48fd-b41a-18ee162abe7bn%40googlegroups.com.

Shuguang Xiang

unread,
Jul 29, 2020, 2:02:12 AM7/29/20
to debe...@googlegroups.com
Thanks for explanation, Chris

On 28 Jul 2020, at 12:21 AM, Chris Cranford <cran...@gmail.com> wrote:

Unsubscribe

It appears that you have subscribed to commercial messages from this sender. To stop receiving such messages from this sender, please unsubscribe


--
You received this message because you are subscribed to the Google Groups "debezium" group.
To unsubscribe from this group and stop receiving emails from it, send an email to debezium+u...@googlegroups.com.

Gunnar Morling

unread,
Jul 29, 2020, 5:44:07 AM7/29/20
to debezium
What Chris said :)

Customizing the key does not require an SMT, though; you can use the "message.key.columns" option of the relational Debezium connectors (e.g. see here for Postgres: https://debezium.io/documentation/reference/connectors/postgresql.html#postgresql-property-message-key-columns) to control which columns should make up the message key and thus will impact the partition assignment.

--Gunnar
Reply all
Reply to author
Forward
0 new messages