Re: Offline enabling/disabling of data checksums

Magnus Hagander <magnus@hagander.net>

From: Magnus Hagander <magnus@hagander.net>
To: Michael Paquier <michael@paquier.xyz>
Cc: Michael Banck <michael.banck@credativ.de>, Postgres hackers <pgsql-hackers@postgresql.org>
Date: 2018-12-27T10:43:02Z
Lists: pgsql-hackers
On Sat, Dec 22, 2018 at 12:28 AM Michael Paquier <michael@paquier.xyz>
wrote:

> On Fri, Dec 21, 2018 at 09:16:16PM +0100, Michael Banck wrote:
>
> I think that this is independently useful, I got this stuff part of an
> upgrade workflow where the user is ready to accept some extra one-time
> offline time so as checksums are enabled.
>

Very much so, IMHO.


> Things I have not done so far:
> >
> > 1. Rename pg_verify_checksums to e.g. pg_checksums as it will no longer
> > only verify checksums.
>
> Check.  That sounds right to me.
>

Should we double-check with packagers that this won't cause a problem?
Though the fact that it's done in a major release should make it perfectly
fine I think -- and it's a smaller change than when we did all those
xlog->wal changes...


> 3. Once that patch is in, there would be a way to disable checksums so
> > there'd be a case to also change the initdb default to enabled, but that
> > required further discussion (and maybe another round of benchmarks).
>
> Perhaps, that's unrelated to this thread though.  I am not sure that
> all users would be ready to pay the extra cost of checksums enabled by
> default.
>

I'd be a strong +1 for changing the default once we have a painless way to
turn them off.

It remains super-cheap to turn them off (stop database, one command, turn
them on). So those people that aren't willing to pay the overhead of
checksums, can very cheaply get away from it.

It's a lot more expensive to turn them on once your database has grown to
some size (definitely in offline mode, but also in an online mode when we
get that one in).

Plus, the majority of people *should* want them on :) We don't run with say
synchronous_commit=off by default either to make it easier on those that
don't want to pay the overhead of full data safety :P (I know it's not a
direct match, but you get the idea)

-- 
 Magnus Hagander
 Me: https://www.hagander.net/ <http://www.hagander.net/>
 Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/>

Commits

  1. Reorganize Notes section in documentation of pg_checksums

  2. Add option -N/--no-sync to pg_checksums

  3. Add options to enable and disable checksums in pg_checksums

  4. Refactor more code logic to update the control file

  5. Rename pg_verify_checksums to pg_checksums

  6. Fix cross-version compatibility checks of pg_verify_checksums

  7. Add routine able to update the control file to src/common/