Re: PostgreSQL Upgrade with Replication managed via repmgr

2022-03-02 Thread Ian Lawrence Barwick
2022年3月2日(水) 23:49 DAN LU :
>
> Hello,
>
> I am hoping someone can help me regarding upgrading PG to the latest release
> that has replication setup via repmgr.
>
> Here is an example of my current setup:
> Server A: PostgreSQL 12.1 serving as the "primary" role managed by repmgr 5.1 
> (https://repmgr.org/)
> Server B: PostgreSQL 12.1 serving as the "standby" role managed by repmgr 5.1 
> as well
>
> Goal:
> Upgrade both primary and standby PG to 14.1 with repmgr 5.1.
>
> I read the upgrade steps via
> https://www.postgresql.org/docs/14/pgupgrade.html.  Step #9 to step #11 is for
> instance with standby, but it does not say repmgr specifically.

repmgr is not part of the core PostgreSQL project, so like any non-core
extension or utility is not considered in the core documentation.

> I also find no literature online that others posted regarding repmgr in the
> mix of an upgrade.

The repmgr documentation discusses this situation:

  https://repmgr.org/docs/current/upgrading-and-pg-upgrade.html

Basically, you should upgrade repmgr to the latest version (5.3.1)
on the current (12.x) server. Otherwise the upgrade with pg_upgrade
will fail, as it will detect that the upgraded database is attempting
to reference extension functions which have been removed or renamed
(which is the case with this repmgr upgrade path)

BTW this issue is not specific to repmgr, and will be relevant for
any non-core extensions which use shared libraries.

> Upgrade both primary and standby PG to 14.1 with repmgr 5.1.

Actually, if that is your goal, you shouldn't need to take any
particular action for repmgr. However do bear in mind that repmgr 5.1
was released in April 2020, and there have been a number of improvements
and bugfixes since then.

I do suggest verifying the upgrade in a non-production environment first.


Regards

Ian Barwick



-- 
EnterpriseDB: https://www.enterprisedb.com




Power loss test

2022-03-02 Thread Levente Birta

Hello

For many years when I get a new server every time I tested the storage 
system with diskchecker.pl for power loss.


I'm just curious if there is any other/newer tool to test ?

Thanks
Levi





Postgres Wal Full

2022-03-02 Thread pgdba pgdba
Hi ,

I have a problem from pg_wal. I am using postgresql version 11 and taking 
backup and writing archive_command in postgresql.conf but did not archive wal 
and my disk ise full from pg_wal. I research why is my wal is full and dont 
found anything could  you help me please ?


How to log to client (port native code to stored procedure)?

2022-03-02 Thread Durumdara
Dear Members!

We have to port a native, complex Win32 code to a stored procedure. PGSQL:
V9.6-V11.

One of the problems is: how to log (to client and to server side)?

In the native code we:
1. Open a transaction.
2. Start a complex process.
3. Make local (filesystem based) log in every important step.
4. Some of the logs are kept "in memory" too.
5. In the end we Commit the transaction (or Rollback on failure).
6. Later we post the "in memory" logs into the database too (to a special
log table).

If we try to port this, the first problem is that in PLPGSQL we CAN'T
manage the transaction.

We can make (raise) notices, and we can catch them in Win32 code - but
maybe not in PHP (Symphony) or in other client calls.

Ok - we can also log into a local (stored proc) variable, which will be
posted into a database log table - as before.

Buf on a possible failure the whole transaction rolled back - so our posted
log is also lost (reverted).
Or it can't be posted at the end (because of tr. dead state), like:ERROR:
current transaction is aborted, commands ignored until end of transaction
block.

One way I can see: if we don't allow any exception in the stored procedure
(catch them all), and we define these IN/OUT variables to pass back the
results and logs.
- LOG TEXT (this contain the log)
- ERRORMSG TEXT (the error of any exception, or inner errors)
- ERRORCODE TEXT (to identify the error)
- SUCC BOOL (if it was successful)

And the caller MUST handle the transaction and MUST log these things at
once.
So then there is no partial logging possibility (now we have it in the
Win32 programme).

Do you have any other ideas for client side logging in stored procedures?

Thank you for any help or suggestions!

Best regards
   dd


PostgreSQL Upgrade with Replication managed via repmgr

2022-03-02 Thread DAN LU
Hello,

I am hoping someone can help me regarding upgrading PG to the latest
release that has replication setup via repmgr.

Here is an example of my current setup:
Server A: PostgreSQL 12.1 serving as the "primary" role managed by repmgr
5.1 (https://repmgr.org/)
Server B: PostgreSQL 12.1 serving as the "standby" role managed by repmgr
5.1 as well

Goal:
Upgrade both primary and standby PG to 14.1 with repmgr 5.1.

I read the upgrade steps via
https://www.postgresql.org/docs/14/pgupgrade.html.  Step #9 to step #11 is
for instance with standby, but it does not say repmgr specifically.  I also
find no literature online that others posted regarding repmgr in the mix of
an upgrade.

Please let me know if anyone has such experience and can share the detailed
steps for upgrading it is much appreciated.

Thanks.

Best regards,
DL