mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +03:00
Temporarily make pg_ctl and server shutdown a whole lot chattier.
This is a quick hack, due to be reverted when its purpose has been served, to try to gather information about why some of the buildfarm critters regularly fail with "postmaster does not shut down" complaints. Maybe they are just really overloaded, but maybe something else is going on. Hence, instrument pg_ctl to print the current time when it starts waiting for postmaster shutdown and when it gives up, and add a lot of logging of the current time in the server's checkpoint and shutdown code paths. No attempt has been made to make this pretty. I'm not even totally sure if it will build on Windows, but we'll soon find out.
This commit is contained in:
@ -691,6 +691,31 @@ GetUserNameFromId(Oid roleid, bool noerr)
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Quick hack.
|
||||
*/
|
||||
const char *
|
||||
current_time_as_str(void)
|
||||
{
|
||||
static char buf[128];
|
||||
struct timeval now_timeval;
|
||||
pg_time_t now;
|
||||
char msbuf[8];
|
||||
|
||||
gettimeofday(&now_timeval, NULL);
|
||||
now = (pg_time_t) now_timeval.tv_sec;
|
||||
|
||||
pg_strftime(buf, sizeof(buf),
|
||||
/* leave room for milliseconds... */
|
||||
"%Y-%m-%d %H:%M:%S %Z",
|
||||
pg_localtime(&now, log_timezone));
|
||||
|
||||
/* 'paste' milliseconds into place... */
|
||||
sprintf(msbuf, ".%03d", (int) (now_timeval.tv_usec / 1000));
|
||||
memcpy(buf + 19, msbuf, 4);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Interlock-file support
|
||||
@ -724,6 +749,9 @@ UnlinkLockFiles(int status, Datum arg)
|
||||
}
|
||||
/* Since we're about to exit, no need to reclaim storage */
|
||||
lock_files = NIL;
|
||||
|
||||
if (IsPostmasterEnvironment)
|
||||
elog(LOG, "lock files all released at %s", current_time_as_str());
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user