mirror of
https://github.com/postgres/postgres.git
synced 2025-04-27 22:56:53 +03:00
Rename some functions to mention Relation instead of RelFileLocator.
This is definitely shorter, and hopefully clearer. Kyotaro Horiguchi, reviewed by Dilip Kumar and by me Discussion: http://postgr.es/m/20220707.174436.1885393789789795413.horikyota.ntt@gmail.com
This commit is contained in:
parent
5ca0fe5c8a
commit
09c5acee8e
@ -121,7 +121,7 @@ typedef struct CkptTsStatus
|
|||||||
* Type for array used to sort SMgrRelations
|
* Type for array used to sort SMgrRelations
|
||||||
*
|
*
|
||||||
* FlushRelationsAllBuffers shares the same comparator function with
|
* FlushRelationsAllBuffers shares the same comparator function with
|
||||||
* DropRelFileLocatorsAllBuffers. Pointer to this struct and RelFileLocator must be
|
* DropRelationsAllBuffers. Pointer to this struct and RelFileLocator must be
|
||||||
* compatible.
|
* compatible.
|
||||||
*/
|
*/
|
||||||
typedef struct SMgrSortArray
|
typedef struct SMgrSortArray
|
||||||
@ -483,7 +483,7 @@ static BufferDesc *BufferAlloc(SMgrRelation smgr,
|
|||||||
BufferAccessStrategy strategy,
|
BufferAccessStrategy strategy,
|
||||||
bool *foundPtr);
|
bool *foundPtr);
|
||||||
static void FlushBuffer(BufferDesc *buf, SMgrRelation reln);
|
static void FlushBuffer(BufferDesc *buf, SMgrRelation reln);
|
||||||
static void FindAndDropRelFileLocatorBuffers(RelFileLocator rlocator,
|
static void FindAndDropRelationBuffers(RelFileLocator rlocator,
|
||||||
ForkNumber forkNum,
|
ForkNumber forkNum,
|
||||||
BlockNumber nForkBlock,
|
BlockNumber nForkBlock,
|
||||||
BlockNumber firstDelBlock);
|
BlockNumber firstDelBlock);
|
||||||
@ -3026,7 +3026,7 @@ BufferGetLSNAtomic(Buffer buffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------
|
/* ---------------------------------------------------------------------
|
||||||
* DropRelFileLocatorBuffers
|
* DropRelationBuffers
|
||||||
*
|
*
|
||||||
* This function removes from the buffer pool all the pages of the
|
* This function removes from the buffer pool all the pages of the
|
||||||
* specified relation forks that have block numbers >= firstDelBlock.
|
* specified relation forks that have block numbers >= firstDelBlock.
|
||||||
@ -3047,7 +3047,7 @@ BufferGetLSNAtomic(Buffer buffer)
|
|||||||
* --------------------------------------------------------------------
|
* --------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
DropRelFileLocatorBuffers(SMgrRelation smgr_reln, ForkNumber *forkNum,
|
DropRelationBuffers(SMgrRelation smgr_reln, ForkNumber *forkNum,
|
||||||
int nforks, BlockNumber *firstDelBlock)
|
int nforks, BlockNumber *firstDelBlock)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -3064,7 +3064,7 @@ DropRelFileLocatorBuffers(SMgrRelation smgr_reln, ForkNumber *forkNum,
|
|||||||
if (rlocator.backend == MyBackendId)
|
if (rlocator.backend == MyBackendId)
|
||||||
{
|
{
|
||||||
for (j = 0; j < nforks; j++)
|
for (j = 0; j < nforks; j++)
|
||||||
DropRelFileLocatorLocalBuffers(rlocator.locator, forkNum[j],
|
DropRelationLocalBuffers(rlocator.locator, forkNum[j],
|
||||||
firstDelBlock[j]);
|
firstDelBlock[j]);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -3115,7 +3115,7 @@ DropRelFileLocatorBuffers(SMgrRelation smgr_reln, ForkNumber *forkNum,
|
|||||||
nBlocksToInvalidate < BUF_DROP_FULL_SCAN_THRESHOLD)
|
nBlocksToInvalidate < BUF_DROP_FULL_SCAN_THRESHOLD)
|
||||||
{
|
{
|
||||||
for (j = 0; j < nforks; j++)
|
for (j = 0; j < nforks; j++)
|
||||||
FindAndDropRelFileLocatorBuffers(rlocator.locator, forkNum[j],
|
FindAndDropRelationBuffers(rlocator.locator, forkNum[j],
|
||||||
nForkBlock[j], firstDelBlock[j]);
|
nForkBlock[j], firstDelBlock[j]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3162,16 +3162,15 @@ DropRelFileLocatorBuffers(SMgrRelation smgr_reln, ForkNumber *forkNum,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------
|
/* ---------------------------------------------------------------------
|
||||||
* DropRelFileLocatorsAllBuffers
|
* DropRelationsAllBuffers
|
||||||
*
|
*
|
||||||
* This function removes from the buffer pool all the pages of all
|
* This function removes from the buffer pool all the pages of all
|
||||||
* forks of the specified relations. It's equivalent to calling
|
* forks of the specified relations. It's equivalent to calling
|
||||||
* DropRelFileLocatorBuffers once per fork per relation with
|
* DropRelationBuffers once per fork per relation with firstDelBlock = 0.
|
||||||
* firstDelBlock = 0.
|
|
||||||
* --------------------------------------------------------------------
|
* --------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
DropRelFileLocatorsAllBuffers(SMgrRelation *smgr_reln, int nlocators)
|
DropRelationsAllBuffers(SMgrRelation *smgr_reln, int nlocators)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
@ -3194,7 +3193,7 @@ DropRelFileLocatorsAllBuffers(SMgrRelation *smgr_reln, int nlocators)
|
|||||||
if (RelFileLocatorBackendIsTemp(smgr_reln[i]->smgr_rlocator))
|
if (RelFileLocatorBackendIsTemp(smgr_reln[i]->smgr_rlocator))
|
||||||
{
|
{
|
||||||
if (smgr_reln[i]->smgr_rlocator.backend == MyBackendId)
|
if (smgr_reln[i]->smgr_rlocator.backend == MyBackendId)
|
||||||
DropRelFileLocatorAllLocalBuffers(smgr_reln[i]->smgr_rlocator.locator);
|
DropRelationAllLocalBuffers(smgr_reln[i]->smgr_rlocator.locator);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rels[n++] = smgr_reln[i];
|
rels[n++] = smgr_reln[i];
|
||||||
@ -3219,7 +3218,7 @@ DropRelFileLocatorsAllBuffers(SMgrRelation *smgr_reln, int nlocators)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* We can avoid scanning the entire buffer pool if we know the exact size
|
* We can avoid scanning the entire buffer pool if we know the exact size
|
||||||
* of each of the given relation forks. See DropRelFileLocatorBuffers.
|
* of each of the given relation forks. See DropRelationBuffers.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < n && cached; i++)
|
for (i = 0; i < n && cached; i++)
|
||||||
{
|
{
|
||||||
@ -3257,7 +3256,7 @@ DropRelFileLocatorsAllBuffers(SMgrRelation *smgr_reln, int nlocators)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* drop all the buffers for a particular relation fork */
|
/* drop all the buffers for a particular relation fork */
|
||||||
FindAndDropRelFileLocatorBuffers(rels[i]->smgr_rlocator.locator,
|
FindAndDropRelationBuffers(rels[i]->smgr_rlocator.locator,
|
||||||
j, block[i][j], 0);
|
j, block[i][j], 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3291,7 +3290,7 @@ DropRelFileLocatorsAllBuffers(SMgrRelation *smgr_reln, int nlocators)
|
|||||||
uint32 buf_state;
|
uint32 buf_state;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* As in DropRelFileLocatorBuffers, an unlocked precheck should be
|
* As in DropRelationBuffers, an unlocked precheck should be
|
||||||
* safe and saves some cycles.
|
* safe and saves some cycles.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -3331,7 +3330,7 @@ DropRelFileLocatorsAllBuffers(SMgrRelation *smgr_reln, int nlocators)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------
|
/* ---------------------------------------------------------------------
|
||||||
* FindAndDropRelFileLocatorBuffers
|
* FindAndDropRelationBuffers
|
||||||
*
|
*
|
||||||
* This function performs look up in BufMapping table and removes from the
|
* This function performs look up in BufMapping table and removes from the
|
||||||
* buffer pool all the pages of the specified relation fork that has block
|
* buffer pool all the pages of the specified relation fork that has block
|
||||||
@ -3340,7 +3339,7 @@ DropRelFileLocatorsAllBuffers(SMgrRelation *smgr_reln, int nlocators)
|
|||||||
* --------------------------------------------------------------------
|
* --------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
FindAndDropRelFileLocatorBuffers(RelFileLocator rlocator, ForkNumber forkNum,
|
FindAndDropRelationBuffers(RelFileLocator rlocator, ForkNumber forkNum,
|
||||||
BlockNumber nForkBlock,
|
BlockNumber nForkBlock,
|
||||||
BlockNumber firstDelBlock)
|
BlockNumber firstDelBlock)
|
||||||
{
|
{
|
||||||
@ -3397,7 +3396,7 @@ FindAndDropRelFileLocatorBuffers(RelFileLocator rlocator, ForkNumber forkNum,
|
|||||||
* bothering to write them out first. This is used when we destroy a
|
* bothering to write them out first. This is used when we destroy a
|
||||||
* database, to avoid trying to flush data to disk when the directory
|
* database, to avoid trying to flush data to disk when the directory
|
||||||
* tree no longer exists. Implementation is pretty similar to
|
* tree no longer exists. Implementation is pretty similar to
|
||||||
* DropRelFileLocatorBuffers() which is for destroying just one relation.
|
* DropRelationBuffers() which is for destroying just one relation.
|
||||||
* --------------------------------------------------------------------
|
* --------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
@ -3416,7 +3415,7 @@ DropDatabaseBuffers(Oid dbid)
|
|||||||
uint32 buf_state;
|
uint32 buf_state;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* As in DropRelFileLocatorBuffers, an unlocked precheck should be
|
* As in DropRelationBuffers, an unlocked precheck should be
|
||||||
* safe and saves some cycles.
|
* safe and saves some cycles.
|
||||||
*/
|
*/
|
||||||
if (bufHdr->tag.rlocator.dbOid != dbid)
|
if (bufHdr->tag.rlocator.dbOid != dbid)
|
||||||
@ -3561,7 +3560,7 @@ FlushRelationBuffers(Relation rel)
|
|||||||
bufHdr = GetBufferDescriptor(i);
|
bufHdr = GetBufferDescriptor(i);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* As in DropRelFileLocatorBuffers, an unlocked precheck should be
|
* As in DropRelationBuffers, an unlocked precheck should be
|
||||||
* safe and saves some cycles.
|
* safe and saves some cycles.
|
||||||
*/
|
*/
|
||||||
if (!RelFileLocatorEquals(bufHdr->tag.rlocator, rel->rd_locator))
|
if (!RelFileLocatorEquals(bufHdr->tag.rlocator, rel->rd_locator))
|
||||||
@ -3616,7 +3615,7 @@ FlushRelationsAllBuffers(SMgrRelation *smgrs, int nrels)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Save the bsearch overhead for low number of relations to sync. See
|
* Save the bsearch overhead for low number of relations to sync. See
|
||||||
* DropRelFileLocatorsAllBuffers for details.
|
* DropRelationsAllBuffers for details.
|
||||||
*/
|
*/
|
||||||
use_bsearch = nrels > RELS_BSEARCH_THRESHOLD;
|
use_bsearch = nrels > RELS_BSEARCH_THRESHOLD;
|
||||||
|
|
||||||
@ -3634,7 +3633,7 @@ FlushRelationsAllBuffers(SMgrRelation *smgrs, int nrels)
|
|||||||
uint32 buf_state;
|
uint32 buf_state;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* As in DropRelFileLocatorBuffers, an unlocked precheck should be
|
* As in DropRelationBuffers, an unlocked precheck should be
|
||||||
* safe and saves some cycles.
|
* safe and saves some cycles.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -3864,7 +3863,7 @@ FlushDatabaseBuffers(Oid dbid)
|
|||||||
bufHdr = GetBufferDescriptor(i);
|
bufHdr = GetBufferDescriptor(i);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* As in DropRelFileLocatorBuffers, an unlocked precheck should be
|
* As in DropRelationBuffers, an unlocked precheck should be
|
||||||
* safe and saves some cycles.
|
* safe and saves some cycles.
|
||||||
*/
|
*/
|
||||||
if (bufHdr->tag.rlocator.dbOid != dbid)
|
if (bufHdr->tag.rlocator.dbOid != dbid)
|
||||||
|
@ -312,7 +312,7 @@ MarkLocalBufferDirty(Buffer buffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DropRelFileLocatorLocalBuffers
|
* DropRelationLocalBuffers
|
||||||
* This function removes from the buffer pool all the pages of the
|
* This function removes from the buffer pool all the pages of the
|
||||||
* specified relation that have block numbers >= firstDelBlock.
|
* specified relation that have block numbers >= firstDelBlock.
|
||||||
* (In particular, with firstDelBlock = 0, all pages are removed.)
|
* (In particular, with firstDelBlock = 0, all pages are removed.)
|
||||||
@ -320,10 +320,10 @@ MarkLocalBufferDirty(Buffer buffer)
|
|||||||
* out first. Therefore, this is NOT rollback-able, and so should be
|
* out first. Therefore, this is NOT rollback-able, and so should be
|
||||||
* used only with extreme caution!
|
* used only with extreme caution!
|
||||||
*
|
*
|
||||||
* See DropRelFileLocatorBuffers in bufmgr.c for more notes.
|
* See DropRelationBuffers in bufmgr.c for more notes.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
DropRelFileLocatorLocalBuffers(RelFileLocator rlocator, ForkNumber forkNum,
|
DropRelationLocalBuffers(RelFileLocator rlocator, ForkNumber forkNum,
|
||||||
BlockNumber firstDelBlock)
|
BlockNumber firstDelBlock)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -363,14 +363,14 @@ DropRelFileLocatorLocalBuffers(RelFileLocator rlocator, ForkNumber forkNum,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DropRelFileLocatorAllLocalBuffers
|
* DropRelationAllLocalBuffers
|
||||||
* This function removes from the buffer pool all pages of all forks
|
* This function removes from the buffer pool all pages of all forks
|
||||||
* of the specified relation.
|
* of the specified relation.
|
||||||
*
|
*
|
||||||
* See DropRelFileLocatorsAllBuffers in bufmgr.c for more notes.
|
* See DropRelationsAllBuffers in bufmgr.c for more notes.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
DropRelFileLocatorAllLocalBuffers(RelFileLocator rlocator)
|
DropRelationAllLocalBuffers(RelFileLocator rlocator)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -589,7 +589,7 @@ AtProcExit_LocalBuffers(void)
|
|||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* We shouldn't be holding any remaining pins; if we are, and assertions
|
* We shouldn't be holding any remaining pins; if we are, and assertions
|
||||||
* aren't enabled, we'll fail later in DropRelFileLocatorBuffers while
|
* aren't enabled, we'll fail later in DropRelationBuffers while
|
||||||
* trying to drop the temp rels.
|
* trying to drop the temp rels.
|
||||||
*/
|
*/
|
||||||
CheckForLocalBufferLeaks();
|
CheckForLocalBufferLeaks();
|
||||||
|
@ -430,7 +430,7 @@ smgrdounlinkall(SMgrRelation *rels, int nrels, bool isRedo)
|
|||||||
* Get rid of any remaining buffers for the relations. bufmgr will just
|
* Get rid of any remaining buffers for the relations. bufmgr will just
|
||||||
* drop them without bothering to write the contents.
|
* drop them without bothering to write the contents.
|
||||||
*/
|
*/
|
||||||
DropRelFileLocatorsAllBuffers(rels, nrels);
|
DropRelationsAllBuffers(rels, nrels);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* create an array which contains all relations to be dropped, and close
|
* create an array which contains all relations to be dropped, and close
|
||||||
@ -631,7 +631,7 @@ smgrtruncate(SMgrRelation reln, ForkNumber *forknum, int nforks, BlockNumber *nb
|
|||||||
* Get rid of any buffers for the about-to-be-deleted blocks. bufmgr will
|
* Get rid of any buffers for the about-to-be-deleted blocks. bufmgr will
|
||||||
* just drop them without bothering to write the contents.
|
* just drop them without bothering to write the contents.
|
||||||
*/
|
*/
|
||||||
DropRelFileLocatorBuffers(reln, forknum, nforks, nblocks);
|
DropRelationBuffers(reln, forknum, nforks, nblocks);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Send a shared-inval message to force other backends to close any smgr
|
* Send a shared-inval message to force other backends to close any smgr
|
||||||
|
@ -337,9 +337,10 @@ extern PrefetchBufferResult PrefetchLocalBuffer(SMgrRelation smgr,
|
|||||||
extern BufferDesc *LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum,
|
extern BufferDesc *LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum,
|
||||||
BlockNumber blockNum, bool *foundPtr);
|
BlockNumber blockNum, bool *foundPtr);
|
||||||
extern void MarkLocalBufferDirty(Buffer buffer);
|
extern void MarkLocalBufferDirty(Buffer buffer);
|
||||||
extern void DropRelFileLocatorLocalBuffers(RelFileLocator rlocator, ForkNumber forkNum,
|
extern void DropRelationLocalBuffers(RelFileLocator rlocator,
|
||||||
|
ForkNumber forkNum,
|
||||||
BlockNumber firstDelBlock);
|
BlockNumber firstDelBlock);
|
||||||
extern void DropRelFileLocatorAllLocalBuffers(RelFileLocator rlocator);
|
extern void DropRelationAllLocalBuffers(RelFileLocator rlocator);
|
||||||
extern void AtEOXact_LocalBuffers(bool isCommit);
|
extern void AtEOXact_LocalBuffers(bool isCommit);
|
||||||
|
|
||||||
#endif /* BUFMGR_INTERNALS_H */
|
#endif /* BUFMGR_INTERNALS_H */
|
||||||
|
@ -208,10 +208,10 @@ extern void CreateAndCopyRelationData(RelFileLocator src_rlocator,
|
|||||||
RelFileLocator dst_rlocator,
|
RelFileLocator dst_rlocator,
|
||||||
bool permanent);
|
bool permanent);
|
||||||
extern void FlushDatabaseBuffers(Oid dbid);
|
extern void FlushDatabaseBuffers(Oid dbid);
|
||||||
extern void DropRelFileLocatorBuffers(struct SMgrRelationData *smgr_reln,
|
extern void DropRelationBuffers(struct SMgrRelationData *smgr_reln,
|
||||||
ForkNumber *forkNum,
|
ForkNumber *forkNum,
|
||||||
int nforks, BlockNumber *firstDelBlock);
|
int nforks, BlockNumber *firstDelBlock);
|
||||||
extern void DropRelFileLocatorsAllBuffers(struct SMgrRelationData **smgr_reln,
|
extern void DropRelationsAllBuffers(struct SMgrRelationData **smgr_reln,
|
||||||
int nlocators);
|
int nlocators);
|
||||||
extern void DropDatabaseBuffers(Oid dbid);
|
extern void DropDatabaseBuffers(Oid dbid);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user