Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of `pg_logical` directory inside PostgreSQL data?

I've just stumbled upon this error while testing failover of a PostgreSQL 9.4 cluster I've set up. Here I'm trying to promote a slave to be the new master:

$ repmgr -f /etc/repmgr/repmgr.conf --verbose standby promote

2014-09-22 10:46:37 UTC LOG:  database system shutdown was interrupted; last known up at 2014-09-22 10:44:02 UTC
2014-09-22 10:46:37 UTC LOG:  database system was not properly shut down; automatic recovery in progress
2014-09-22 10:46:37 UTC LOG:  redo starts at 0/18000028
2014-09-22 10:46:37 UTC LOG:  consistent recovery state reached at 0/19000600
2014-09-22 10:46:37 UTC LOG:  record with zero length at 0/1A000090
2014-09-22 10:46:37 UTC LOG:  redo done at 0/1A000028
2014-09-22 10:46:37 UTC LOG:  last completed transaction was at log time 2014-09-22 10:36:22.679806+00
2014-09-22 10:46:37 UTC FATAL:  could not open directory "pg_logical/snapshots": No such file or directory
2014-09-22 10:46:37 UTC LOG:  startup process (PID 2595) exited with exit code 1
2014-09-22 10:46:37 UTC LOG:  aborting startup due to startup process failure

pg_logical/snapshots dir in fact exists on master node and it is empty.

UPD: I've just manually created empty directories pg_logical/snapshots and pg_logical/mappings and server has started without complaining. repmgr standby clone seems to omit this dirs while syncing. But the question still remains because I'm just curious what this directory is for, maybe I'm missing something in my setup. Simply Googling it did not yield any meaningful results.

like image 506
vlprans Avatar asked Oct 21 '22 01:10

vlprans


1 Answers

It's for the new logical changeset extraction / logical replication feature in 9.4.

This shouldn't happen, though... it suggests a significant bug somewhere, probably repmgr. I'll wait for details (repmgr version, etc).

Update: Confirmed, it's a repmgr bug. It's fixed in git master already (and was before this report) and will be in the next release. Which had better be soon, given the significance of this issue.

like image 180
Craig Ringer Avatar answered Nov 24 '22 02:11

Craig Ringer