From: | Junwang Zhao <zhjwpku(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Use INT_MAX for wal size related gucs's max value |
Date: | 2023-04-19 03:51:19 |
Message-ID: | CAEG8a3JBT9gpH1hTJM742cgAKmPPPNrsU5xGsnChKPb8hMXLpg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
These gucs are always used with ConvertToXSegs, to calculate the count of
wal segments(see the following code snip), and wal_segment_size can be
configured by initdb as a value of a power of 2 between 1 and 1024 (megabytes),
so I think INT_MAX should be safe here.
/*
* Convert values of GUCs measured in megabytes to equiv. segment count.
* Rounds down.
*/
#define ConvertToXSegs(x, segsize) XLogMBVarToSegs((x), (segsize))
/*
* Convert values of GUCs measured in megabytes to equiv. segment count.
* Rounds down.
*/
#define XLogMBVarToSegs(mbvar, wal_segsz_bytes) \
((mbvar) / ((wal_segsz_bytes) / (1024 * 1024)))
On Wed, Apr 19, 2023 at 11:33 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Junwang Zhao <zhjwpku(at)gmail(dot)com> writes:
> > The wal size related gucs use the MB unit, so we should just use
> > INT_MAX instead of MAX_KILOBYTES as the max value.
>
> The point of MAX_KILOBYTES is to avoid overflow when the value
> is multiplied by 1kB. It does seem like that might not be
> appropriate for these values, but that doesn't mean that we can
> blithely go to INT_MAX. Have you chased down how they are used?
>
> regards, tom lane
--
Regards
Junwang Zhao
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2023-04-19 04:10:27 | Re: [PATCH] Allow Postgres to pick an unused port to listen |
Previous Message | Tom Lane | 2023-04-19 03:33:56 | Re: Use INT_MAX for wal size related gucs's max value |