Re: Enforce "max_wal_size/ min_wal_size must be at least twice wal_segment_size" limit while setting GUCs - Mailing list pgsql-hackers
From | Bharath Rupireddy |
---|---|
Subject | Re: Enforce "max_wal_size/ min_wal_size must be at least twice wal_segment_size" limit while setting GUCs |
Date | |
Msg-id | CALj2ACWrbHqmEX6z2gFF=TPLmzUyE-h_ej2-DeFzbjNZ23oc8g@mail.gmail.com Whole thread Raw |
In response to | Re: Enforce "max_wal_size/ min_wal_size must be at least twice wal_segment_size" limit while setting GUCs (Kyotaro Horiguchi <horikyota.ntt@gmail.com>) |
Responses |
Re: Enforce "max_wal_size/ min_wal_size must be at least twice wal_segment_size" limit while setting GUCs
|
List | pgsql-hackers |
On Mon, May 23, 2022 at 10:45 AM Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote: > > At Sat, 21 May 2022 19:08:06 +0530, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> wrote in > > How about we add GUC check hooks for both max_wal_size and > > min_wal_size where we can either emit ERROR or WARNING if values are > > not "at least twice as wal_segment_size"? > > It should be ERROR. > > As you say, it should have been changed when the unit of them is > changed to MB and wal_segment_size became variable. Thanks. Having check hooks for min_wal_size and max_wal_size that throw errors if they aren't at least twice the wal_segment_size has a "BIG" problem - ./initdb -D data --wal-segsize=1 (or a value < 16) fails. This is because during the bootstrap mode the min_wal_size is calculated using the supplied wal-segsize and written to postgresql.conf file, but in the "post-bootstrap initialization" in single user mode, the min_wal_size's default value is calculated as 80MB using default wal_segment_size 16MB (PostmasterMain->InitializeGUCOptions->InitializeOneGUCOption->check_hook) as wal_segment_size isn't read from control file yet, see [1] and [2] for reference. Maybe we have a fundamental problem here that in single user mode we aren't reading control file. I have no further thoughts to offer at this moment [1] foobaralicebob@foobaralicebob:~/postgres/inst/bin$ ./initdb -D data --wal-segsize=1 The files belonging to this database system will be owned by user "foobaralicebob". This user must also own the server process. The database cluster will be initialized with locale "C.UTF-8". The default database encoding has accordingly been set to "UTF8". The default text search configuration will be set to "english". Data page checksums are disabled. creating directory data ... ok creating subdirectories ... ok selecting dynamic shared memory implementation ... posix selecting default max_connections ... 100 selecting default shared_buffers ... 128MB selecting default time zone ... Etc/UTC creating configuration files ... ok running bootstrap script ... 2022-05-23 11:57:35.999 GMT [3277331] LOG: min_wal_size 80, wal_segment_size 16777216 2022-05-23 11:57:36.000 GMT [3277331] LOG: min_wal_size 5, wal_segment_size 1048576 ok performing post-bootstrap initialization ... 2022-05-23 11:57:36.178 GMT [3277333] LOG: min_wal_size 80, wal_segment_size 16777216 2022-05-23 11:57:36.179 GMT [3277333] LOG: min_wal_size 5, wal_segment_size 16777216 2022-05-23 11:57:36.179 GMT [3277333] LOG: "min_wal_size" must be at least twice "wal_segment_size" 2022-05-23 11:57:36.179 UTC [3277333] FATAL: configuration file "/home/foobaralicebob/postgres/inst/bin/data/postgresql.conf" contains errors child process exited with exit code 1 initdb: removing data directory "data" [2] (gdb) bt #0 0x00007f879105cfaa in __GI___select (nfds=0, readfds=0x0, writefds=0x0, exceptfds=0x0, timeout=0x7ffd31e040c0) at ../sysdeps/unix/sysv/linux/select.c:41 #1 0x0000556cee068326 in pg_usleep (microsec=1000000) at pgsleep.c:56 #2 0x0000556ced9cc06e in check_min_wal_size (newval=0x7ffd31e04240, extra=0x7ffd31e04248, source=PGC_S_FILE) at xlog.c:4327 #3 0x0000556cee016e2e in call_int_check_hook (conf=0x556cee365c58 <ConfigureNamesInt+9912>, newval=0x7ffd31e04240, extra=0x7ffd31e04248, source=PGC_S_FILE, elevel=15) at guc.c:11786 #4 0x0000556cee00eb28 in parse_and_validate_value (record=0x556cee365c58 <ConfigureNamesInt+9912>, name=0x556cef5a9778 "min_wal_size", value=0x556cef5a97a0 "5MB", source=PGC_S_FILE, elevel=15, newval=0x7ffd31e04240, newextra=0x7ffd31e04248) at guc.c:7413 #5 0x0000556cee00f908 in set_config_option (name=0x556cef5a9778 "min_wal_size", value=0x556cef5a97a0 "5MB", context=PGC_POSTMASTER, source=PGC_S_FILE, action=GUC_ACTION_SET, changeVal=true, elevel=15, is_reload=false) at guc.c:7922 #6 0x0000556cee01b1b2 in ProcessConfigFileInternal (context=PGC_POSTMASTER, applySettings=true, elevel=15) at guc-file.l:441 #7 0x0000556cee01ab2d in ProcessConfigFile (context=PGC_POSTMASTER) at guc-file.l:155 #8 0x0000556cee00c859 in SelectConfigFiles (userDoption=0x0, progname=0x556cef584eb0 "postgres") at guc.c:6196 #9 0x0000556cede249c6 in PostgresSingleUserMain (argc=12, argv=0x556cef585800, username=0x556cef58cc60 "foobaralicebob") at postgres.c:3991 #10 0x0000556cedc34a72 in main (argc=12, argv=0x556cef585800) at main.c:199 (gdb) Regards, Bharath Rupireddy.
pgsql-hackers by date: