Re: Add progressive backoff to XactLockTableWait functions - Mailing list pgsql-hackers

From Xuneng Zhou
Subject Re: Add progressive backoff to XactLockTableWait functions
Date
Msg-id CABPTF7V609C94d3hUBXtE78KsmJPsMrSOQ3Bui3w3P+NMOF2aQ@mail.gmail.com
Whole thread Raw
In response to Re: Add progressive backoff to XactLockTableWait functions  (Fujii Masao <masao.fujii@oss.nttdata.com>)
List pgsql-hackers
Hi,

Thanks for the feedback! 

On Thu, Jun 12, 2025 at 10:02 PM Fujii Masao <masao.fujii@oss.nttdata.com> wrote:


When I first suggested this idea, I used 10s as an example for
the maximum sleep time. But thinking more about it now, 10s might
be too long. Even if the target transaction has already finished,
XactLockTableWait() could still wait up to 10 seconds,
which seems excessive.

+1, this could be a problem 
 
What about using 1s instead? That value is already used as a max
sleep time in other places, like WaitExceedsMaxStandbyDelay().

1s should be generally good
 
If we agree on 1s as the max, then using exponential backoff from
1ms to 1s after the threshold might not be necessary. It might
be simpler and sufficient to just sleep for 1s once we hit
the threshold.

That makes sense to me.

Based on that, I think a change like the following could work well.
Thought?

I'll update the patch accordingly.

Best regards,
Xuneng

pgsql-hackers by date:

Previous
From: Perumal Raj
Date:
Subject: Re: Logical Replication slot disappeared after promote Standby
Next
From: Greg Sabino Mullane
Date:
Subject: Re: [WIP PATCH v2] Implement "pg_restore --data-only --clean" as a way to skip WAL