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 <t...@sss.pgh.pa.us> wrote: > > Junwang Zhao <zhjw...@gmail.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