Reindent some comments

Most (older) comments in md.c and smgr.c are indented with a leading
tab on all lines, which isn't the current style and makes updating the
comments a bit annoying.  This reindents all these lines with a single
space, as is the normal style.  This issue exists in various shapes
throughout the code but it's pretty consistent here, and since there
is a patch pending to refresh some of the comments in these files, it
seems sensible to clean this up here separately.

Discussion: https://www.postgresql.org/message-id/flat/22fed8ba-01c3-2008-a256-4ea912d68fab%40enterprisedb.com
This commit is contained in:
Peter Eisentraut 2023-05-19 10:52:04 +02:00
parent e7bff46e50
commit 0b8ace8d77
2 changed files with 145 additions and 145 deletions

View File

@ -42,41 +42,41 @@
#include "utils/memutils.h" #include "utils/memutils.h"
/* /*
* The magnetic disk storage manager keeps track of open file * The magnetic disk storage manager keeps track of open file
* descriptors in its own descriptor pool. This is done to make it * descriptors in its own descriptor pool. This is done to make it
* easier to support relations that are larger than the operating * easier to support relations that are larger than the operating
* system's file size limit (often 2GBytes). In order to do that, * system's file size limit (often 2GBytes). In order to do that,
* we break relations up into "segment" files that are each shorter than * we break relations up into "segment" files that are each shorter than
* the OS file size limit. The segment size is set by the RELSEG_SIZE * the OS file size limit. The segment size is set by the RELSEG_SIZE
* configuration constant in pg_config.h. * configuration constant in pg_config.h.
* *
* On disk, a relation must consist of consecutively numbered segment * On disk, a relation must consist of consecutively numbered segment
* files in the pattern * files in the pattern
* -- Zero or more full segments of exactly RELSEG_SIZE blocks each * -- Zero or more full segments of exactly RELSEG_SIZE blocks each
* -- Exactly one partial segment of size 0 <= size < RELSEG_SIZE blocks * -- Exactly one partial segment of size 0 <= size < RELSEG_SIZE blocks
* -- Optionally, any number of inactive segments of size 0 blocks. * -- Optionally, any number of inactive segments of size 0 blocks.
* The full and partial segments are collectively the "active" segments. * The full and partial segments are collectively the "active" segments.
* Inactive segments are those that once contained data but are currently * Inactive segments are those that once contained data but are currently
* not needed because of an mdtruncate() operation. The reason for leaving * not needed because of an mdtruncate() operation. The reason for leaving
* them present at size zero, rather than unlinking them, is that other * them present at size zero, rather than unlinking them, is that other
* backends and/or the checkpointer might be holding open file references to * backends and/or the checkpointer might be holding open file references to
* such segments. If the relation expands again after mdtruncate(), such * such segments. If the relation expands again after mdtruncate(), such
* that a deactivated segment becomes active again, it is important that * that a deactivated segment becomes active again, it is important that
* such file references still be valid --- else data might get written * such file references still be valid --- else data might get written
* out to an unlinked old copy of a segment file that will eventually * out to an unlinked old copy of a segment file that will eventually
* disappear. * disappear.
* *
* File descriptors are stored in the per-fork md_seg_fds arrays inside * File descriptors are stored in the per-fork md_seg_fds arrays inside
* SMgrRelation. The length of these arrays is stored in md_num_open_segs. * SMgrRelation. The length of these arrays is stored in md_num_open_segs.
* Note that a fork's md_num_open_segs having a specific value does not * Note that a fork's md_num_open_segs having a specific value does not
* necessarily mean the relation doesn't have additional segments; we may * necessarily mean the relation doesn't have additional segments; we may
* just not have opened the next segment yet. (We could not have "all * just not have opened the next segment yet. (We could not have "all
* segments are in the array" as an invariant anyway, since another backend * segments are in the array" as an invariant anyway, since another backend
* could extend the relation while we aren't looking.) We do not have * could extend the relation while we aren't looking.) We do not have
* entries for inactive segments, however; as soon as we find a partial * entries for inactive segments, however; as soon as we find a partial
* segment, we assume that any subsequent segments are inactive. * segment, we assume that any subsequent segments are inactive.
* *
* The entire MdfdVec array is palloc'd in the MdCxt memory context. * The entire MdfdVec array is palloc'd in the MdCxt memory context.
*/ */
typedef struct _MdfdVec typedef struct _MdfdVec
@ -154,7 +154,7 @@ _mdfd_open_flags(void)
} }
/* /*
* mdinit() -- Initialize private state for magnetic disk storage manager. * mdinit() -- Initialize private state for magnetic disk storage manager.
*/ */
void void
mdinit(void) mdinit(void)
@ -165,7 +165,7 @@ mdinit(void)
} }
/* /*
* mdexists() -- Does the physical file exist? * mdexists() -- Does the physical file exist?
* *
* Note: this will return true for lingering files, with pending deletions * Note: this will return true for lingering files, with pending deletions
*/ */
@ -184,7 +184,7 @@ mdexists(SMgrRelation reln, ForkNumber forknum)
} }
/* /*
* mdcreate() -- Create a new relation on magnetic disk. * mdcreate() -- Create a new relation on magnetic disk.
* *
* If isRedo is true, it's okay for the relation to exist already. * If isRedo is true, it's okay for the relation to exist already.
*/ */
@ -242,7 +242,7 @@ mdcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo)
} }
/* /*
* mdunlink() -- Unlink a relation. * mdunlink() -- Unlink a relation.
* *
* Note that we're passed a RelFileLocatorBackend --- by the time this is called, * Note that we're passed a RelFileLocatorBackend --- by the time this is called,
* there won't be an SMgrRelation hashtable entry anymore. * there won't be an SMgrRelation hashtable entry anymore.
@ -447,13 +447,13 @@ mdunlinkfork(RelFileLocatorBackend rlocator, ForkNumber forknum, bool isRedo)
} }
/* /*
* mdextend() -- Add a block to the specified relation. * mdextend() -- Add a block to the specified relation.
* *
* The semantics are nearly the same as mdwrite(): write at the * The semantics are nearly the same as mdwrite(): write at the
* specified position. However, this is to be used for the case of * specified position. However, this is to be used for the case of
* extending a relation (i.e., blocknum is at or beyond the current * extending a relation (i.e., blocknum is at or beyond the current
* EOF). Note that we assume writing a block beyond current EOF * EOF). Note that we assume writing a block beyond current EOF
* causes intervening file space to become filled with zeroes. * causes intervening file space to become filled with zeroes.
*/ */
void void
mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
@ -515,10 +515,10 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
} }
/* /*
* mdzeroextend() -- Add new zeroed out blocks to the specified relation. * mdzeroextend() -- Add new zeroed out blocks to the specified relation.
* *
* Similar to mdextend(), except the relation can be extended by multiple * Similar to mdextend(), except the relation can be extended by multiple
* blocks at once and the added blocks will be filled with zeroes. * blocks at once and the added blocks will be filled with zeroes.
*/ */
void void
mdzeroextend(SMgrRelation reln, ForkNumber forknum, mdzeroextend(SMgrRelation reln, ForkNumber forknum,
@ -623,7 +623,7 @@ mdzeroextend(SMgrRelation reln, ForkNumber forknum,
} }
/* /*
* mdopenfork() -- Open one fork of the specified relation. * mdopenfork() -- Open one fork of the specified relation.
* *
* Note we only open the first segment, when there are multiple segments. * Note we only open the first segment, when there are multiple segments.
* *
@ -673,7 +673,7 @@ mdopenfork(SMgrRelation reln, ForkNumber forknum, int behavior)
} }
/* /*
* mdopen() -- Initialize newly-opened relation. * mdopen() -- Initialize newly-opened relation.
*/ */
void void
mdopen(SMgrRelation reln) mdopen(SMgrRelation reln)
@ -684,7 +684,7 @@ mdopen(SMgrRelation reln)
} }
/* /*
* mdclose() -- Close the specified relation, if it isn't closed already. * mdclose() -- Close the specified relation, if it isn't closed already.
*/ */
void void
mdclose(SMgrRelation reln, ForkNumber forknum) mdclose(SMgrRelation reln, ForkNumber forknum)
@ -707,7 +707,7 @@ mdclose(SMgrRelation reln, ForkNumber forknum)
} }
/* /*
* mdprefetch() -- Initiate asynchronous read of the specified block of a relation * mdprefetch() -- Initiate asynchronous read of the specified block of a relation
*/ */
bool bool
mdprefetch(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum) mdprefetch(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum)
@ -791,7 +791,7 @@ mdwriteback(SMgrRelation reln, ForkNumber forknum,
} }
/* /*
* mdread() -- Read the specified block from a relation. * mdread() -- Read the specified block from a relation.
*/ */
void void
mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
@ -856,11 +856,11 @@ mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
} }
/* /*
* mdwrite() -- Write the supplied block at the appropriate location. * mdwrite() -- Write the supplied block at the appropriate location.
* *
* This is to be used only for updating already-existing blocks of a * This is to be used only for updating already-existing blocks of a
* relation (ie, those before the current EOF). To extend a relation, * relation (ie, those before the current EOF). To extend a relation,
* use mdextend(). * use mdextend().
*/ */
void void
mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
@ -924,12 +924,12 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
} }
/* /*
* mdnblocks() -- Get the number of blocks stored in a relation. * mdnblocks() -- Get the number of blocks stored in a relation.
* *
* Important side effect: all active segments of the relation are opened * Important side effect: all active segments of the relation are opened
* and added to the md_seg_fds array. If this routine has not been * and added to the md_seg_fds array. If this routine has not been
* called, then only segments up to the last one actually touched * called, then only segments up to the last one actually touched
* are present in the array. * are present in the array.
*/ */
BlockNumber BlockNumber
mdnblocks(SMgrRelation reln, ForkNumber forknum) mdnblocks(SMgrRelation reln, ForkNumber forknum)
@ -986,7 +986,7 @@ mdnblocks(SMgrRelation reln, ForkNumber forknum)
} }
/* /*
* mdtruncate() -- Truncate relation to specified number of blocks. * mdtruncate() -- Truncate relation to specified number of blocks.
*/ */
void void
mdtruncate(SMgrRelation reln, ForkNumber forknum, BlockNumber nblocks) mdtruncate(SMgrRelation reln, ForkNumber forknum, BlockNumber nblocks)
@ -1080,7 +1080,7 @@ mdtruncate(SMgrRelation reln, ForkNumber forknum, BlockNumber nblocks)
} }
/* /*
* mdimmedsync() -- Immediately sync a relation to stable storage. * mdimmedsync() -- Immediately sync a relation to stable storage.
* *
* Note that only writes already issued are synced; this routine knows * Note that only writes already issued are synced; this routine knows
* nothing of dirty buffers that may exist inside the buffer manager. We * nothing of dirty buffers that may exist inside the buffer manager. We
@ -1275,7 +1275,7 @@ DropRelationFiles(RelFileLocator *delrels, int ndelrels, bool isRedo)
/* /*
* _fdvec_resize() -- Resize the fork's open segments array * _fdvec_resize() -- Resize the fork's open segments array
*/ */
static void static void
_fdvec_resize(SMgrRelation reln, _fdvec_resize(SMgrRelation reln,
@ -1376,8 +1376,8 @@ _mdfd_openseg(SMgrRelation reln, ForkNumber forknum, BlockNumber segno,
} }
/* /*
* _mdfd_getseg() -- Find the segment of the relation holding the * _mdfd_getseg() -- Find the segment of the relation holding the
* specified block. * specified block.
* *
* If the segment doesn't exist, we ereport, return NULL, or create the * If the segment doesn't exist, we ereport, return NULL, or create the
* segment, according to "behavior". Note: skipFsync is only used in the * segment, according to "behavior". Note: skipFsync is only used in the

View File

@ -104,8 +104,8 @@ static void smgrshutdown(int code, Datum arg);
/* /*
* smgrinit(), smgrshutdown() -- Initialize or shut down storage * smgrinit(), smgrshutdown() -- Initialize or shut down storage
* managers. * managers.
* *
* Note: smgrinit is called during backend startup (normal or standalone * Note: smgrinit is called during backend startup (normal or standalone
* case), *not* during postmaster start. Therefore, any resources created * case), *not* during postmaster start. Therefore, any resources created
@ -142,9 +142,9 @@ smgrshutdown(int code, Datum arg)
} }
/* /*
* smgropen() -- Return an SMgrRelation object, creating it if need be. * smgropen() -- Return an SMgrRelation object, creating it if need be.
* *
* This does not attempt to actually open the underlying file. * This does not attempt to actually open the underlying file.
*/ */
SMgrRelation SMgrRelation
smgropen(RelFileLocator rlocator, BackendId backend) smgropen(RelFileLocator rlocator, BackendId backend)
@ -245,7 +245,7 @@ smgrclearowner(SMgrRelation *owner, SMgrRelation reln)
} }
/* /*
* smgrexists() -- Does the underlying file for a fork exist? * smgrexists() -- Does the underlying file for a fork exist?
*/ */
bool bool
smgrexists(SMgrRelation reln, ForkNumber forknum) smgrexists(SMgrRelation reln, ForkNumber forknum)
@ -254,7 +254,7 @@ smgrexists(SMgrRelation reln, ForkNumber forknum)
} }
/* /*
* smgrclose() -- Close and delete an SMgrRelation object. * smgrclose() -- Close and delete an SMgrRelation object.
*/ */
void void
smgrclose(SMgrRelation reln) smgrclose(SMgrRelation reln)
@ -284,9 +284,9 @@ smgrclose(SMgrRelation reln)
} }
/* /*
* smgrrelease() -- Release all resources used by this object. * smgrrelease() -- Release all resources used by this object.
* *
* The object remains valid. * The object remains valid.
*/ */
void void
smgrrelease(SMgrRelation reln) smgrrelease(SMgrRelation reln)
@ -299,9 +299,9 @@ smgrrelease(SMgrRelation reln)
} }
/* /*
* smgrreleaseall() -- Release resources used by all objects. * smgrreleaseall() -- Release resources used by all objects.
* *
* This is called for PROCSIGNAL_BARRIER_SMGRRELEASE. * This is called for PROCSIGNAL_BARRIER_SMGRRELEASE.
*/ */
void void
smgrreleaseall(void) smgrreleaseall(void)
@ -320,7 +320,7 @@ smgrreleaseall(void)
} }
/* /*
* smgrcloseall() -- Close all existing SMgrRelation objects. * smgrcloseall() -- Close all existing SMgrRelation objects.
*/ */
void void
smgrcloseall(void) smgrcloseall(void)
@ -339,8 +339,8 @@ smgrcloseall(void)
} }
/* /*
* smgrcloserellocator() -- Close SMgrRelation object for given RelFileLocator, * smgrcloserellocator() -- Close SMgrRelation object for given RelFileLocator,
* if one exists. * if one exists.
* *
* This has the same effects as smgrclose(smgropen(rlocator)), but it avoids * This has the same effects as smgrclose(smgropen(rlocator)), but it avoids
* uselessly creating a hashtable entry only to drop it again when no * uselessly creating a hashtable entry only to drop it again when no
@ -363,11 +363,11 @@ smgrcloserellocator(RelFileLocatorBackend rlocator)
} }
/* /*
* smgrcreate() -- Create a new relation. * smgrcreate() -- Create a new relation.
* *
* Given an already-created (but presumably unused) SMgrRelation, * Given an already-created (but presumably unused) SMgrRelation,
* cause the underlying disk file or other storage for the fork * cause the underlying disk file or other storage for the fork
* to be created. * to be created.
*/ */
void void
smgrcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo) smgrcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo)
@ -376,13 +376,13 @@ smgrcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo)
} }
/* /*
* smgrdosyncall() -- Immediately sync all forks of all given relations * smgrdosyncall() -- Immediately sync all forks of all given relations
* *
* All forks of all given relations are synced out to the store. * All forks of all given relations are synced out to the store.
* *
* This is equivalent to FlushRelationBuffers() for each smgr relation, * This is equivalent to FlushRelationBuffers() for each smgr relation,
* then calling smgrimmedsync() for all forks of each relation, but it's * then calling smgrimmedsync() for all forks of each relation, but it's
* significantly quicker so should be preferred when possible. * significantly quicker so should be preferred when possible.
*/ */
void void
smgrdosyncall(SMgrRelation *rels, int nrels) smgrdosyncall(SMgrRelation *rels, int nrels)
@ -411,14 +411,14 @@ smgrdosyncall(SMgrRelation *rels, int nrels)
} }
/* /*
* smgrdounlinkall() -- Immediately unlink all forks of all given relations * smgrdounlinkall() -- Immediately unlink all forks of all given relations
* *
* All forks of all given relations are removed from the store. This * All forks of all given relations are removed from the store. This
* should not be used during transactional operations, since it can't be * should not be used during transactional operations, since it can't be
* undone. * undone.
* *
* If isRedo is true, it is okay for the underlying file(s) to be gone * If isRedo is true, it is okay for the underlying file(s) to be gone
* already. * already.
*/ */
void void
smgrdounlinkall(SMgrRelation *rels, int nrels, bool isRedo) smgrdounlinkall(SMgrRelation *rels, int nrels, bool isRedo)
@ -485,13 +485,13 @@ smgrdounlinkall(SMgrRelation *rels, int nrels, bool isRedo)
/* /*
* smgrextend() -- Add a new block to a file. * smgrextend() -- Add a new block to a file.
* *
* The semantics are nearly the same as smgrwrite(): write at the * The semantics are nearly the same as smgrwrite(): write at the
* specified position. However, this is to be used for the case of * specified position. However, this is to be used for the case of
* extending a relation (i.e., blocknum is at or beyond the current * extending a relation (i.e., blocknum is at or beyond the current
* EOF). Note that we assume writing a block beyond current EOF * EOF). Note that we assume writing a block beyond current EOF
* causes intervening file space to become filled with zeroes. * causes intervening file space to become filled with zeroes.
*/ */
void void
smgrextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, smgrextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
@ -512,11 +512,11 @@ smgrextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
} }
/* /*
* smgrzeroextend() -- Add new zeroed out blocks to a file. * smgrzeroextend() -- Add new zeroed out blocks to a file.
* *
* Similar to smgrextend(), except the relation can be extended by * Similar to smgrextend(), except the relation can be extended by
* multiple blocks at once and the added blocks will be filled with * multiple blocks at once and the added blocks will be filled with
* zeroes. * zeroes.
*/ */
void void
smgrzeroextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, smgrzeroextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
@ -537,11 +537,11 @@ smgrzeroextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
} }
/* /*
* smgrprefetch() -- Initiate asynchronous read of the specified block of a relation. * smgrprefetch() -- Initiate asynchronous read of the specified block of a relation.
* *
* In recovery only, this can return false to indicate that a file * In recovery only, this can return false to indicate that a file
* doesn't exist (presumably it has been dropped by a later WAL * doesn't exist (presumably it has been dropped by a later WAL
* record). * record).
*/ */
bool bool
smgrprefetch(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum) smgrprefetch(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum)
@ -550,12 +550,12 @@ smgrprefetch(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum)
} }
/* /*
* smgrread() -- read a particular block from a relation into the supplied * smgrread() -- read a particular block from a relation into the supplied
* buffer. * buffer.
* *
* This routine is called from the buffer manager in order to * This routine is called from the buffer manager in order to
* instantiate pages in the shared buffer cache. All storage managers * instantiate pages in the shared buffer cache. All storage managers
* return pages in the format that POSTGRES expects. * return pages in the format that POSTGRES expects.
*/ */
void void
smgrread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, smgrread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
@ -565,19 +565,19 @@ smgrread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
} }
/* /*
* smgrwrite() -- Write the supplied buffer out. * smgrwrite() -- Write the supplied buffer out.
* *
* This is to be used only for updating already-existing blocks of a * This is to be used only for updating already-existing blocks of a
* relation (ie, those before the current EOF). To extend a relation, * relation (ie, those before the current EOF). To extend a relation,
* use smgrextend(). * use smgrextend().
* *
* This is not a synchronous write -- the block is not necessarily * This is not a synchronous write -- the block is not necessarily
* on disk at return, only dumped out to the kernel. However, * on disk at return, only dumped out to the kernel. However,
* provisions will be made to fsync the write before the next checkpoint. * provisions will be made to fsync the write before the next checkpoint.
* *
* skipFsync indicates that the caller will make other provisions to * skipFsync indicates that the caller will make other provisions to
* fsync the relation, so we needn't bother. Temporary relations also * fsync the relation, so we needn't bother. Temporary relations also
* do not require fsync. * do not require fsync.
*/ */
void void
smgrwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, smgrwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
@ -589,7 +589,7 @@ smgrwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
/* /*
* smgrwriteback() -- Trigger kernel writeback for the supplied range of * smgrwriteback() -- Trigger kernel writeback for the supplied range of
* blocks. * blocks.
*/ */
void void
@ -601,8 +601,8 @@ smgrwriteback(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
} }
/* /*
* smgrnblocks() -- Calculate the number of blocks in the * smgrnblocks() -- Calculate the number of blocks in the
* supplied relation. * supplied relation.
*/ */
BlockNumber BlockNumber
smgrnblocks(SMgrRelation reln, ForkNumber forknum) smgrnblocks(SMgrRelation reln, ForkNumber forknum)
@ -622,8 +622,8 @@ smgrnblocks(SMgrRelation reln, ForkNumber forknum)
} }
/* /*
* smgrnblocks_cached() -- Get the cached number of blocks in the supplied * smgrnblocks_cached() -- Get the cached number of blocks in the supplied
* relation. * relation.
* *
* Returns an InvalidBlockNumber when not in recovery and when the relation * Returns an InvalidBlockNumber when not in recovery and when the relation
* fork size is not cached. * fork size is not cached.
@ -642,8 +642,8 @@ smgrnblocks_cached(SMgrRelation reln, ForkNumber forknum)
} }
/* /*
* smgrtruncate() -- Truncate the given forks of supplied relation to * smgrtruncate() -- Truncate the given forks of supplied relation to
* each specified numbers of blocks * each specified numbers of blocks
* *
* The truncation is done immediately, so this can't be rolled back. * The truncation is done immediately, so this can't be rolled back.
* *
@ -694,27 +694,27 @@ smgrtruncate(SMgrRelation reln, ForkNumber *forknum, int nforks, BlockNumber *nb
} }
/* /*
* smgrimmedsync() -- Force the specified relation to stable storage. * smgrimmedsync() -- Force the specified relation to stable storage.
* *
* Synchronously force all previous writes to the specified relation * Synchronously force all previous writes to the specified relation
* down to disk. * down to disk.
* *
* This is useful for building completely new relations (eg, new * This is useful for building completely new relations (eg, new
* indexes). Instead of incrementally WAL-logging the index build * indexes). Instead of incrementally WAL-logging the index build
* steps, we can just write completed index pages to disk with smgrwrite * steps, we can just write completed index pages to disk with smgrwrite
* or smgrextend, and then fsync the completed index file before * or smgrextend, and then fsync the completed index file before
* committing the transaction. (This is sufficient for purposes of * committing the transaction. (This is sufficient for purposes of
* crash recovery, since it effectively duplicates forcing a checkpoint * crash recovery, since it effectively duplicates forcing a checkpoint
* for the completed index. But it is *not* sufficient if one wishes * for the completed index. But it is *not* sufficient if one wishes
* to use the WAL log for PITR or replication purposes: in that case * to use the WAL log for PITR or replication purposes: in that case
* we have to make WAL entries as well.) * we have to make WAL entries as well.)
* *
* The preceding writes should specify skipFsync = true to avoid * The preceding writes should specify skipFsync = true to avoid
* duplicative fsyncs. * duplicative fsyncs.
* *
* Note that you need to do FlushRelationBuffers() first if there is * Note that you need to do FlushRelationBuffers() first if there is
* any possibility that there are dirty buffers for the relation; * any possibility that there are dirty buffers for the relation;
* otherwise the sync is not very meaningful. * otherwise the sync is not very meaningful.
*/ */
void void
smgrimmedsync(SMgrRelation reln, ForkNumber forknum) smgrimmedsync(SMgrRelation reln, ForkNumber forknum)