Hi,
On March 21, 2020 5:51:19 PM PDT, Peter Geoghegan <pg@bowt.ie> wrote:
>On Sat, Mar 21, 2020 at 5:25 PM Andres Freund <andres@anarazel.de>
>wrote:
>> > diff --git a/src/backend/access/gin/ginfast.c
>b/src/backend/access/gin/ginfast.c
>> > index 11d7ec067a..c99dc4a8be 100644
>> > --- a/src/backend/access/gin/ginfast.c
>> > +++ b/src/backend/access/gin/ginfast.c
>> > @@ -892,7 +892,7 @@ ginInsertCleanup(GinState *ginstate, bool
>full_clean,
>> > */
>> > processPendingPage(&accum, &datums, page,
>FirstOffsetNumber);
>> >
>> > - vacuum_delay_point();
>> > + stats->delay_msec += vacuum_delay_point();
>> >
>> > /*
>> > * Is it time to flush memory to disk? Flush if we
>are at the end of
>> > @@ -929,7 +929,7 @@ ginInsertCleanup(GinState *ginstate, bool
>full_clean,
>> > {
>> > ginEntryInsert(ginstate, attnum, key,
>category,
>> > list,
>nlist, NULL);
>> > - vacuum_delay_point();
>> > + stats->delay_msec +=
>vacuum_delay_point();
>> > }
>> >
>> > /*
>> > @@ -1002,7 +1002,7 @@ ginInsertCleanup(GinState *ginstate, bool
>full_clean,
>> > /*
>> > * Read next page in pending list
>> > */
>> > - vacuum_delay_point();
>> > + stats->delay_msec += vacuum_delay_point();
>> > buffer = ReadBuffer(index, blkno);
>> > LockBuffer(buffer, GIN_SHARE);
>> > page = BufferGetPage(buffer);
>>
>> On a green field I'd really like to pass a 'vacuum state' struct to
>> vacuum_delay_point().
>
>In a green field situation, there'd be no ginInsertCleanup() at all.
>It is a Lovecraftian horror show. The entire thing should be scrapped
>now, in fact.
My comment is entirely unrelated to GIN, but about the way the delay infrastructure manages state (in global vars).
Andres
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.