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

From: tomohiro hiramitsu <hiramit(dot)tm(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Kasahara Tatsuhito <kasahara(dot)tatsuhito(at)gmail(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, Andres Freund <andres(at)anarazel(dot)de>, skoposov(at)ed(dot)ac(dot)uk, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #16722: PG hanging on COPY when table has close to 2^32 toasts in the table.
Date: 2021-03-22 05:43:21
Message-ID: CAOR2cEaTazK_7NaJqzxD=T-AiryVc3rMvWvcQ-QOX4h6XzEuDQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Mar 19, 2021 at 1:32 AM Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)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 Content-Type Size
v6-0001-GetNewOidWithIndex_log_output.patch application/octet-stream 2.8 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2021-03-22 05:50:19 Re: BUG #16874: Postgres Server crashes at commit
Previous Message Michael Paquier 2021-03-22 04:15:47 Re: BUG #16927: Postgres can`t access WAL files