detect postgres death in recovery
authorMarko Kreen <markokr@gmail.com>
Thu, 13 Mar 2008 14:50:33 +0000 (14:50 +0000)
committerMarko Kreen <markokr@gmail.com>
Thu, 13 Mar 2008 14:50:33 +0000 (14:50 +0000)
python/walmgr.py

index 7b3c07b1d2689c78270728ba2f75241c3e087bcf..a26472f521d6825d1618ca3202664c22ae431f63 100755 (executable)
@@ -890,6 +890,15 @@ class WalMgr(skytools.DBScript):
                     self.log.info("%s: not found, stopping" % srcname)
                     sys.exit(1)
 
+            # nothing to do, just in case check if parent is alive
+            try:
+                os.kill(os.getppid(), 0)
+            except OSError, ex:
+                if ex.errno == errno.ESRCH:
+                    self.log.info("%s: not found, stopping" % srcname)
+                    sys.exit(1)
+                self.log.warning("Parent aliveness check failed: "+str(ex))
+
             # nothing to do, sleep
             self.log.debug("%s: not found, sleeping" % srcname)
             time.sleep(1)