Hi everyone,
I’m encountering an issue when using Debezium’s Postgres connector (3.2.1.Final) with TimescaleDB on EC2. The Debezium service starts correctly, creates the replication slot and retrieves stored offsets, but it’s only emitting heartbeat events – no change events for my user table(s) are being captured. I’ve narrowed down the problem to the publication configuration and offset handling.
My setup is as follows:
● **Debezium Configuration (Properties):**
-------------------------------------------------
# PubSub Sink Configuration
debezium.sink.type=pubsub
debezium.sink.pubsub.project.id=leadsend-dev
debezium.sink.pubsub.ordering.enabled=false
debezium.sink.pubsub.null.value=OPTIONAL
debezium.sink.pubsub.region=asia-south1
# PostgreSQL Source Configuration
debezium.source.connector.class=io.debezium.connector.postgresql.PostgresConnector
debezium.source.offset.storage.file.filename=data/offsets.dat
debezium.source.offset.flush.interval.ms=10000
# Database Connection
debezium.source.database.hostname=timescaledb-clean
debezium.source.database.port=5432
debezium.source.database.user=timescale-admin-staging-user
debezium.source.database.password=my-password
debezium.source.database.dbname=stamina-staging
debezium.source.database.sslmode=disable
debezium.source.database.schema.include.list=public
# Table Inclusion – monitoring only public.tags table
debezium.source.table.include.list=public.tags
# Replication Settings
debezium.source.topic.prefix=stamina-staging
debezium.source.plugin.name=pgoutput
debezium.source.slot.name=debezium
debezium.source.publication.name=dbz_publication
debezium.source.publication.autoconfigure.mode=disabled
# Slot management
debezium.source.slot.drop.on.stop=false
debezium.source.slot.max.retries=3
debezium.source.slot.retry.delay.ms=10000
# Snapshot configuration
debezium.source.snapshot.mode=initial
# Performance tuning
debezium.source.max.batch.size=2048
debezium.source.max.queue.size=8192
debezium.source.poll.interval.ms=1000
# Connection settings
debezium.source.database.tcpKeepAlive=true
debezium.source.database.connectTimeout=30000
debezium.source.database.socketTimeout=30000
# Heartbeat
debezium.source.heartbeat.interval.ms=60000
debezium.source.heartbeat.action.query=SELECT pg_logical_emit_message(false, 'heartbeat', now()::varchar)
# Transform Configuration (routing events to a single Pub/Sub topic)
debezium.transforms=route
debezium.transforms.route.type=io.debezium.transforms.ByLogicalTableRouter
debezium.transforms.route.topic.regex=.*
debezium.transforms.route.topic.replacement=debezium-server-topic
-------------------------------------------------
● **Database (TimescaleDB) Setup:**
– I have created the required databases and user with replication permissions:
• CREATE DATABASE "stamina-staging";
• CREATE USER "timescale-admin-staging-user" WITH REPLICATION PASSWORD 'RvLBHKMgBVdBjgG46lX0';
• GRANT SELECT ON ALL TABLES IN SCHEMA public TO "timescale-admin-staging-user";
• ALTER USER "timescale-admin-staging-user" WITH REPLICATION;
– I have also created a publication called **dbz_publication**. However, it appears that the publication only includes the internal TimescaleDB tables and the single user table “public.tags”. When I check the publication with:
SELECT * FROM pg_publication_tables WHERE pubname = 'dbz_publication';
– I don’t see any other tables. My expectation is that any changes on the public.tags table (or any further user tables I add later) should emit change events.
● **Observed Behavior:**
– When running locally with the above configuration, Debezium connects to the database, retrieves a stored offset (e.g., LSN{9/D82AA390}) and creates a replication slot. However, I only receive periodic heartbeat events. I tested by inserting/updating records in the `tags` table, but no corresponding change events appear on the Pub/Sub topic – only the heartbeat events are being delivered.
– The logs indicate that Debezium is processing the WAL stream and resetting the replication slot:
INFO Obtained valid replication slot ReplicationSlot [active=false, latestFlushedLsn=LSN{0/23A91C8}, …]
INFO Retrieved latest position from stored offset 'LSN{9/D82AA390}'
INFO Starting streaming
INFO Processing messages
– However, with no data changes apparent, only heartbeat events are being generated.
● **Steps Taken & Troubleshooting:**
1. Verified network connectivity from EC2 to Google Pub/Sub (telnet confirms connection).
2. Confirmed that the service account credentials and Pub/Sub topics are properly set up.
3. Tested the publication: I ran an insert into public.tags manually:
INSERT INTO public.tags (name, description) VALUES ('test-tag', 'desc');
But no data event was captured by Debezium.
4. Reviewed the publication configuration. It appears that the publication **dbz_publication** was created with “FOR ALL TABLES” in earlier attempts, but my current usage seems to only include the internal TimescaleDB tables and the `tags` table.
5. I have also tried adding additional tables using:
ALTER PUBLICATION dbz_publication ADD TABLE public.[table_name];
but without success.
6. Checked the stored offset: The offset from the last snapshot (initial snapshot mode) seems valid, but might no longer correspond to the current WAL logs if the publication/table set wasn't correct.
● **Questions:**
1. Is it expected that only heartbeat events are emitted when no change is detected for the specified table?
2. Could a mismatched stored offset be causing Debezium to miss new changes (i.e., reading from a WAL position that is older than what is available)?
3. Would recreating or explicitly reconfiguring the publication (e.g., using “FOR ALL TABLES” vs. explicitly listing tables) solve the issue? I’ve tried both approaches, but I’m not certain which is preferred with TimescaleDB.
4. Are there any known issues with Debezium when used with TimescaleDB internals and a user-defined publication that only includes one table?
Additional details:
- I’m running Debezium 3.2.1.Final in a Docker container on EC2.
- TimescaleDB version: PostgreSQL 16.9 (compiled for aarch64).
- The transformation configuration is set to route events to the Pub/Sub topic “debezium-server-topic.”
- I have confirmed the user has all necessary privileges (SELECT, USAGE, and REPLICATION).
- When reverting to a local setup (with identical configuration), changes are captured normally (provided that a change is made to the monitored table).
Any insights, debugging tips, or suggestions for further configuration checks would be greatly appreciated.
Thank you in advance for your help!