Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbada44a

Browse files
committed
Fix code to properly pull out shared memory key now that the
postmaster.pid file is larger than in previous major versions.This is a bug introduced when I added lines to the file recently.
1 parentc0577c9 commitbada44a

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

‎src/backend/utils/init/miscinit.c

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -825,29 +825,34 @@ CreateLockFile(const char *filename, bool amPostmaster,
825825
*/
826826
if (isDDLock)
827827
{
828-
char*ptr;
828+
char*ptr=NULL;
829829
unsigned longid1,
830830
id2;
831+
intlineno;
831832

832-
ptr=strchr(buffer,'\n');
833-
if (ptr!=NULL&&
834-
(ptr=strchr(ptr+1,'\n'))!=NULL)
833+
for (lineno=1;lineno <=4;lineno++)
835834
{
836-
ptr++;
837-
if (sscanf(ptr,"%lu %lu",&id1,&id2)==2)
835+
if ((ptr=strchr(ptr,'\n'))==NULL)
838836
{
839-
if (PGSharedMemoryIsInUse(id1,id2))
840-
ereport(FATAL,
841-
(errcode(ERRCODE_LOCK_FILE_EXISTS),
842-
errmsg("pre-existing shared memory block "
843-
"(key %lu, ID %lu) is still in use",
844-
id1,id2),
845-
errhint("If you're sure there are no old "
846-
"server processes still running, remove "
847-
"the shared memory block "
848-
"or just delete the file \"%s\".",
849-
filename)));
837+
elog(LOG,"bogus data in \"%s\"",DIRECTORY_LOCK_FILE);
838+
break;
850839
}
840+
ptr++;
841+
}
842+
843+
if (ptr&&sscanf(ptr,"%lu %lu",&id1,&id2)==2)
844+
{
845+
if (PGSharedMemoryIsInUse(id1,id2))
846+
ereport(FATAL,
847+
(errcode(ERRCODE_LOCK_FILE_EXISTS),
848+
errmsg("pre-existing shared memory block "
849+
"(key %lu, ID %lu) is still in use",
850+
id1,id2),
851+
errhint("If you're sure there are no old "
852+
"server processes still running, remove "
853+
"the shared memory block "
854+
"or just delete the file \"%s\".",
855+
filename)));
851856
}
852857
}
853858

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp