Re: Add progressive backoff to XactLockTableWait functions

From: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
Cc: Kevin K Biju <kevinkbiju(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Add progressive backoff to XactLockTableWait functions
Date: 2025-06-13 01:18:04
Message-ID: CABPTF7V609C94d3hUBXtE78KsmJPsMrSOQ3Bui3w3P+NMOF2aQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Thanks for the feedback!

On Thu, Jun 12, 2025 at 10:02 PM Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Sabino Mullane 2025-06-13 01:36:11 Re: pg_dump --with-* options
Previous Message Perumal Raj 2025-06-13 00:53:10 Re: Logical Replication slot disappeared after promote Standby