summaryrefslogtreecommitdiff
path: root/python/walmgr.py
diff options
context:
space:
mode:
authorMartin Pihlak2011-11-10 08:33:30 +0000
committerMartin Pihlak2011-11-10 08:33:30 +0000
commitbf55a2492267d6872bd66ac2b25a2e93b9e1d5b0 (patch)
tree5517b0865ee3754c4e36dc437a0cfd4559a3f26e /python/walmgr.py
parent501f5456af30c465df740996f9bd1c7a6c17b07f (diff)
Master xarchive now runs "sync" on slave.
This is an attempt at minimizing the chance of WAL file corruption on slave server crash -- master xarchive command does not return success until the the buffers on slave have been flushed to disk.
Diffstat (limited to 'python/walmgr.py')
-rwxr-xr-xpython/walmgr.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/python/walmgr.py b/python/walmgr.py
index 7afc3c73..d4796401 100755
--- a/python/walmgr.py
+++ b/python/walmgr.py
@@ -1358,6 +1358,12 @@ STOP TIME: %(stop_time)s
# copy data
self.exec_rsync([ srcpath, dst_loc ], True)
+ # sync the buffers to disk - this is should reduce the chance
+ # of WAL file corruption in case the slave crashes.
+ slave = self.cf.get("slave")
+ cmdline = ["ssh", "-nT", slave, "sync" ]
+ self.exec_cmd(cmdline)
+
self.log.debug("%s: done", srcname)
end_time = time.time()
self.stat_add('count', 1)