Skip to content

[DBZ-PGYB][yugabyte/yugabyte-db#31289] Support upstream heartbeat behavior during streaming phase#198

Open
bakul-gupta wants to merge 1 commit intoybdb-debezium-2.5.2from
heartbeat
Open

[DBZ-PGYB][yugabyte/yugabyte-db#31289] Support upstream heartbeat behavior during streaming phase#198
bakul-gupta wants to merge 1 commit intoybdb-debezium-2.5.2from
heartbeat

Conversation

@bakul-gupta
Copy link
Copy Markdown

@bakul-gupta bakul-gupta commented Apr 30, 2026

Problem

The YugabyteDB heartbeat implementation only dispatches heartbeats during the snapshot-to-streaming transition phase via forcedBeat(). The regular timer-driven heartbeat() method is a no-op, so during the streaming phase neither heartbeat.interval.ms nor heartbeat.action.query has any effect on YugabyteDB.

Solution

Extend the YB-specific heartbeat to support upstream behavior during the streaming phase, while keeping snapshot-phase behavior and the snapshot-to-streaming transition behavior unchanged.

  • YBHeartbeatImpl: heartbeat(...) now delegates to the upstream timer-driven path when heartbeat.interval.ms > 0 and the offset shows snapshot is no longer in effect. forcedBeat(...) is unchanged.
  • YBDatabaseHeartbeatImpl (new): extends DatabaseHeartbeatImpl with the same streaming-only gate on heartbeat(...). Inherited forcedBeat(...) runs heartbeat.action.query on each emitted heartbeat.
  • PostgresConnectorConfig.createHeartbeat: returns the no-op heartbeat only when neither the transition wait nor streaming heartbeats are needed; picks YBDatabaseHeartbeatImpl when an interval and an action query are both configured; falls back to YBHeartbeatImpl otherwise.

Behavior after this change

  • Snapshot phase: no change.
  • Snapshot-to-streaming transition wait: no change.
  • Streaming phase: when heartbeat.interval.ms > 0, periodic heartbeat records are produced; when heartbeat.action.query is also set, the query runs on each tick.

Note

Medium Risk
Changes heartbeat emission and optional database action-query execution for YugabyteDB, which can affect connector liveness/offset behavior and adds periodic DB load during streaming.

Overview
Restores upstream heartbeat behavior for YugabyteDB during the streaming phase: YBHeartbeatImpl.heartbeat() is no longer a no-op and now emits periodic heartbeats when heartbeat.interval.ms > 0, while still suppressing heartbeats during snapshot based on the offset’s snapshot flag.

Adds YBDatabaseHeartbeatImpl to support heartbeat.action.query for YugabyteDB, and updates PostgresConnectorConfig.createHeartbeat() to (a) return NOOP only when neither snapshot-to-streaming transition waiting nor streaming heartbeats are needed, and (b) choose YBDatabaseHeartbeatImpl when both an interval and action query are configured (otherwise falling back to YBHeartbeatImpl).

Reviewed by Cursor Bugbot for commit 8d8eef6. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8d8eef6. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant