* debian/patches/check_postmaster.patch: New patch, replaces the process

creation time check for postmaster presense with sending signal 0, similar
    to what pg_ctl does.  Closes: #909532.
This commit is contained in:
Michael Banck 2018-09-26 14:20:44 +02:00
parent 1e58cd96f7
commit e7e1f16c77
3 changed files with 29 additions and 0 deletions

3
debian/changelog vendored
View file

@ -3,6 +3,9 @@ patroni (1.5.0-4) UNRELEASED; urgency=medium
[ Michael Banck ]
* debian/gitlab-ci.yml: Run origtargz as `builduser' user during the .build
stage and without during the .test stage.
* debian/patches/check_postmaster.patch: New patch, replaces the process
creation time check for postmaster presense with sending signal 0, similar
to what pg_ctl does. Closes: #909532.
-- Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org> Tue, 25 Sep 2018 15:55:22 +0200

25
debian/patches/check_postmaster.patch vendored Normal file
View file

@ -0,0 +1,25 @@
--- ./patroni/postmaster.py 2018-09-26 13:58:59.000000000 +0200
+++ ./patroni/postmaster.py_ 2018-09-26 13:58:54.567944491 +0200
@@ -39,14 +39,15 @@
return {}
def _is_postmaster_process(self):
+ postmaster_pid = int(self._postmaster_pid.get('pid', 0))
try:
- start_time = int(self._postmaster_pid.get('start_time', 0))
- if start_time and abs(self.create_time() - start_time) > 3:
- logger.info('Process %s is not postmaster, too much difference between PID file start time %s and '
- 'process start time %s', self.pid, self.create_time(), start_time)
- return False
- except ValueError:
- logger.warning('Garbage start time value in pid file: %r', self._postmaster_pid.get('start_time'))
+ self.send_signal(0)
+ except psutil.NoSuchProcess:
+ logger.warning("Could not send stop signal to PostgreSQL")
+ return False
+ except psutil.AccessDenied as e:
+ logger.warning("Could not send stop signal to PostgreSQL (error: {0})".format(e))
+ return False
# Extra safety check. The process can't be ourselves, our parent or our direct child.
if self.pid == os.getpid() or self.pid == os.getppid() or self.ppid() == os.getpid():

View file

@ -4,3 +4,4 @@ coverage_binary.patch
consul_import.patch
patroni_service.patch
behave_failure_logging.patch
check_postmaster.patch