1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-16 06:01:02 +03:00

initdb: Add new option "--no-data-checksums"

Right now this does nothing except override any earlier
--data-checksums option.  But the idea is that --data-checksums could
become the default, and then this option would allow forcing it off
instead.

Author: Greg Sabino Mullane <greg@turnstep.com>
Discussion: https://www.postgresql.org/message-id/flat/CAKAnmmKwiMHik5AHmBEdf5vqzbOBbcwEPHo4-PioWeAbzwcTOQ@mail.gmail.com
This commit is contained in:
Peter Eisentraut
2024-10-01 10:27:39 -04:00
parent efd72a3d42
commit 983a588e0b
3 changed files with 27 additions and 0 deletions

View File

@ -343,6 +343,16 @@ PostgreSQL documentation
</listitem>
</varlistentry>
<varlistentry id="app-initdb-no-data-checksums" xreflabel="no data checksums">
<term><option>--no-data-checksums</option></term>
<listitem>
<para>
Do not enable data checksums. This can be used to override a
<option>--data-checksums</option> option.
</para>
</listitem>
</varlistentry>
<varlistentry id="app-initdb-option-pwfile">
<term><option>--pwfile=<replaceable>filename</replaceable></option></term>
<listitem>

View File

@ -2466,6 +2466,7 @@ usage(const char *progname)
" set builtin locale name for new databases\n"));
printf(_(" --locale-provider={builtin|libc|icu}\n"
" set default locale provider for new databases\n"));
printf(_(" --no-data-checksums do not use data page checksums\n"));
printf(_(" --pwfile=FILE read password for the new superuser from file\n"));
printf(_(" -T, --text-search-config=CFG\n"
" default text search configuration\n"));
@ -3128,6 +3129,7 @@ main(int argc, char *argv[])
{"icu-locale", required_argument, NULL, 17},
{"icu-rules", required_argument, NULL, 18},
{"sync-method", required_argument, NULL, 19},
{"no-data-checksums", no_argument, NULL, 20},
{NULL, 0, NULL, 0}
};
@ -3319,6 +3321,9 @@ main(int argc, char *argv[])
if (!parse_sync_method(optarg, &sync_method))
exit(1);
break;
case 20:
data_checksums = false;
break;
default:
/* getopt_long already emitted a complaint */
pg_log_error_hint("Try \"%s --help\" for more information.", progname);

View File

@ -268,4 +268,16 @@ ok($conf !~ qr/^WORK_MEM = /m, "WORK_MEM should not be configured");
ok($conf !~ qr/^Work_Mem = /m, "Work_Mem should not be configured");
ok($conf =~ qr/^work_mem = 512/m, "work_mem should be in config");
# Test the no-data-checksums flag
my $datadir_nochecksums = "$tempdir/data_no_checksums";
command_ok([ 'initdb', '--no-data-checksums', $datadir_nochecksums ],
'successful creation without data checksums');
# Control file should tell that data checksums are disabled.
command_like(
[ 'pg_controldata', $datadir_nochecksums ],
qr/Data page checksum version:.*0/,
'checksums are disabled in control file');
done_testing();