On 08/04/2015 03:15 PM, Robert Haas wrote:
> On Tue, Jul 28, 2015 at 3:28 PM, Heikki Linnakangas<[email protected]> wrote:
>> >* The patch requires that the LWLOCK_INDIVIDUAL_NAMES array is kept in sync
>> >with the list of individual locks in lwlock.h. Sooner or later someone will
>> >add an LWLock and forget to update the names-array. That needs to be made
>> >less error-prone, so that the names are maintained in the same place as the
>> >#defines. Perhaps something like rmgrlist.h.
> This is a good idea, but it's not easy to do in the style of
> rmgrlist.h, because I don't believe there's any way to define a macro
> that expands to a preprocessor directive. Attached is a patch that
> instead generates the list of macros from a text file, and also
> generates an array inside lwlock.c with the lock names that gets used
> by the Trace_lwlocks stuff where applicable.
>
> Any objections to this solution to the problem? If not, I'd like to
> go ahead and push this much. I can't test the Windows changes
> locally, though, so it would be helpful if someone could check that
> out.
>
In my latest patch I still have an array with names, but postgres will
show a message
if somebody adds an individual LWLock and forgets to add its name. Code
generation
is also a solution, and if commiters will support it I'll merge it to
main patch.
--
Ildus Kurbangaliev
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company