You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Expand the use of get_dirent_type(), shaving a few calls to stat()/lstat()
Several backend-side loops scanning one or more directories withReadDir() (WAL segment recycle/removal in xlog.c, backend-side directorycopy, temporary file removal, configuration file parsing, some logicaldecoding logic and some pgtz stuff) already know the type of the entrybeing scanned thanks to the dirent structure associated to the entry, onplatforms where we know about DT_REG, DT_DIR and DT_LNK to make thedifference between a regular file, a directory and a symbolic link.Relying on the direct structure of an entry saves a few system calls tostat() and lstat() in the loops updated here, shaving some code while onit. The logic of the code remains the same, calling stat() or lstat()depending on if it is necessary to look through symlinks.Authors: Nathan Bossart, Bharath RupireddyReviewed-by: Andres Freund, Thomas Munro, Michael PaquierDiscussion:https://postgr.es/m/CALj2ACV8n-J-f=yiLUOx2=HrQGPSOZM3nWzyQQvLPcccPXxEdg@mail.gmail.com