Re: Deduplicate code updating ControleFile's DBState.

From: "Bossart, Nathan" <bossartn(at)amazon(dot)com>
To: Amul Sul <sulamul(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Deduplicate code updating ControleFile's DBState.
Date: 2021-09-14 19:22:03
Message-ID: 4ABB6AFC-7416-4A52-8C67-729AA586050B@amazon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 9/13/21, 11:06 PM, "Amul Sul" <sulamul(at)gmail(dot)com> wrote:
> The patch is straightforward but the only concern is that in
> StartupXLOG(), SharedRecoveryState now gets updated only with spin
> lock; earlier it also had ControlFileLock in addition to that. AFAICU,
> I don't see any problem there, since until the startup process exists
> other backends could not connect and write a WAL record.

It looks like ebdf5bf intentionally made sure that we hold
ControlFileLock while updating SharedRecoveryInProgress (now
SharedRecoveryState after 4e87c48). The thread for this change [0]
has some additional details.

As far as the patch goes, I'm not sure why SetControlFileDBState()
needs to be exported, and TBH I don't know if this change is really a
worthwhile improvement. ISTM the main benefit is that it could help
avoid cases where we update the state but not the time. However,
there's still nothing preventing that, and I don't get the idea that
it was really a big problem to begin with.

Nathan

[0] https://postgr.es/m/CAB7nPqTS5J3-G_zTow0Kc5oqZn877RDDN1Mfcqm2PscAS7FnAw%40mail.gmail.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Lakhin 2021-09-14 20:00:00 Re: Don't clean up LLVM state when exiting in a bad way
Previous Message Andrew Dunstan 2021-09-14 19:18:51 Re: SQL/JSON: JSON_TABLE - pg_stat_statements crash