-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting an overwhelming amount of transactions with empty change sets despite using add-tables #106
Comments
I can confirm that we're also seeing empty change sets when using pluginOpts := "\"include-xids\" '1', \"include-timestamp\" '1', \"filter-tables\" '*.test'"
err = d.conn.StartReplication(d.config.SlotName, startLSN, -1, pluginOpts) Inserting records into |
Please provide a test case. |
I'll see if I can draft one up. It seems like this is expected behavior, though. The callbacks for |
No, it doesn't.
It seems you have some DDL such as:
|
I meant that the following is expected behavior:
The first row of the peek changes command is an empty change set, which is the expected result.
|
So far, here are the cases that generate empty changesets:
Yet, I don't know what causes huge amount of these empty changesets. The operations above generate only one or two events. |
Running I think Here's a test case:SELECT * FROM pg_create_logical_replication_slot('wal2json_slot', 'wal2json');
SELECT * FROM pg_logical_slot_get_changes('wal2json_slot', NULL, NULL, 'add-tables', '*.users');
lsn | xid | data
-----+-----+------
(0 rows)
VACUUM FULL;
SELECT * FROM pg_logical_slot_get_changes('wal2json_slot', NULL, NULL, 'add-tables', '*.users');
lsn | xid | data
-------------+-------+---------------
11/E81E3860 | 79420 | {"change":[]}
11/E81F9AE0 | 79421 | {"change":[]}
11/E82113D0 | 79422 | {"change":[]}
-- thousands of rows. |
Here is another case with table partitioning:
|
PostgreSQL 15 has a fix to this. If a transaction doesn't produce any records, then begin and commit messages will be skipped. See https://www.postgresql.fastware.com/blog/how-postgresql-15-improved-communication-in-logical-replication |
We are using Replication Streaming and
wal2json
to replicate some tables from AWS RDS PostgreSQL 10.6 to other application. We selectively selecting some tables usingadd-tables
parameter. Everything works great except that sometimes we receive huge amount of transactions with empty changeset that overwhelm the server and slow down syncing real changes we care about.We don't know what causes these huge amount of empty changesets, but I can replicate getting a single empty changeset using either
REFRESH MATERIALIZED VIEW
orTRUNCATE TABLE
on any table even it it's not specified onadd-tables
filter.The text was updated successfully, but these errors were encountered: