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

Commite111c9f

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

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(SMgrRelationreln,boolisRedo)
349-
{
350-
RelFileNodeBackendrnode=reln->smgr_rnode;
351-
intwhich=reln->smgr_which;
352-
ForkNumberforknum;
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,intnrels,boolisRedo)

‎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
externvoidsmgrcloseall(void);
8989
externvoidsmgrclosenode(RelFileNodeBackendrnode);
9090
externvoidsmgrcreate(SMgrRelationreln,ForkNumberforknum,boolisRedo);
91-
externvoidsmgrdounlink(SMgrRelationreln,boolisRedo);
9291
externvoidsmgrdosyncall(SMgrRelation*rels,intnrels);
9392
externvoidsmgrdounlinkall(SMgrRelation*rels,intnrels,boolisRedo);
9493
externvoidsmgrextend(SMgrRelationreln,ForkNumberforknum,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp