On 08/28/2016 04:41 PM, Tom Lane wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> Also, I think we ought to replace this code in aset.c:
>
>> initBlockSize = MAXALIGN(initBlockSize);
>> if (initBlockSize < 1024)
>> initBlockSize = 1024;
>> maxBlockSize = MAXALIGN(maxBlockSize);
>
>> With this:
>
>> Assert(initBlockSize >= 1024 && initBlockSize == MAXALIGN(initBlockSize));
>> Assert(maxBlockSize == MAXALIGN(maxBlockSize));
>
> Good idea --- if we'd had it that way, these errors would never have
> gotten committed in the first place. I'm for doing that only in HEAD
> though.
>
Then maybe also add
Assert(initBlockSize <= maxBlockSize);
And perhaps also an assert making sure the minContextSize value makes
sens with respect to the min/max block sizes?
I'm however pretty sure this will have absolutely no impact on profiles.
It might save a few cycles, but this only runs when creating the memory
context and all profiles I've seen are about palloc/pfree.
It might matter when creating many memory contexts, but then you
probably have other things to worry about.
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services