Skip to content

Commit 1cccc78

Browse files
committed
Fix pending delete of CFM file
1 parent 1f964fc commit 1cccc78

File tree

1 file changed

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

1 file changed

+8
-7
lines changed

src/backend/storage/smgr/md.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -566,13 +566,6 @@ mdunlinkfork(RelFileNodeBackend rnode, ForkNumber forkNum, bool isRedo)
566566
unlink(segpath);
567567
}
568568
}
569-
/*
570-
* Delete map file
571-
*/
572-
if (forkNum == MAIN_FORKNUM) {
573-
sprintf(segpath, "%s.cfm", path);
574-
unlink(segpath);
575-
}
576569
}
577570
pfree(segpath);
578571
pfree(path);
@@ -1465,6 +1458,7 @@ mdpostckpt(void)
14651458
{
14661459
PendingUnlinkEntry *entry = (PendingUnlinkEntry *) linitial(pendingUnlinks);
14671460
char *path;
1461+
char *map_path;
14681462

14691463
/*
14701464
* New entries are appended to the end, so if the entry is new we've
@@ -1494,6 +1488,13 @@ mdpostckpt(void)
14941488
(errcode_for_file_access(),
14951489
errmsg("could not remove file \"%s\": %m", path)));
14961490
}
1491+
/*
1492+
* Remove compression map if any
1493+
*/
1494+
map_path = psprintf("%s.cfm", path);
1495+
unlink(map_path);
1496+
pfree(map_path);
1497+
14971498
pfree(path);
14981499

14991500
/* And remove the list entry */

0 commit comments

Comments
 (0)