Bug 254214

Summary: databases/postgresql13-server: correct pkg-message about checksums
Product: Ports & Packages Reporter: Michael Zhilin <mizhka>
Component: Individual Port(s)Assignee: pgsql
Status: Closed FIXED    
Severity: Affects Only Me CC: girgen
Priority: --- Flags: bugzilla: maintainer-feedback? (pgsql)
Version: Latest   
Hardware: Any   
OS: Any   

Description Michael Zhilin freebsd_committer freebsd_triage 2021-03-11 05:51:45 UTC
Hi,

In pkg-message for postgresql13-server there is note about checksums:

"NB. If you're not using a checksumming filesystem like ZFS, you might
    wish to enable data checksumming. It can only be enabled during
    the initdb phase, by adding the "--data-checksums" flag to
    the postgres_initdb_flags rcvar.  Check the initdb(1) manpage
    for more info and make sure you understand the performance
    implications.
"

It's actually true for PGSQL till version 11. Since PGSQL 12 you can enable checksums via pg_checksum procedure:

 # /usr/local/etc/rc.d/postgresql initdb
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "C".
The default text search configuration will be set to "english".

Data page checksums are disabled.

creating directory /var/db/postgres/data13 ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /usr/local/bin/pg_ctl -D /var/db/postgres/data13 -l logfile start

# pg_checksums -e -D /var/db/postgres/data13
Checksum operation completed
Files scanned:  916
Blocks scanned: 3021
pg_checksums: syncing data directory
pg_checksums: updating control file
Checksums enabled in cluster

I propose to correct wording to:

NB. If you're not using a checksumming filesystem like ZFS, you might
    wish to enable data checksumming. It can be enabled during
    the initdb phase, by adding the "--data-checksums" flag to
    the postgres_initdb_flags rcvar. Otherwise you can enable it later by 
    pg_checksums.  Check the initdb(1) manpage for more info 
    and make sure you understand the performance implications.

Please let me know if it's OK and if patch is required. 

Thanks!
Comment 1 Palle Girgensohn freebsd_committer freebsd_triage 2021-05-15 09:14:20 UTC
Comitted. Thanks!