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

Commitd66e366

Browse files
author
Amit Kapila
committed
In bootstrap mode, don't allow the creation of files if they don't already
exist.In commit'sb9d01fe and3908473, we have added some code where weallowed the creation of files during mdopen even if they didn't existduring the bootstrap mode. The later commit obviates the need for same.This was harmless code till now but with an upcoming feature where we don'tallow to create FSM for small tables, this will needlessly create FSMfiles.Author: John NaylorReviewed-by: Amit KapilaDiscussion:https://www.postgresql.org/message-id/CAJVSVGWvB13PzpbLEecFuGFc5V2fsO736BsdTakPiPAcdMM5tQ@mail.gmail.comhttps://www.postgresql.org/message-id/CAA4eK1KsET6sotf+rzOTQfb83pzVEzVhbQi1nxGFYVstVWXUGw@mail.gmail.com
1 parent0803b0a commitd66e366

File tree

1 file changed

+8
-25
lines changed
  • src/backend/storage/smgr

1 file changed

+8
-25
lines changed

‎src/backend/storage/smgr/md.c

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -310,13 +310,7 @@ mdcreate(SMgrRelation reln, ForkNumber forkNum, bool isRedo)
310310
{
311311
intsave_errno=errno;
312312

313-
/*
314-
* During bootstrap, there are cases where a system relation will be
315-
* accessed (by internal backend processes) before the bootstrap
316-
* script nominally creates it. Therefore, allow the file to exist
317-
* already, even if isRedo is not set. (See also mdopen)
318-
*/
319-
if (isRedo||IsBootstrapProcessingMode())
313+
if (isRedo)
320314
fd=PathNameOpenFile(path,O_RDWR |PG_BINARY);
321315
if (fd<0)
322316
{
@@ -572,26 +566,15 @@ mdopen(SMgrRelation reln, ForkNumber forknum, int behavior)
572566

573567
if (fd<0)
574568
{
575-
/*
576-
* During bootstrap, there are cases where a system relation will be
577-
* accessed (by internal backend processes) before the bootstrap
578-
* script nominally creates it. Therefore, accept mdopen() as a
579-
* substitute for mdcreate() in bootstrap mode only. (See mdcreate)
580-
*/
581-
if (IsBootstrapProcessingMode())
582-
fd=PathNameOpenFile(path,O_RDWR |O_CREAT |O_EXCL |PG_BINARY);
583-
if (fd<0)
569+
if ((behavior&EXTENSION_RETURN_NULL)&&
570+
FILE_POSSIBLY_DELETED(errno))
584571
{
585-
if ((behavior&EXTENSION_RETURN_NULL)&&
586-
FILE_POSSIBLY_DELETED(errno))
587-
{
588-
pfree(path);
589-
returnNULL;
590-
}
591-
ereport(ERROR,
592-
(errcode_for_file_access(),
593-
errmsg("could not open file \"%s\": %m",path)));
572+
pfree(path);
573+
returnNULL;
594574
}
575+
ereport(ERROR,
576+
(errcode_for_file_access(),
577+
errmsg("could not open file \"%s\": %m",path)));
595578
}
596579

597580
pfree(path);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp