On Thu, May 25, 2017 at 11:41:19AM +0900, Michael Paquier wrote:
> On Thu, May 25, 2017 at 11:34 AM, Tsunakawa, Takayuki
> <tsunakawa.takay@jp.fujitsu.com> wrote:
> > From: pgsql-hackers-owner@postgresql.org
> >> [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Noah Misch
> >> Ten feels low to me. The value should be be low enough so users don't give
> >> up and assume a permanent hang, but there's little advantage to making it
> >> lower.
> >> I'd set it such that we give up in 1-5s on a modern Windows machine, which
> >> I expect implies a retry count of one hundred or more.
> >
> > Then, maybe we can measure the time in each iteration and give up after a particular seconds.
Exact duration is not important. Giving up after 0.1s is needlessly early,
because a system taking that long to start a backend is still usable. Giving
up after 50s is quite late. In between those extremes, lots of durations
would be reasonable. Thus, measuring time is needless complexity; retry count
is a suitable proxy.
> Indeed, pgrename() does so with a 100ms sleep time between each
> iteration. Perhaps we could do that and limit to 50 iterations?
pgrename() is polling for an asynchronous event, hence the sleep. To my
knowledge, time doesn't heal shm attach failures; therefore, a sleep is not
appropriate here.