-
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
"no known snapshots" error when db rows are large #74
Comments
Can confirm. This hits us in production daily. |
See comment on the debezium ticket, but I wonder if this is related to TOAST values being split into multiple chunks (PG suggests at ~2000 bytes). But I'd expect to see the same problem both when the TOAST column does change, as well as when it doesn't (what |
@rcoup cannot get a snapshot is not related to cannot get the whole TOAST value. |
@eulerto I am having trouble reproducing in a testcase, but I can reproduce reliably using
Setup:
Hope that helps. I am not sure what is different about the testcase situation. |
I'm able to reproduce on debian stretch using pgdg distribution (wal2json 1.0-2.pgdg90+2, postgres 9.6.10) with large jsonb data on production and with the previous testcase. A workaround is to disable |
@eulerto You cannot reliably access unchanged toast data. It's not in the WAL stream, and therefore logical decoding cannot access it safely. That's why it's separately marked. There's no way include-unchanged-toast=1 is ever safe. This was reported to the bug lists at https://www.postgresql.org/message-id/DB5PR0201MB17507769C5709234B25A409BE2350@DB5PR0201MB1750.eurprd02.prod.outlook.com |
@rcoup ^ |
@anarazel wow. Is that documented anywhere in PG? |
In the logical replication protocol, function |
On 2018-08-27 09:53:54 -0700, Robert Coup wrote:
@anarazel wow. Is that documented anywhere in PG?
Not that well, unfortunately. The code and code level docs explain it,
but after that...
- Andres
|
Per issue #74, parameter include-unchanged-toast wasn't safe, hence, remove it. Since it is part of release 1.0, deprecate this option for the next release.
@anarazel Hi. Sorry for joining the conversation, but I am working on another logical replication plugin for postgres. I am not specialist in Postgres at all, so maybe I miss some very basic point. I have the same issue - when I try to get the datum that is internal on disk (here is code)
it fails with no known snapshots (from heap_tuple_untoast_attr). My question is why is it that "You cannot reliably access unchanged toast data". I understand that it is not in WAL stream, but I thought WAL library is loaded as a shared library (and therefore got access to the same things Postgres got access to). So, even theoretically it is not possible to the the varlena on disk from logical replication plugin? |
@gburanov You also asked via email. I replied there https://www.postgresql.org/message-id/20180831143637.lbxhimikooc4uk7n@alap3.anarazel.de |
I am not convinced that 66d836d is the correct solution to this problem. I am seeing this issue in 645ab69, which dates from before ce82d73 was applied, so the issue appears to be older than that. It seems to me that:
The following code was in the initial commit (821a54a) and I strongly suspect that this code is wrong:
Please could someone check if it's this code that needs to be removed instead? |
@qris The code is correct. See [1] https://github.com/eulerto/wal2json/blob/master/wal2json.c#L577 |
@eulerto can you release a new tag please? |
Per discussion in issue eulerto#74, we can't rely on access unchanged TOAST data because it is not in the WAL stream. It reverts commits 947043e ce82d73 and d86a13b .
Per issue eulerto#74, parameter include-unchanged-toast wasn't safe, hence, remove it. Since it is part of release 1.0, deprecate this option for the next release.
We are facing the same issue while using wal2json plugin with AWS Aurora PostgreSQL 10.6 version. I am getting " psycopg2.InternalError: no known snapshots " error while reading replication message asynchronously from replication slot. AWS Aurora PostgreSQL documentation says that "The logical decoding plugin wal2json has been updated to commit 9e962ba". @eulerto Could you please confirm whether #74 is resolved and if yes then what is the commit id for the change ? |
@manerohit388 Yes, it is. commit 66d836d. |
This option defines which format to use. Only version 1 is currently supported. New formats will be available.
Referring back to this issue, we are hitting this error despite using a newer version of wal2json, and this is installed via rpm below. https://centos.pkgs.org/6/postgresql-12-x86_64/wal2json12-2.2-1.rhel6.x86_64.rpm.html We are currently using postgresql 9.6 with Latin1 database on centos 6 connected with debezium connector and approximately 12mil rows of data.(just a single table) issue happens after few minutes of streaming. Reference: |
@lskz please open another issue and provide a test case. |
@eulerto unfortunately i'm unable to provide the exact steps to replicate this issue, as it is only happening on our production database whereby the load is higher. Perhaps you can provide some suggestion on some of the steps that we can take or areas we can look into to understand why we're hitting a similar issue. |
Per issue eulerto#74, parameter include-unchanged-toast wasn't safe, hence, remove it. Since it is part of release 1.0, deprecate this option for the next release.
How is "unchanged toast data" defined? I mean is the toast considered to be unchanged when (A) the actual "after" value is identical to the "before" value, or when (B) no toast column is included in the UPDATE statement. I'm asking because, in case it turns out to be (B), then one possible way to force "practically unchanged" toast data to go to the WAL stream would be to do (I do know that performing |
The former.
An "no-change" update still has semantic meaning, because it requires the row to be locked etc. We can't just elide the update without violatng transactional semantics. That's not the case eliding toast changes, as row locking / visibility happens on a per-row, not a per-field basis. If you need toasted columns included, you need to use REPLICA IDENTITY FULL. |
I see. Well, it was a bit of a long shot, but still good to have it explicitly ruled out. Thank you for the answer, @anarazel . |
We are using wal2json with Debezium to replicate some db tables containing large rows. While streaming changes, we have encountered the following error:
We think this is a bug with wal2json's handling of TOAST columns, since this behavior only started happening after commit ce82d73
I have a more detailed analysis, including steps to reproduce the issue, up on Debezium's bugtracker:
https://issues.jboss.org/browse/DBZ-842
The text was updated successfully, but these errors were encountered: