Hi,
On 1/14/22 00:02, Petar Dambovaliev wrote:
> Hello,
>
> I am using the libpq to consume a replication slot.
> Very rarely, i would get a very strange error that i can't find any
> information on.
> It is not mentioned in any documentation and i don't know under what
> conditions it triggers.
> Any help is appreciated.
>
> The function i am calling is : `PQgetCopyData`
> the error code is `-1` and the error text is `invalid ordering of
> speculative insertion changes`
Well, that's strange. I see the error message in the source code, but it
kinda implies it's something that should not happen. So either there's a
bug in how we WAL log this stuff, or maybe the decoding is wrong. In any
case it has to be very rare issue, because the code is like this since
2018 and there have been 0 complaints so far.
Which Postgres version is this, exactly? Was the WAL generated by that
same version, or did you update/upgrade recently?
Are you able to reproduce the issue? Do you know what did the
transaction that generated this WAL?
It'd be helpful to see the WAL that trigger this issue - presumably the
error message includes the LSN of the record at which this fails, so use
pg_waldump to dump that segment and show us a sufficiently large chunk
from before that LSN. Not sure how much, because I don't know if you use
subtransactions, how long the transactions are, etc.
regards
--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company