Re: Proposal: Limitations of palloc inside checkpointer - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Proposal: Limitations of palloc inside checkpointer
Date
Msg-id 1439188.1754506714@sss.pgh.pa.us
Whole thread Raw
In response to Re: Proposal: Limitations of palloc inside checkpointer  (Alexander Korotkov <aekorotkov@gmail.com>)
Responses Re: Proposal: Limitations of palloc inside checkpointer
List pgsql-hackers
Alexander Korotkov <aekorotkov@gmail.com> writes:
> I'm going to push this if no objections.

I looked at these patches while preparing release notes, and
found an oversight.  CheckpointerShmemInit does

        CheckpointerShmem->max_requests = Min(NBuffers, MAX_CHECKPOINT_REQUESTS);

but CheckpointerShmemSize still does

    size = add_size(size, mul_size(NBuffers, sizeof(CheckpointerRequest)));

So if NBuffers is more than MAX_CHECKPOINT_REQUESTS, we will allocate
extra CheckpointerRequest array entries that we will never use,
wasting shared memory.  Admittedly the amount is small relative to the
shared buffers themselves, but at the very least this is confusing.

The comment in CheckpointerShmemSize needs adjustment, too.

Also, the reason I was studying it so carefully is that I could not
figure out who to credit for the back-patched fix.  It looks like
the original suggestion for the minimal fix was Alexander's, but
other people seem to have had their fingers in the actual patch
writing --- or am I misreading the thread?

            regards, tom lane



pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: More protocol.h replacements this time into walsender.c
Next
From: Tom Lane
Date:
Subject: Re: fix ancient typo in transformRelOptions()