mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +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:
@ -170,8 +170,8 @@ stop_postmaster_atexit(void)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
start_postmaster(ClusterInfo *cluster)
|
||||
bool
|
||||
start_postmaster(ClusterInfo *cluster, bool throw_error)
|
||||
{
|
||||
char cmd[MAXPGPATH * 4 + 1000];
|
||||
PGconn *conn;
|
||||
@ -236,6 +236,9 @@ start_postmaster(ClusterInfo *cluster)
|
||||
false,
|
||||
"%s", cmd);
|
||||
|
||||
if (!pg_ctl_return && !throw_error)
|
||||
return false;
|
||||
|
||||
/* Check to see if we can connect to the server; if not, report it. */
|
||||
if ((conn = get_db_conn(cluster, "template1")) == NULL ||
|
||||
PQstatus(conn) != CONNECTION_OK)
|
||||
@ -256,6 +259,8 @@ start_postmaster(ClusterInfo *cluster)
|
||||
CLUSTER_NAME(cluster));
|
||||
|
||||
os_info.running_cluster = cluster;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user