Skip to content

debezium: output the transaction start_ts in Debezium JSON messages #5904

Description

@ekexium

Feature request

Expose the start TSO of the transaction that made a row change in the Debezium protocol output.

Motivation

Debezium JSON messages currently expose only commit_ts in the source block (as a TiDB extension field). Downstream consumers that need to correlate a change event with its originating transaction (e.g. join with transaction-level metadata) have no way to recover the transaction's start_ts from the message, since the decoder approximates it with commit_ts.

Proposal

  • Emit source.start_ts (uint64 TSO, raw value) in the Debezium JSON value message, next to commit_ts, mirroring the existing behavior of commit_ts (always emitted).
  • Declare start_ts in the source schema when enable-tidb-extension is enabled (JSON protocol only; Avro is out of scope).
  • Make the Debezium decoder read source.start_ts and fall back to commit_ts when absent, preserving behavior for messages produced before this field existed.

Acceptance criteria

  • Insert/update/delete Debezium JSON messages carry source.start_ts equal to the event's RowEvent.StartTs.
  • Decoder round-trip restores the true StartTs; old messages without the field still decode (fallback to CommitTs).
  • Avro protocol and DDL/checkpoint messages are unchanged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/feature-requestCategorizes issue or PR as related to a new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions