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?