Re: Slow standby snapshot - Mailing list pgsql-hackers

From Michail Nikolaev
Subject Re: Slow standby snapshot
Date
Msg-id CANtu0ohnft26vSQ-Nnd9DuVgFOyNzxG7MRQVSeXhreMH0fh7iw@mail.gmail.com
Whole thread Raw
In response to Re: Slow standby snapshot  (Andrey Borodin <x4mmm@yandex-team.ru>)
Responses Re: Slow standby snapshot
Re: Slow standby snapshot
List pgsql-hackers
Hello, Andrey.

Thanks for your feedback.

> Current patch addresses another problem. In presence of old enough transaction enumeration of KnownAssignedXids with
sharedlock prevents adding new transactions with exclusive lock. And recovery effectively pauses.
 

Actually, I see two problems here (caused by the presence of old long
transactions). The first one is lock contention which causes recovery
pauses. The second one - just high CPU usage on standby by
KnownAssignedXidsGetAndSetXmin.

> All in all, I think using proposed "KnownAssignedXidsNext" patch solves real problem and the problem of binary
searchesshould be addressed by compressing KnownAssignedXids more often.
 

I updated the patch a little. KnownAssignedXidsGetAndSetXmin now
causes fewer cache misses because some values are stored in variables
(registers). I think it is better to not lean on the compiler here
because of `volatile` args.
Also, I have added some comments.

Best regards,
Michail.

Attachment

pgsql-hackers by date:

Previous
From: "Jonathan S. Katz"
Date:
Subject: Re: 2021-11-11 release announcement draft
Next
From: Joshua Brindle
Date:
Subject: Re: Support for NSS as a libpq TLS backend