mirror of
https://github.com/postgres/postgres.git
synced 2026-07-09 17:51:00 -04:00
Rename register_unlink_segment() to register_unlink_tombstone()
Only "tombstone" files (first segment of main fork) are unlinked after checkpoints, so rename the function and remove the extra arguments to make that more clear. Additionally, add an assertion in mdunlinkfiletag() that the FileTag only contains expected values. Author: Matthias van de Meent <boekewurm+postgres@gmail.com> Reviewed-by: Thomas Munro <thomas.munro@gmail.com> Discussion: https://www.postgresql.org/message-id/CAEze2WjfP95SL_Hsu7GzYXLnQyEsT49zOnNvbY_mBLCFiQra1g@mail.gmail.com
This commit is contained in:
parent
592de8bd21
commit
650bb73c13
1 changed files with 12 additions and 7 deletions
|
|
@ -148,8 +148,7 @@ static void mdunlinkfork(RelFileLocatorBackend rlocator, ForkNumber forknum,
|
|||
static MdfdVec *mdopenfork(SMgrRelation reln, ForkNumber forknum, int behavior);
|
||||
static void register_dirty_segment(SMgrRelation reln, ForkNumber forknum,
|
||||
MdfdVec *seg);
|
||||
static void register_unlink_segment(RelFileLocatorBackend rlocator, ForkNumber forknum,
|
||||
BlockNumber segno);
|
||||
static void register_unlink_tombstone(RelFileLocatorBackend rlocator);
|
||||
static void register_forget_request(RelFileLocatorBackend rlocator, ForkNumber forknum,
|
||||
BlockNumber segno);
|
||||
static void _fdvec_resize(SMgrRelation reln,
|
||||
|
|
@ -421,7 +420,7 @@ mdunlinkfork(RelFileLocatorBackend rlocator, ForkNumber forknum, bool isRedo)
|
|||
|
||||
/* Register request to unlink first segment later */
|
||||
save_errno = errno;
|
||||
register_unlink_segment(rlocator, forknum, 0 /* first seg */ );
|
||||
register_unlink_tombstone(rlocator);
|
||||
errno = save_errno;
|
||||
}
|
||||
|
||||
|
|
@ -1557,15 +1556,18 @@ register_dirty_segment(SMgrRelation reln, ForkNumber forknum, MdfdVec *seg)
|
|||
}
|
||||
|
||||
/*
|
||||
* register_unlink_segment() -- Schedule a file to be deleted after next checkpoint
|
||||
* register_unlink_tombstone() -- Schedule a tombstone file to be deleted
|
||||
*
|
||||
* A tombstone file is an empty first segment of a relation that has already
|
||||
* been dropped (see mdunlink()). This function schedules it to be deleted
|
||||
* after the next checkpoint.
|
||||
*/
|
||||
static void
|
||||
register_unlink_segment(RelFileLocatorBackend rlocator, ForkNumber forknum,
|
||||
BlockNumber segno)
|
||||
register_unlink_tombstone(RelFileLocatorBackend rlocator)
|
||||
{
|
||||
FileTag tag;
|
||||
|
||||
INIT_MD_FILETAG(tag, rlocator.locator, forknum, segno);
|
||||
INIT_MD_FILETAG(tag, rlocator.locator, MAIN_FORKNUM, 0);
|
||||
|
||||
/* Should never be used with temp relations */
|
||||
Assert(!RelFileLocatorBackendIsTemp(rlocator));
|
||||
|
|
@ -1958,6 +1960,9 @@ mdunlinkfiletag(const FileTag *ftag, char *path)
|
|||
{
|
||||
RelPathStr p;
|
||||
|
||||
/* We only unlink tombstone files through this mechanism */
|
||||
Assert(ftag->forknum == MAIN_FORKNUM && ftag->segno == 0);
|
||||
|
||||
/* Compute the path. */
|
||||
p = relpathperm(ftag->rlocator, MAIN_FORKNUM);
|
||||
strlcpy(path, p.str, MAXPGPATH);
|
||||
|
|
|
|||
Loading…
Reference in a new issue