Re: warn if GUC set to an invalid shared library

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Maciek Sakrejda <m(dot)sakrejda(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Justin Pryzby <justin(at)telsasoft(dot)com>
Subject: Re: warn if GUC set to an invalid shared library
Date: 2022-02-02 15:39:03
Message-ID: CAKFQuwaRUiA2UOA7QvRaOnaWD1sbv3h3xB+W9KGSDkcsTpG3oA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Feb 1, 2022 at 11:06 PM Maciek Sakrejda <m(dot)sakrejda(at)gmail(dot)com>
wrote:

> I tried running ALTER SYSTEM and got the warnings as expected:
>
> postgres=# alter system set shared_preload_libraries =
> no_such_library,not_this_one_either;
> WARNING: could not access file "$libdir/plugins/no_such_library"
> WARNING: could not access file "$libdir/plugins/not_this_one_either"
> ALTER SYSTEM
>
> I think this is great, but it would be really helpful to also indicate
> that at this point the server will fail to come back up after a restart. In
> my mind, that's a big part of the reason for having a warning here. Having
> made this mistake a couple of times, I would be able to read between the
> lines, as would many other users, but if you're not familiar with Postgres
> this might still be pretty opaque.

+1

I would at least consider having the UX go something like:

postgres=# ALTER SYSTEM SET shared_preload_libraries = not_such_library;
ERROR: <paraphrase: your system will not reboot in its current state as
that library is not present>.
HINT: to bypass the error please add FORCE before SET
postgres=# ALTER SYSTEM FORCE SET shared_preload_libraries =
no_such_library;
NOTICE: Error suppressed while setting shared_preload_libraries.

That is, have the user express their desire to leave the system in a
precarious state explicitly before actually doing so.

Upon startup, if the system already can track each separate location that
shared_preload_libraries is set, printing out those locations and current
values would be useful context. Seeing ALTER SYSTEM in that listing would
be helpful.

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2022-02-02 15:42:09 Re: Ensure that STDERR is empty during connect_ok
Previous Message Julien Rouhaud 2022-02-02 15:35:27 Re: pg_receivewal - couple of improvements