Thread: Why is pg_xlog/archive_status of HotStandby synced with master?

Why is pg_xlog/archive_status of HotStandby synced with master?

From
Juraj Fabo
Date:
Hi

I have SLES 11 SP2 in virtual boxes with postgres 9.2.2.
My target is to have Master /Hotstandby (HS) with streaming replication (SR) managed with corosync/pacemaker beside also regular archivation of database.

I started with testing of archivation and replication I noticed that pg_xlog/archive_status is being updated on HS when it is updated on Master, however, even if the HS does NOT do any archivation.

Archive command on master:
archive_command = 'cp %p /var/lib/pgsql/data/archive/%f'

SR is working properly, when I make inserts on Master DB I get proper select results on HS.
However, while I see growing content of Masters /var/lib/pgsql/data/archive and Masters /var/lib/pgsql/data/pg_xlog/archive_status/ respectively on the HS only the /var/lib/pgsql/data/pg_xlog/archive_status/ is updated.

I would like to ask for advise on how to understand the content of archive_status. I considered to be indicator of already archived WALs , but obviously on HS it is not that case.
In case of my master termination its archive will be no longer available and on the exHS which is promoted to new Master, the new Master archive will miss data archived on exMaster.
At least my tests showed, that even manually clearing HS pg_xlog/archive_status/ just before its promotion does not lead to archivation of not-yet-archived-wals on exHS/newMaster.

I think that an option would be to make a new base backup on each promotion/failure, but then I do not see much reason for archivation command on Master.
Then again, archive command using rsync to archive on HS would be kind of overhead, since the information it would transfer is already being transfered via SR, isn't it?

Thank you in advance for hints.

Best regards

Juraj