Stas Kelvich wrote:
> Seems that having busy loop is the best idea out of several discussed.
>
> I thought about small sleep at the bottom of that loop if we reached topmost
> transaction, but taking into account low probability of that event may be
> it is faster to do just busy wait.
In other locations where we do similar things we have 1ms sleeps. I
agree with the need for a comment here.
Proposed patch attached. I tried your reload.pgb test case in 9.4
(after changing pgoutput to test_decoding and removing the 3rd arg to a
function call) and the crash takes about 3 seconds without patch in my
machine. No crash with this patch.
Will push this shortly after lunch.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services