Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a349b86

Browse files
Move heaprel struct field next to index rel field.
Commit 61b313e added a heaprel struct member to IndexVacuumInfo, but placed it last. Move the heaprel struct member next to the index struct member to improve the code's readability. Author: Peter Geoghegan <pg@bowt.ie> Discussion: https://postgr.es/m/CAH2-WznG=TV6S9d3VA=y0vBHbXwnLs9_LLdiML=aNJuHeriwxg@mail.gmail.com
1 parent e7e7da2 commit a349b86

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

src/backend/access/heap/vacuumlazy.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -2711,13 +2711,13 @@ lazy_vacuum_one_index(Relation indrel, IndexBulkDeleteResult *istat,
27112711
LVSavedErrInfo saved_err_info;
27122712

27132713
ivinfo.index = indrel;
2714+
ivinfo.heaprel = vacrel->rel;
27142715
ivinfo.analyze_only = false;
27152716
ivinfo.report_progress = false;
27162717
ivinfo.estimated_count = true;
27172718
ivinfo.message_level = DEBUG2;
27182719
ivinfo.num_heap_tuples = reltuples;
27192720
ivinfo.strategy = vacrel->bstrategy;
2720-
ivinfo.heaprel = vacrel->rel;
27212721

27222722
/*
27232723
* Update error traceback information.
@@ -2760,14 +2760,14 @@ lazy_cleanup_one_index(Relation indrel, IndexBulkDeleteResult *istat,
27602760
LVSavedErrInfo saved_err_info;
27612761

27622762
ivinfo.index = indrel;
2763+
ivinfo.heaprel = vacrel->rel;
27632764
ivinfo.analyze_only = false;
27642765
ivinfo.report_progress = false;
27652766
ivinfo.estimated_count = estimated_count;
27662767
ivinfo.message_level = DEBUG2;
27672768

27682769
ivinfo.num_heap_tuples = reltuples;
27692770
ivinfo.strategy = vacrel->bstrategy;
2770-
ivinfo.heaprel = vacrel->rel;
27712771

27722772
/*
27732773
* Update error traceback information.

src/backend/catalog/index.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -3358,13 +3358,13 @@ validate_index(Oid heapId, Oid indexId, Snapshot snapshot)
33583358
* Scan the index and gather up all the TIDs into a tuplesort object.
33593359
*/
33603360
ivinfo.index = indexRelation;
3361+
ivinfo.heaprel = heapRelation;
33613362
ivinfo.analyze_only = false;
33623363
ivinfo.report_progress = true;
33633364
ivinfo.estimated_count = true;
33643365
ivinfo.message_level = DEBUG2;
33653366
ivinfo.num_heap_tuples = heapRelation->rd_rel->reltuples;
33663367
ivinfo.strategy = NULL;
3367-
ivinfo.heaprel = heapRelation;
33683368

33693369
/*
33703370
* Encode TIDs as int8 values for the sort, rather than directly sorting

src/backend/commands/analyze.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -707,12 +707,12 @@ do_analyze_rel(Relation onerel, VacuumParams *params,
707707
IndexVacuumInfo ivinfo;
708708

709709
ivinfo.index = Irel[ind];
710+
ivinfo.heaprel = onerel;
710711
ivinfo.analyze_only = true;
711712
ivinfo.estimated_count = true;
712713
ivinfo.message_level = elevel;
713714
ivinfo.num_heap_tuples = onerel->rd_rel->reltuples;
714715
ivinfo.strategy = vac_strategy;
715-
ivinfo.heaprel = onerel;
716716

717717
stats = index_vacuum_cleanup(&ivinfo, NULL);
718718

src/backend/commands/vacuumparallel.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -836,13 +836,13 @@ parallel_vacuum_process_one_index(ParallelVacuumState *pvs, Relation indrel,
836836
istat = &(indstats->istat);
837837

838838
ivinfo.index = indrel;
839+
ivinfo.heaprel = pvs->heaprel;
839840
ivinfo.analyze_only = false;
840841
ivinfo.report_progress = false;
841842
ivinfo.message_level = DEBUG2;
842843
ivinfo.estimated_count = pvs->shared->estimated_count;
843844
ivinfo.num_heap_tuples = pvs->shared->reltuples;
844845
ivinfo.strategy = pvs->bstrategy;
845-
ivinfo.heaprel = pvs->heaprel;
846846

847847
/* Update error traceback information */
848848
pvs->indname = pstrdup(RelationGetRelationName(indrel));

src/include/access/genam.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ typedef struct IndexBuildResult
4444
typedef struct IndexVacuumInfo
4545
{
4646
Relation index; /* the index being vacuumed */
47+
Relation heaprel; /* the heap relation the index belongs to */
4748
bool analyze_only; /* ANALYZE (without any actual vacuum) */
4849
bool report_progress; /* emit progress.h status reports */
4950
bool estimated_count; /* num_heap_tuples is an estimate */
5051
int message_level; /* ereport level for progress messages */
5152
double num_heap_tuples; /* tuples remaining in heap */
5253
BufferAccessStrategy strategy; /* access strategy for reads */
53-
Relation heaprel; /* the heap relation the index belongs to */
5454
} IndexVacuumInfo;
5555

5656
/*

0 commit comments

Comments
 (0)