On Tue, Sep 01, 2020 at 11:53:36AM +0200, Daniel Gustafsson wrote:
> On 14 Aug 2020, at 20:23, Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
>
>> The logic to keep track number of used slots used is baroque, though -- that
>> could use a lot of simplification.
>
> What if slot_init was an integer which increments together with the loop
> variable until max_slots is reached? If so, maybe it should be renamed
> slot_init_count and slotCount renamed slot_stored_count to make the their use
> clearer?
Good idea, removing slot_init looks like a good thing for readability.
And the same can be done for pg_shdepend.
> On 31 Aug 2020, at 09:56, Michael Paquier <michael@paquier.xyz> wrote:
> +#define MAX_CATALOG_INSERT_BYTES 65535
> This name, and inclusion in a headerfile, implies that the definition is
> somewhat generic as opposed to its actual use. Using MULTIINSERT rather than
> INSERT in the name would clarify I reckon.
Makes sense, I have switched to MAX_CATALOG_MULTI_INSERT_BYTES.
> A few other comments:
>
> + /*
> + * Allocate the slots to use, but delay initialization until we know that
> + * they will be used.
> + */
> I think this comment warrants a longer explanation on why they wont all be
> used, or perhaps none of them (which is the real optimization win here).
Okay, I have updated the comments where this formulation is used.
Does that look adapted to you?
> + ObjectAddresses *addrs_auto;
> + ObjectAddresses *addrs_normal;
> It's not for this patch, but it seems a logical next step would be to be able
> to record the DependencyType as well when collecting deps rather than having to
> create multiple buckets.
Yeah, agreed. I am not sure yet how to design those APIs. One option
is to use a set of an array with DependencyType elements, each one
storing a list of dependencies of the same type.
> + /* Normal dependency from a domain to its collation. */
> + /* We know the default collation is pinned, so don't bother recording it */
> It's just moved and not introduced in this patch, but shouldn't these two lines
> be joined into a normal block comment?
Okay, done.
--
Michael