Re: Undocumented error

2022-01-14 Thread David G. Johnston
On Friday, January 14, 2022, Tomas Vondra 
wrote:

> ,
>
> On 1/14/22 00:02, Petar Dambovaliev wrote:
>
>>
>> the error code is `-1` and the error text is `invalid ordering of
>> speculative insertion changes`
>>
>
> Which Postgres version is this, exactly? Was the WAL generated by that
> same version, or did you update/upgrade recently?


The OP failed to mention this is Aurora from AWS based off of 12.4 (we
chatted on Discord about this).

David J.


Re: Undocumented error

2022-01-14 Thread Tomas Vondra

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




Undocumented error

2022-01-14 Thread Petar Dambovaliev
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`