public inbox for [email protected]
help / color / mirror / Atom feedFrom: jian he <[email protected]>
To: Japin Li <[email protected]>
Cc: Palak Chaturvedi <[email protected]>
Cc: Thomas Munro <[email protected]>
Cc: [email protected]
Cc: [email protected]
Subject: Re: Extension Enhancement: Buffer Invalidation in pg_buffercache
Date: Tue, 4 Jul 2023 19:53:39 +0800
Message-ID: <CACJufxFWPQS6_OHjV6Vk2pd9Ff+=xRWtdvyR97WjpbGfBfjAYA@mail.gmail.com> (raw)
In-Reply-To: <MEYP282MB166908007942485DA71CF8DBB62EA@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>
References: <CALfch19pW48ZwWzUoRSpsaV9hqt0UPyaBPC4bOZ4W+c7FF566A@mail.gmail.com>
<CA+hUKG+i3Dnsv_M+Opk6tTv96w8ZfWFPQAYScj_LRtvw=qx0+A@mail.gmail.com>
<CALfch1_cu_uurBGVG+GO_AtyyYxnuLU5GWf0ahHMre_HDqGDyw@mail.gmail.com>
<MEYP282MB166993107CB3858B7524EA9FB62EA@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>
<CACJufxHe9CZQD0orxhBJMi8VT9iJzmJ7Eodbnkd4LqEOQD7x7A@mail.gmail.com>
<MEYP282MB166908007942485DA71CF8DBB62EA@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>
On Tue, Jul 4, 2023 at 5:45 PM Japin Li <[email protected]> wrote:
>
> On Tue, 04 Jul 2023 at 17:00, jian he <[email protected]> wrote:
> > the following will also crash. no idea why.
> > begin;
> > select count(*) from onek;
> > select relpages from pg_class where relname = 'onek'; --queryA
> >
> > SELECT count(*) FROM pg_buffercache WHERE relfilenode =
> > pg_relation_filenode('onek'::regclass); --queryB
> >
> > insert into onek values(default);
> >
> > select count(pg_buffercache_invalidate(bufferid)) from
> > pg_buffercache where relfilenode =
> > pg_relation_filenode('onek'::regclass);
> >
> > ---------------------------------
> > queryA returns 35, queryB returns 37.
> > ----------------------------------
> > crash info:
> > test_dev=*# insert into onek values(default);
> > INSERT 0 1
> > test_dev=*# select count(pg_buffercache_invalidate(bufferid)) from
> > pg_buffercache where relfilenode =
> > pg_relation_filenode('onek'::regclass);
> > TRAP: failed Assert("resarr->nitems < resarr->maxitems"), File:
> >
> "../../Desktop/pg_sources/main/postgres/src/backend/utils/resowner/resowner.c",
> > Line: 275, PID: 1533312
>
> According to the comments of ResourceArrayAdd(), the caller must have
> previously
> done ResourceArrayEnlarge(). I tried to call ResourceOwnerEnlargeBuffers()
> before
> PinBuffer_Locked(), so it can avoid this crash.
>
> if ((buf_state & BM_DIRTY) == BM_DIRTY)
> {
> + /* make sure we can handle the pin */
> + ResourceOwnerEnlargeBuffers(CurrentResourceOwner);
> +
> /*
> * Try once to flush the dirty buffer.
> */
> PinBuffer_Locked(bufHdr);
>
> --
> Regrads,
> Japin Li.
>
thanks. tested flush pg_catalog, public schema, now, both works as pitched.
view thread (2+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: Extension Enhancement: Buffer Invalidation in pg_buffercache
In-Reply-To: <CACJufxFWPQS6_OHjV6Vk2pd9Ff+=xRWtdvyR97WjpbGfBfjAYA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox