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

Commit 1d71f3c

Browse files
committed
Improve confusing variable names
The prototype calls the second argument of pgstat_progress_update_multi_param() "index", and some callers name their local variable that way. But when the surrounding code deals with index relations, this is confusing, and in at least one case shadowed another variable that is referring to an index relation. Adjust those call sites to have clearer local variable naming, similar to existing callers in indexcmds.c.
1 parent 4ad31bb commit 1d71f3c

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/backend/access/nbtree/nbtsort.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -486,17 +486,17 @@ _bt_spools_heapscan(Relation heap, Relation index, BTBuildState *buildstate,
486486
* values set by table_index_build_scan
487487
*/
488488
{
489-
const int index[] = {
489+
const int progress_index[] = {
490490
PROGRESS_CREATEIDX_TUPLES_TOTAL,
491491
PROGRESS_SCAN_BLOCKS_TOTAL,
492492
PROGRESS_SCAN_BLOCKS_DONE
493493
};
494-
const int64 val[] = {
494+
const int64 progress_vals[] = {
495495
buildstate->indtuples,
496496
0, 0
497497
};
498498

499-
pgstat_progress_update_multi_param(3, index, val);
499+
pgstat_progress_update_multi_param(3, progress_index, progress_vals);
500500
}
501501

502502
/* okay, all heap tuples are spooled */

src/backend/catalog/index.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -3045,21 +3045,21 @@ index_build(Relation heapRelation,
30453045

30463046
/* Set up initial progress report status */
30473047
{
3048-
const int index[] = {
3048+
const int progress_index[] = {
30493049
PROGRESS_CREATEIDX_PHASE,
30503050
PROGRESS_CREATEIDX_SUBPHASE,
30513051
PROGRESS_CREATEIDX_TUPLES_DONE,
30523052
PROGRESS_CREATEIDX_TUPLES_TOTAL,
30533053
PROGRESS_SCAN_BLOCKS_DONE,
30543054
PROGRESS_SCAN_BLOCKS_TOTAL
30553055
};
3056-
const int64 val[] = {
3056+
const int64 progress_vals[] = {
30573057
PROGRESS_CREATEIDX_PHASE_BUILD,
30583058
PROGRESS_CREATEIDX_SUBPHASE_INITIALIZE,
30593059
0, 0, 0, 0
30603060
};
30613061

3062-
pgstat_progress_update_multi_param(6, index, val);
3062+
pgstat_progress_update_multi_param(6, progress_index, progress_vals);
30633063
}
30643064

30653065
/*
@@ -3351,19 +3351,19 @@ validate_index(Oid heapId, Oid indexId, Snapshot snapshot)
33513351
int save_nestlevel;
33523352

33533353
{
3354-
const int index[] = {
3354+
const int progress_index[] = {
33553355
PROGRESS_CREATEIDX_PHASE,
33563356
PROGRESS_CREATEIDX_TUPLES_DONE,
33573357
PROGRESS_CREATEIDX_TUPLES_TOTAL,
33583358
PROGRESS_SCAN_BLOCKS_DONE,
33593359
PROGRESS_SCAN_BLOCKS_TOTAL
33603360
};
3361-
const int64 val[] = {
3361+
const int64 progress_vals[] = {
33623362
PROGRESS_CREATEIDX_PHASE_VALIDATE_IDXSCAN,
33633363
0, 0, 0, 0
33643364
};
33653365

3366-
pgstat_progress_update_multi_param(5, index, val);
3366+
pgstat_progress_update_multi_param(5, progress_index, progress_vals);
33673367
}
33683368

33693369
/* Open and lock the parent heap relation */
@@ -3420,17 +3420,17 @@ validate_index(Oid heapId, Oid indexId, Snapshot snapshot)
34203420

34213421
/* Execute the sort */
34223422
{
3423-
const int index[] = {
3423+
const int progress_index[] = {
34243424
PROGRESS_CREATEIDX_PHASE,
34253425
PROGRESS_SCAN_BLOCKS_DONE,
34263426
PROGRESS_SCAN_BLOCKS_TOTAL
34273427
};
3428-
const int64 val[] = {
3428+
const int64 progress_vals[] = {
34293429
PROGRESS_CREATEIDX_PHASE_VALIDATE_SORT,
34303430
0, 0
34313431
};
34323432

3433-
pgstat_progress_update_multi_param(3, index, val);
3433+
pgstat_progress_update_multi_param(3, progress_index, progress_vals);
34343434
}
34353435
tuplesort_performsort(state.tuplesort);
34363436

0 commit comments

Comments
 (0)