Re: [PATCH] Add pg_disable_checksums() and supporting infrastructure

From: David Christensen <david(at)endpoint(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Add pg_disable_checksums() and supporting infrastructure
Date: 2017-02-18 02:34:10
Message-ID: 48B951AA-CA45-4B24-AB84-22C95C6B4AC2@endpoint.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Feb 17, 2017, at 10:31 AM, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
>
> On Thu, Feb 16, 2017 at 9:58 PM, David Christensen <david(at)endpoint(dot)com> wrote:
> Extracted from a larger patch, this patch provides the basic infrastructure for turning data
> checksums off in a cluster. This also sets up the necessary pg_control fields to support the
> necessary multiple states for handling the transitions.
>
> We do a few things:
>
> - Change "data_checksums" from a simple boolean to "data_checksum_state", an enum type for all of
> the potentially-required states for this feature (as well as enabling).
>
> - Add pg_control support for parsing/displaying the new setting.
>
> - Distinguish between the possible checksum states and be specific about whether we care about
> checksum read failures or write failures at all call sites, turning DataChecksumsEnabled() into two
> functions: DataChecksumsEnabledReads() and DataChecksumsEnabledWrites().
>
> - Create a superuser function pg_disable_checksums() to perform the actual disabling of this in the
> cluster.
>
> I have *not* changed the default in initdb to enable checksums, but this would be trivial.
>
>
> Per the point made by somebody else (I think Simon?) on the other thread, I think it also needs WAL support. Otherwise you turn it off on the master, but it remains on on a replica which will cause failures once datablocks without checksum starts replicating.

Enclosed is a version which supports WAL logging and proper application of the checksum state change. I have verified it works with a replica as far as applying the updated data_checksum_state, though I had to manually call pg_switch_wal() on the master to get it to show up on the replica. (I don’t know if this is a flaw in my patch or just a natural consequence of testing on a low-volume local cluster.)

--
David Christensen
End Point Corporation
david(at)endpoint(dot)com
785-727-1171

Attachment Content-Type Size
disable-checksums.patch application/octet-stream 23.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2017-02-18 02:57:21 Re: Instability in select_parallel regression test
Previous Message Peter Eisentraut 2017-02-18 00:45:06 Re: [HACKERS] Small issue in online devel documentation build