Is there any documentation on how to correctly create extensions in HA(primary-standby) setup?

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Is there any documentation on how to correctly create extensions in HA(primary-standby) setup?
Date: 2021-12-01 07:01:35
Message-ID: CALj2ACXcedBdnBZ3TFY8PBNf60EZ3=gTK0Zrn5bKpSTmh57M7Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I recently did a small experiment to see how one can create extensions
properly in HA(primary-standby) setup.

Here are my findings:
1) ALTER SYSTEM SET or GUC(configuration parameters) settings are not
replicated to standby.
2) CREATE EXTENSION statements are replicated to standby.
3) If the extension doesn't need to be set up in
shared_preload_libraries GUC, no need to create extension on the
standby, it just works.
4) If the extension needs to be set up in shared_preload_libraries
GUC: the correct way to install the extension on both primary and
standby is:
a) set shared_preload_libraries GUC on primary, reload conf,
restart the primary to make the GUC effective.
b) set shared_preload_libraries GUC on standby, restart the
standby to make the GUC effective.
c) create extension on primary (we don't need to create extension
on standby as the create extension statements are replicated).
d) verify that the extension functions work on both primary and standby.
5) The extensions which perform writes to the database may not work on
standby as the write transactions are not allowed on the standby.
However, the create extension on the standby works just fine but the
functions it provides may not work.

I think I was successful in my experiment, please let me know if
anything is wrong in what I did.

Do we have the documentation on how to create extensions correctly in
HA setup? If what I did is correct and we don't have it documented,
can we have it somewhere in the existing HA related documentation?

Regards,
Bharath Rupireddy.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yugo NAGATA 2021-12-01 07:06:56 Re: Commitfest 2021-11 Patch Triage - Part 1
Previous Message Amit Kapila 2021-12-01 07:00:57 Re: pg_get_publication_tables() output duplicate relid