# Mode:timestamp+incrementing when incremented value is in wrong order

**URL:** <https://forum.confluent.io/t/mode-timestamp-incrementing-when-incremented-value-is-in-wrong-order/2712>\
**Category:** Kafka Connect\
**Created:** [13 September 2021 07:20 UTC](https://forum.confluent.io/t/mode-timestamp-incrementing-when-incremented-value-is-in-wrong-order/2712 "2021-09-13T07:20:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![OleBille](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/olebille/32/1042_2.png) [@OleBille](https://forum.confluent.io/u/OleBille)\
**Post date:** [13 September 2021 07:20 UTC](https://forum.confluent.io/t/mode-timestamp-incrementing-when-incremented-value-is-in-wrong-order/2712/1 "2021-09-13T07:20:59Z")

</div>

We have a table with which is maintained by two or more nodes. The ids are an incrementing number but since we have two or more nodes inserting the values of those ids might not always be inserted in the correct order. It could be like this.

```auto
UpdatedTime, id
10:00, 1
10:00, 2
10:01, 101
10:01, 102
10:03, 3

```

When we use the kafka connect jdbc source connector with mode:timestamp+incrementing on this table. Is that a problem?

The sql the kafka connector uses is this.

```sql
SELECT * FROM "public"."thetable" 
WHERE "public"."thetable"."updated" < ? 
  AND (("public"."thetable"."updated" = ? AND "public"."thetable"."id" > ?) 
             OR "public"."thetable"."updated" > ?) 
ORDER BY "public"."thetable"."updated","public"."thetable"."id" ASC

```

---

<div class="post-metadata">

**Author:** ![rmoff](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/rmoff/32/3_2.png) [@rmoff](https://forum.confluent.io/u/rmoff)\
**Post date:** [13 September 2021 08:49 UTC](https://forum.confluent.io/t/mode-timestamp-incrementing-when-incremented-value-is-in-wrong-order/2712/2 "2021-09-13T08:49:18Z")

</div>

I don’t know for sure, but if you want to capture _every_ event I’d definitely be looking at log-based CDC (Debezium, etc). Ref: [No More Silos: Integrating Databases and Apache Kafka](https://rmoff.dev/no-more-silos)

---

<div class="post-metadata">

**Author:** ![OleBille](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/olebille/32/1042_2.png) [@OleBille](https://forum.confluent.io/u/OleBille)\
**Post date:** [13 September 2021 11:56 UTC](https://forum.confluent.io/t/mode-timestamp-incrementing-when-incremented-value-is-in-wrong-order/2712/3 "2021-09-13T11:56:53Z")

</div>

Hi rmoff, thx for replying.  
When we use the jdbc source connector we can determine how the kafka messages are built by creating views which it reads from. If we use the cdc connector we just get the raw tables sent to kafka with internal keys and so on, thats why we are still using the jdbc source connector. But it happened that we lost a few messages and thats why we try with the mode:timestamp+incrementing instead of just timestamp.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/1X/c49438c90c9df282e9996fdf6971be890c71b65a.svg) [@system](https://forum.confluent.io/u/system)\
**Post date:** [13 October 2021 11:57 UTC](https://forum.confluent.io/t/mode-timestamp-incrementing-when-incremented-value-is-in-wrong-order/2712/4 "2021-10-13T11:57:08Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
