Re: Online enable/disable data checksums functions return success even when the launcher fails to start

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Online enable/disable data checksums functions return success even when the launcher fails to start
Date: 2026-08-27 17:14:54
Message-ID: 84771066-3DF5-40BB-A4AE-DF3BE329B4A0@yesql.se
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 27 Aug 2026, at 19:04, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:

> pg_enable_data_checksums() and pg_disable_data_checksums() start a
> launcher background worker via StartDataChecksumsWorkerLauncher() and
> then return immediately. The function errors out if registration
> fails, but it does not check whether the launcher actually started
> after that. If the postmaster registers the launcher but then fails to
> fork it (e.g., fork failure under memory pressure), the SQL function
> still returns success, the launcher never runs.

The functions return void and were designed to initiate processing but not
track any level of progress, since processing can take a long time.

> The caller gets no indication that the requested operation did not happen. I reproduced
> this with an induced fork failure, so I think we need to tighten this
> for both PG19 and HEAD branches.

There is also no indication of the operation succeeding from the functions,
pg_stat_activity has the details for this. It's too late to change the
function signature for PG19.

> Fix would be to check
> GetBackgroundWorkerPid()/WaitForBackgroundWorkerStartup() and error
> out when the worker has not started. If okay, I can send a patch.

I'm not convinced there is much value in adding such complexity as it would
have to handle more cases than that to be useful. There is
pg_stat_progress_data_checksums which can be queried for details on the
processing.

It's too late for v19 (in more ways than one perhaps), but feel free to post a
suggestion for HEAD and we can evaluate it from there.

--
Daniel Gustafsson

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2026-08-27 17:18:30 pg_*_advice: tsv load failure, etc.
Previous Message Matheus Alcantara 2026-08-27 17:08:45 Re: Enable partitionwise join for partition keys wrapped by RelabelType