mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-03-19 20:00:51 +08:00
Add is_analyze parameter to vacuum_delay_point().
This function is used in both vacuum and analyze code paths, and a follow-up commit will require distinguishing between the two. This commit forces callers to specify whether they are in a vacuum or analyze path, but it does not use that information for anything yet. Author: Nathan Bossart <nathandbossart@gmail.com> Co-authored-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Discussion: https://postgr.es/m/ZmaXmWDL829fzAVX%40ip-10-97-1-34.eu-west-3.compute.internal
This commit is contained in:
parent
d0d649e916
commit
e5b0b0ce15
@ -57,7 +57,7 @@ blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
|
||||
*itupPtr,
|
||||
*itupEnd;
|
||||
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(false);
|
||||
|
||||
buffer = ReadBufferExtended(index, MAIN_FORKNUM, blkno,
|
||||
RBM_NORMAL, info->strategy);
|
||||
@ -187,7 +187,7 @@ blvacuumcleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats)
|
||||
Buffer buffer;
|
||||
Page page;
|
||||
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(false);
|
||||
|
||||
buffer = ReadBufferExtended(index, MAIN_FORKNUM, blkno,
|
||||
RBM_NORMAL, info->strategy);
|
||||
|
@ -1237,7 +1237,7 @@ file_acquire_sample_rows(Relation onerel, int elevel,
|
||||
for (;;)
|
||||
{
|
||||
/* Check for user-requested abort or sleep */
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(true);
|
||||
|
||||
/* Fetch next row */
|
||||
MemoryContextReset(tupcontext);
|
||||
|
@ -892,7 +892,7 @@ ginInsertCleanup(GinState *ginstate, bool full_clean,
|
||||
*/
|
||||
processPendingPage(&accum, &datums, page, FirstOffsetNumber);
|
||||
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(false);
|
||||
|
||||
/*
|
||||
* Is it time to flush memory to disk? Flush if we are at the end of
|
||||
@ -929,7 +929,7 @@ ginInsertCleanup(GinState *ginstate, bool full_clean,
|
||||
{
|
||||
ginEntryInsert(ginstate, attnum, key, category,
|
||||
list, nlist, NULL);
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(false);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1002,7 +1002,7 @@ ginInsertCleanup(GinState *ginstate, bool full_clean,
|
||||
/*
|
||||
* Read next page in pending list
|
||||
*/
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(false);
|
||||
buffer = ReadBuffer(index, blkno);
|
||||
LockBuffer(buffer, GIN_SHARE);
|
||||
page = BufferGetPage(buffer);
|
||||
|
@ -662,12 +662,12 @@ ginbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
|
||||
UnlockReleaseBuffer(buffer);
|
||||
}
|
||||
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(false);
|
||||
|
||||
for (i = 0; i < nRoot; i++)
|
||||
{
|
||||
ginVacuumPostingTree(&gvs, rootOfPostingTree[i]);
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(false);
|
||||
}
|
||||
|
||||
if (blkno == InvalidBlockNumber) /* rightmost page */
|
||||
@ -748,7 +748,7 @@ ginvacuumcleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats)
|
||||
Buffer buffer;
|
||||
Page page;
|
||||
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(false);
|
||||
|
||||
buffer = ReadBufferExtended(index, MAIN_FORKNUM, blkno,
|
||||
RBM_NORMAL, info->strategy);
|
||||
|
@ -283,7 +283,7 @@ restart:
|
||||
recurse_to = InvalidBlockNumber;
|
||||
|
||||
/* call vacuum_delay_point while not holding any buffer lock */
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(false);
|
||||
|
||||
buffer = ReadBufferExtended(rel, MAIN_FORKNUM, blkno, RBM_NORMAL,
|
||||
info->strategy);
|
||||
|
@ -716,7 +716,7 @@ hashbucketcleanup(Relation rel, Bucket cur_bucket, Buffer bucket_buf,
|
||||
bool retain_pin = false;
|
||||
bool clear_dead_marking = false;
|
||||
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(false);
|
||||
|
||||
page = BufferGetPage(buf);
|
||||
opaque = HashPageGetOpaque(page);
|
||||
|
@ -1214,7 +1214,7 @@ lazy_scan_heap(LVRelState *vacrel)
|
||||
update_vacuum_error_info(vacrel, NULL, VACUUM_ERRCB_PHASE_SCAN_HEAP,
|
||||
blkno, InvalidOffsetNumber);
|
||||
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(false);
|
||||
|
||||
/*
|
||||
* Regularly check if wraparound failsafe should trigger.
|
||||
@ -2646,7 +2646,7 @@ lazy_vacuum_heap_rel(LVRelState *vacrel)
|
||||
OffsetNumber offsets[MaxOffsetNumber];
|
||||
int num_offsets;
|
||||
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(false);
|
||||
|
||||
blkno = iter_result->blkno;
|
||||
vacrel->blkno = blkno;
|
||||
|
@ -1137,7 +1137,7 @@ backtrack:
|
||||
backtrack_to = P_NONE;
|
||||
|
||||
/* call vacuum_delay_point while not holding any buffer lock */
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(false);
|
||||
|
||||
/*
|
||||
* We can't use _bt_getbuf() here because it always applies
|
||||
|
@ -625,7 +625,7 @@ spgvacuumpage(spgBulkDeleteState *bds, BlockNumber blkno)
|
||||
Page page;
|
||||
|
||||
/* call vacuum_delay_point while not holding any buffer lock */
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(false);
|
||||
|
||||
buffer = ReadBufferExtended(index, MAIN_FORKNUM, blkno,
|
||||
RBM_NORMAL, bds->info->strategy);
|
||||
@ -704,7 +704,7 @@ spgprocesspending(spgBulkDeleteState *bds)
|
||||
continue; /* ignore already-done items */
|
||||
|
||||
/* call vacuum_delay_point while not holding any buffer lock */
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(false);
|
||||
|
||||
/* examine the referenced page */
|
||||
blkno = ItemPointerGetBlockNumber(&pitem->tid);
|
||||
|
@ -915,7 +915,7 @@ compute_index_stats(Relation onerel, double totalrows,
|
||||
{
|
||||
HeapTuple heapTuple = rows[rowno];
|
||||
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(true);
|
||||
|
||||
/*
|
||||
* Reset the per-tuple context each time, to reclaim any cruft
|
||||
@ -1238,7 +1238,7 @@ acquire_sample_rows(Relation onerel, int elevel,
|
||||
/* Outer loop over blocks to sample */
|
||||
while (table_scan_analyze_next_block(scan, stream))
|
||||
{
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(true);
|
||||
|
||||
while (table_scan_analyze_next_tuple(scan, OldestXmin, &liverows, &deadrows, slot))
|
||||
{
|
||||
@ -1970,7 +1970,7 @@ compute_trivial_stats(VacAttrStatsP stats,
|
||||
Datum value;
|
||||
bool isnull;
|
||||
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(true);
|
||||
|
||||
value = fetchfunc(stats, i, &isnull);
|
||||
|
||||
@ -2086,7 +2086,7 @@ compute_distinct_stats(VacAttrStatsP stats,
|
||||
int firstcount1,
|
||||
j;
|
||||
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(true);
|
||||
|
||||
value = fetchfunc(stats, i, &isnull);
|
||||
|
||||
@ -2433,7 +2433,7 @@ compute_scalar_stats(VacAttrStatsP stats,
|
||||
Datum value;
|
||||
bool isnull;
|
||||
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(true);
|
||||
|
||||
value = fetchfunc(stats, i, &isnull);
|
||||
|
||||
|
@ -2373,7 +2373,7 @@ vac_close_indexes(int nindexes, Relation *Irel, LOCKMODE lockmode)
|
||||
* typically once per page processed.
|
||||
*/
|
||||
void
|
||||
vacuum_delay_point(void)
|
||||
vacuum_delay_point(bool is_analyze)
|
||||
{
|
||||
double msec = 0;
|
||||
|
||||
|
@ -204,7 +204,7 @@ compute_tsvector_stats(VacAttrStats *stats,
|
||||
char *lexemesptr;
|
||||
int j;
|
||||
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(true);
|
||||
|
||||
value = fetchfunc(stats, vector_no, &isnull);
|
||||
|
||||
|
@ -314,7 +314,7 @@ compute_array_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
|
||||
int distinct_count;
|
||||
bool count_item_found;
|
||||
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(true);
|
||||
|
||||
value = fetchfunc(stats, array_no, &isnull);
|
||||
if (isnull)
|
||||
|
@ -167,7 +167,7 @@ compute_range_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
|
||||
upper;
|
||||
float8 length;
|
||||
|
||||
vacuum_delay_point();
|
||||
vacuum_delay_point(true);
|
||||
|
||||
value = fetchfunc(stats, range_no, &isnull);
|
||||
if (isnull)
|
||||
|
@ -356,7 +356,7 @@ extern bool vacuum_get_cutoffs(Relation rel, const VacuumParams *params,
|
||||
struct VacuumCutoffs *cutoffs);
|
||||
extern bool vacuum_xid_failsafe_check(const struct VacuumCutoffs *cutoffs);
|
||||
extern void vac_update_datfrozenxid(void);
|
||||
extern void vacuum_delay_point(void);
|
||||
extern void vacuum_delay_point(bool is_analyze);
|
||||
extern bool vacuum_is_permitted_for_relation(Oid relid, Form_pg_class reltuple,
|
||||
bits32 options);
|
||||
extern Relation vacuum_open_relation(Oid relid, RangeVar *relation,
|
||||
|
Loading…
x
Reference in New Issue
Block a user