Re: shmem_seq may be a bad idea - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: shmem_seq may be a bad idea
Date
Msg-id Pine.LNX.4.21.0005011237120.389-100000@localhost.localdomain
Whole thread Raw
Responses Re: shmem_seq may be a bad idea
List pgsql-hackers
Tom Lane writes:

> When a postmaster initially starts up, it uses a key value of
> PortNumber * 1000. However, if it is forced to do a system-wide
> restart because of a backend crash, it generates a new key value
> different from the old one, namely PortNumber * 1000 + shmem_seq *
> 100, so that the old shared-memory segments are discarded and a new
> set is created.

Why not use IPC_EXCL to ensure you're getting a freshly baked shmem
segment rather than a recycled one?

> The intent of this logic is evidently to ensure that the old, failed
> backends can't somehow corrupt the new ones.

But what if someone runs another postmaster at port 5433, will it
eventually interfere? Or some totally different program? Trying to
generate distinct number to use for keys is only one part of the equation,
but you still have to check whether the number was distinct enough.


-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: RE: [PATCHES] relation filename patch
Next
From: Peter Eisentraut
Date:
Subject: Re: When malloc returns zero ...