1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-24 00:23:06 +03:00

Code review for postmaster.pid contents changes.

Fix broken test for pre-existing postmaster, caused by wrong code for
appending lines to the lockfile; don't write a failed listen_address
setting into the lockfile; don't arbitrarily change the location of the
data directory in the lockfile compared to previous releases; provide more
consistent and useful definitions of the socket path and listen_address
entries; avoid assuming that pg_ctl has the same DEFAULT_PGSOCKET_DIR as
the postmaster; assorted code style improvements.
This commit is contained in:
Tom Lane
2011-01-13 19:01:28 -05:00
parent f0f36045b2
commit 52948169bc
7 changed files with 198 additions and 163 deletions

View File

@@ -104,7 +104,7 @@ on_exit_reset(void)
}
void
AddToLockFile(int target_line, const char *str)
AddToDataDirLockFile(int target_line, const char *str)
{
}
@@ -135,7 +135,7 @@ errcode_for_file_access(void)
bool
errstart(int elevel, const char *filename, int lineno,
const char *funcname)
const char *funcname, const char *domain)
{
return (elevel >= ERROR);
}

View File

@@ -199,15 +199,16 @@ InternalIpcMemoryCreate(IpcMemoryKey memKey, Size size)
on_shmem_exit(IpcMemoryDetach, PointerGetDatum(memAddress));
/*
* Append record key and ID in lockfile for data directory. Format
* to try to keep it the same length.
* Store shmem key and ID in data directory lockfile. Format to try to
* keep it the same length always (trailing junk in the lockfile won't
* hurt, but might confuse humans).
*/
{
char line[32];
char line[64];
sprintf(line, "%9lu %9lu\n", (unsigned long) memKey,
(unsigned long) shmid);
AddToLockFile(LOCK_FILE_LINES, line);
sprintf(line, "%9lu %9lu",
(unsigned long) memKey, (unsigned long) shmid);
AddToDataDirLockFile(LOCK_FILE_LINE_SHMEM_KEY, line);
}
return memAddress;