Re: BUG #16722: PG hanging on COPY when table has close to 2^32 toasts in the table. - Mailing list pgsql-bugs

From tomohiro hiramitsu
Subject Re: BUG #16722: PG hanging on COPY when table has close to 2^32 toasts in the table.
Date
Msg-id CAOR2cEaTazK_7NaJqzxD=T-AiryVc3rMvWvcQ-QOX4h6XzEuDQ@mail.gmail.com
Whole thread Raw
In response to Re: BUG #16722: PG hanging on COPY when table has close to 2^32 toasts in the table.  (Fujii Masao <masao.fujii@oss.nttdata.com>)
Responses Re: BUG #16722: PG hanging on COPY when table has close to 2^32 toasts in the table.  (tomohiro hiramitsu <hiramit.tm@gmail.com>)
List pgsql-bugs
 On Fri, Mar 19, 2021 at 1:32 AM Fujii Masao <masao.fujii@oss.nttdata.com> wrote:
> Thanks for updating the patch! I applied the following and cosmetic changes
> to the patch. Attached is the updated version of the patch.

Thanks for fixing the patch!
I think your fix is fine.


+#define GETNEWOID_WARN_THRESHOLD 1000000
+#define GETNEWOID_WARN_MAX_INTERVAL 100000000

I think it is better to use the following equation to determine the value of GETNEWOID_WARN_MAX_INTERVAL.

  GETNEWOID_WARN_MAX_INTERVAL = 1000000 * 2^n

Example 1:
GETNEWOID_WARN_MAX_INTERVAL = 100000000 /* (Current setting) */

DETAIL:  OID candidates were checked "1000000"  times, but no unused OID is yet found.
DETAIL:  OID candidates were checked "2000000"  times, but no unused OID is yet found. (*=2)
DETAIL:  OID candidates were checked "4000000"  times, but no unused OID is yet found. (*=2)
DETAIL:  OID candidates were checked "8000000"  times, but no unused OID is yet found. (*=2)
DETAIL:  OID candidates were checked "16000000"  times, but no unused OID is yet found. (*=2)
DETAIL:  OID candidates were checked "32000000"  times, but no unused OID is yet found. (*=2)
DETAIL:  OID candidates were checked "64000000"  times, but no unused OID is yet found. (*=2) <---GETNEWOID_WARN_MAX_INTERVAL=100000000
DETAIL:  OID candidates were checked "164000000"  times, but no unused OID is yet found. (+= GETNEWOID_WARN_MAX_INTERVAL)
DETAIL:  OID candidates were checked "264000000"  times, but no unused OID is yet found. (+= GETNEWOID_WARN_MAX_INTERVAL)
DETAIL:  OID candidates were checked "364000000"  times, but no unused OID is yet found. (+= GETNEWOID_WARN_MAX_INTERVAL)

Example 2:
GETNEWOID_WARN_MAX_INTERVAL= 128000000 /* (1000000 * 2^7) */

DETAIL:  OID candidates were checked "1000000"  times, but no unused OID is yet found.
DETAIL:  OID candidates were checked "2000000"  times, but no unused OID is yet found. (*=2)
DETAIL:  OID candidates were checked "4000000"  times, but no unused OID is yet found. (*=2)
DETAIL:  OID candidates were checked "8000000"  times, but no unused OID is yet found. (*=2)
DETAIL:  OID candidates were checked "16000000"  times, but no unused OID is yet found. (*=2)
DETAIL:  OID candidates were checked "32000000"  times, but no unused OID is yet found. (*=2)
DETAIL:  OID candidates were checked "64000000"  times, but no unused OID is yet found. (*=2)
DETAIL:  OID candidates were checked "128000000"  times, but no unused OID is yet found. (*=2) <---GETNEWOID_WARN_MAX_INTERVAL=128000000
DETAIL:  OID candidates were checked "256000000"  times, but no unused OID is yet found. (+= GETNEWOID_WARN_MAX_INTERVAL)
DETAIL:  OID candidates were checked "384000000"  times, but no unused OID is yet found. (+= GETNEWOID_WARN_MAX_INTERVAL)

I like example 2 better for the notification timing after the threshold is exceeded.

Best regards,
--
Tomohiro Hiramitsu
NTT Open Source Software Center
Attachment

pgsql-bugs by date:

Previous
From: Michael Paquier
Date:
Subject: Re: BUG #16927: Postgres can`t access WAL files
Next
From: Michael Paquier
Date:
Subject: Re: BUG #16874: Postgres Server crashes at commit