Skip to content

Commit e111c9f

Browse files
committed
Remove smgrdounlink() in smgr.c from the code tree
The last caller of this routine was removed in b416691, and as a wise man said one day, dead code tends to silently break. Per discussion between Fujii Masao, Peter Geoghegan, Vignesh C and me. Reported-by: Peter Geoghegan Discussion: https://postgr.es/m/CAH2-Wz=sg5H8-vG4d5UmAofdcRMpeTDt2K-NUWp4GSfhenRGAQ@mail.gmail.com
1 parent 9356e43 commit e111c9f

File tree

2 files changed

+0
-57
lines changed

2 files changed

+0
-57
lines changed

src/backend/storage/smgr/smgr.c

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -335,59 +335,6 @@ smgrcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo)
335335
smgrsw[reln->smgr_which].smgr_create(reln, forknum, isRedo);
336336
}
337337

338-
/*
339-
* smgrdounlink() -- Immediately unlink all forks of a relation.
340-
*
341-
* All forks of the relation are removed from the store. This should
342-
* not be used during transactional operations, since it can't be undone.
343-
*
344-
* If isRedo is true, it is okay for the underlying file(s) to be gone
345-
* already.
346-
*/
347-
void
348-
smgrdounlink(SMgrRelation reln, bool isRedo)
349-
{
350-
RelFileNodeBackend rnode = reln->smgr_rnode;
351-
int which = reln->smgr_which;
352-
ForkNumber forknum;
353-
354-
/* Close the forks at smgr level */
355-
for (forknum = 0; forknum <= MAX_FORKNUM; forknum++)
356-
smgrsw[which].smgr_close(reln, forknum);
357-
358-
/*
359-
* Get rid of any remaining buffers for the relation. bufmgr will just
360-
* drop them without bothering to write the contents.
361-
*/
362-
DropRelFileNodesAllBuffers(&rnode, 1);
363-
364-
/*
365-
* It'd be nice to tell the stats collector to forget it immediately, too.
366-
* But we can't because we don't know the OID (and in cases involving
367-
* relfilenode swaps, it's not always clear which table OID to forget,
368-
* anyway).
369-
*/
370-
371-
/*
372-
* Send a shared-inval message to force other backends to close any
373-
* dangling smgr references they may have for this rel. We should do this
374-
* before starting the actual unlinking, in case we fail partway through
375-
* that step. Note that the sinval message will eventually come back to
376-
* this backend, too, and thereby provide a backstop that we closed our
377-
* own smgr rel.
378-
*/
379-
CacheInvalidateSmgr(rnode);
380-
381-
/*
382-
* Delete the physical file(s).
383-
*
384-
* Note: smgr_unlink must treat deletion failure as a WARNING, not an
385-
* ERROR, because we've already decided to commit or abort the current
386-
* xact.
387-
*/
388-
smgrsw[which].smgr_unlink(rnode, InvalidForkNumber, isRedo);
389-
}
390-
391338
/*
392339
* smgrdosyncall() -- Immediately sync all forks of all given relations
393340
*
@@ -432,9 +379,6 @@ smgrdosyncall(SMgrRelation *rels, int nrels)
432379
*
433380
* If isRedo is true, it is okay for the underlying file(s) to be gone
434381
* already.
435-
*
436-
* This is equivalent to calling smgrdounlink for each relation, but it's
437-
* significantly quicker so should be preferred when possible.
438382
*/
439383
void
440384
smgrdounlinkall(SMgrRelation *rels, int nrels, bool isRedo)

src/include/storage/smgr.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ extern void smgrclose(SMgrRelation reln);
8888
extern void smgrcloseall(void);
8989
extern void smgrclosenode(RelFileNodeBackend rnode);
9090
extern void smgrcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo);
91-
extern void smgrdounlink(SMgrRelation reln, bool isRedo);
9291
extern void smgrdosyncall(SMgrRelation *rels, int nrels);
9392
extern void smgrdounlinkall(SMgrRelation *rels, int nrels, bool isRedo);
9493
extern void smgrextend(SMgrRelation reln, ForkNumber forknum,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy