1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

pg_upgrade: detect stale postmaster.pid lock files

If the postmaster.pid lock file exists, try starting/stopping the
cluster to check if the lock file is valid.

Per request from Tom.
This commit is contained in:
Bruce Momjian
2013-01-24 15:20:11 -05:00
parent 74ebba84ae
commit a9ceaa53be
5 changed files with 54 additions and 30 deletions

View File

@ -140,13 +140,12 @@ exec_prog(const char *log_file, const char *opt_log_file,
/*
* is_server_running()
* pid_lock_file_exists()
*
* checks whether postmaster on the given data directory is running or not.
* The check is performed by looking for the existence of postmaster.pid file.
* Checks whether the postmaster.pid file exists.
*/
bool
is_server_running(const char *datadir)
pid_lock_file_exists(const char *datadir)
{
char path[MAXPGPATH];
int fd;
@ -180,8 +179,6 @@ void
verify_directories(void)
{
prep_status("Checking current, bin, and data directories");
#ifndef WIN32
if (access(".", R_OK | W_OK | X_OK) != 0)
#else
@ -194,7 +191,6 @@ verify_directories(void)
check_data_dir(old_cluster.pgdata);
check_bin_dir(&new_cluster);
check_data_dir(new_cluster.pgdata);
check_ok();
}