Thread: pg_xlog growth on slave with streaming replication

pg_xlog growth on slave with streaming replication

From
Mike Roest
Date:
Hey Everyone,
    I've got a bit of an interesting issue going on with pg_xlog growing on a streaming replication slave.

We're running postgres 9.1.1 x64 built from source on Centos 5.8 x64.

On both the master and the slave we have wal_keep_segments configured for 1000
wal_keep_segments = 1000

This config appears to be working 100% on the master as it consistently has the 1000 files and approx 17 gigs of storage usage.

However on the slave currently we have 4113 wal segments and growing (this is in data/pg_xlog).  The slave has been up and syncing for about 10 days give or take.

As far as I can tell using the pg_current_xlog_location() and pg_last_xlog_replay_location() the slave is correctly in sync.

Looking at the recovery.conf I'm seeing that we don't have archive_cleanup_command defined but looking at the example it seems to be talking about incoming WAL locations for log shipping and doesn't appear to talk about the actual pg_xlog directory.

Is the correct solution here as easy as setting up 
archive_cleanup_command='pg_archivecleanup /db/data/pg_xlog %r'?

Thanks