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

Commit794c543

Browse files
committed
Fix bugs in mdsyncfiletag().
Commit3eb77eb moved a _mdfd_getseg() call from mdsync() into a newcallback function mdsyncfiletag(), but didn't get the arguments quiteright. Without the EXTENSION_DONT_CHECK_SIZE flag we fail to open asegment if lower-numbered segments have been truncated, and it wantsa block number rather than a segment number.While comparing with the older coding, also remove an unnecessaryclobbering of errno, and adjust the code in mdunlinkfiletag() toressemble the original code from mdpostckpt() more closely insteadof using an unnecessary call to smgropen().Author: Thomas MunroDiscussion:https://postgr.es/m/CA%2BhUKGL%2BYLUOA0eYiBXBfwW%2BbH5kFgh94%3DgQH0jHEJ-t5Y91wQ%40mail.gmail.com
1 parentc46c85d commit794c543

File tree

1 file changed

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

1 file changed

+7
-8
lines changed

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,14 +1266,14 @@ mdsyncfiletag(const FileTag *ftag, char *path)
12661266
strlcpy(path,p,MAXPGPATH);
12671267
pfree(p);
12681268

1269-
/* Try to find open the requested segment. */
1270-
v=_mdfd_getseg(reln,ftag->forknum,ftag->segno, false,
1271-
EXTENSION_RETURN_NULL);
1269+
/* Try to open the requested segment. */
1270+
v=_mdfd_getseg(reln,
1271+
ftag->forknum,
1272+
ftag->segno* (BlockNumber)RELSEG_SIZE,
1273+
false,
1274+
EXTENSION_RETURN_NULL |EXTENSION_DONT_CHECK_SIZE);
12721275
if (v==NULL)
1273-
{
1274-
errno=ENOENT;
12751276
return-1;
1276-
}
12771277

12781278
/* Try to fsync the file. */
12791279
returnFileSync(v->mdfd_vfd,WAIT_EVENT_DATA_FILE_SYNC);
@@ -1288,11 +1288,10 @@ mdsyncfiletag(const FileTag *ftag, char *path)
12881288
int
12891289
mdunlinkfiletag(constFileTag*ftag,char*path)
12901290
{
1291-
SMgrRelationreln=smgropen(ftag->rnode,InvalidBackendId);
12921291
char*p;
12931292

12941293
/* Compute the path. */
1295-
p=_mdfd_segpath(reln,ftag->forknum,ftag->segno);
1294+
p=relpathperm(ftag->rnode,MAIN_FORKNUM);
12961295
strlcpy(path,p,MAXPGPATH);
12971296
pfree(p);
12981297

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp