@@ -423,7 +423,7 @@ typedef struct LVSavedErrInfo
423
423
/* non-export function prototypes */
424
424
static void lazy_scan_heap (LVRelState * vacrel );
425
425
static void heap_vacuum_eager_scan_setup (LVRelState * vacrel ,
426
- VacuumParams * params );
426
+ const VacuumParams params );
427
427
static BlockNumber heap_vac_scan_next_block (ReadStream * stream ,
428
428
void * callback_private_data ,
429
429
void * per_buffer_data );
@@ -485,7 +485,7 @@ static void restore_vacuum_error_info(LVRelState *vacrel,
485
485
* vacuum options or for relfrozenxid/relminmxid advancement.
486
486
*/
487
487
static void
488
- heap_vacuum_eager_scan_setup (LVRelState * vacrel , VacuumParams * params )
488
+ heap_vacuum_eager_scan_setup (LVRelState * vacrel , const VacuumParams params )
489
489
{
490
490
uint32 randseed ;
491
491
BlockNumber allvisible ;
@@ -504,7 +504,7 @@ heap_vacuum_eager_scan_setup(LVRelState *vacrel, VacuumParams *params)
504
504
vacrel -> eager_scan_remaining_successes = 0 ;
505
505
506
506
/* If eager scanning is explicitly disabled, just return. */
507
- if (params -> max_eager_freeze_failure_rate == 0 )
507
+ if (params . max_eager_freeze_failure_rate == 0 )
508
508
return ;
509
509
510
510
/*
@@ -581,11 +581,11 @@ heap_vacuum_eager_scan_setup(LVRelState *vacrel, VacuumParams *params)
581
581
582
582
vacrel -> next_eager_scan_region_start = randseed % EAGER_SCAN_REGION_SIZE ;
583
583
584
- Assert (params -> max_eager_freeze_failure_rate > 0 &&
585
- params -> max_eager_freeze_failure_rate <= 1 );
584
+ Assert (params . max_eager_freeze_failure_rate > 0 &&
585
+ params . max_eager_freeze_failure_rate <= 1 );
586
586
587
587
vacrel -> eager_scan_max_fails_per_region =
588
- params -> max_eager_freeze_failure_rate *
588
+ params . max_eager_freeze_failure_rate *
589
589
EAGER_SCAN_REGION_SIZE ;
590
590
591
591
/*
@@ -612,7 +612,7 @@ heap_vacuum_eager_scan_setup(LVRelState *vacrel, VacuumParams *params)
612
612
* and locked the relation.
613
613
*/
614
614
void
615
- heap_vacuum_rel (Relation rel , VacuumParams * params ,
615
+ heap_vacuum_rel (Relation rel , const VacuumParams params ,
616
616
BufferAccessStrategy bstrategy )
617
617
{
618
618
LVRelState * vacrel ;
@@ -634,9 +634,9 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
634
634
ErrorContextCallback errcallback ;
635
635
char * * indnames = NULL ;
636
636
637
- verbose = (params -> options & VACOPT_VERBOSE ) != 0 ;
637
+ verbose = (params . options & VACOPT_VERBOSE ) != 0 ;
638
638
instrument = (verbose || (AmAutoVacuumWorkerProcess () &&
639
- params -> log_min_duration >= 0 ));
639
+ params . log_min_duration >= 0 ));
640
640
if (instrument )
641
641
{
642
642
pg_rusage_init (& ru0 );
@@ -699,9 +699,9 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
699
699
* The truncate param allows user to avoid attempting relation truncation,
700
700
* though it can't force truncation to happen.
701
701
*/
702
- Assert (params -> index_cleanup != VACOPTVALUE_UNSPECIFIED );
703
- Assert (params -> truncate != VACOPTVALUE_UNSPECIFIED &&
704
- params -> truncate != VACOPTVALUE_AUTO );
702
+ Assert (params . index_cleanup != VACOPTVALUE_UNSPECIFIED );
703
+ Assert (params . truncate != VACOPTVALUE_UNSPECIFIED &&
704
+ params . truncate != VACOPTVALUE_AUTO );
705
705
706
706
/*
707
707
* While VacuumFailSafeActive is reset to false before calling this, we
@@ -711,22 +711,22 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
711
711
vacrel -> consider_bypass_optimization = true;
712
712
vacrel -> do_index_vacuuming = true;
713
713
vacrel -> do_index_cleanup = true;
714
- vacrel -> do_rel_truncate = (params -> truncate != VACOPTVALUE_DISABLED );
715
- if (params -> index_cleanup == VACOPTVALUE_DISABLED )
714
+ vacrel -> do_rel_truncate = (params . truncate != VACOPTVALUE_DISABLED );
715
+ if (params . index_cleanup == VACOPTVALUE_DISABLED )
716
716
{
717
717
/* Force disable index vacuuming up-front */
718
718
vacrel -> do_index_vacuuming = false;
719
719
vacrel -> do_index_cleanup = false;
720
720
}
721
- else if (params -> index_cleanup == VACOPTVALUE_ENABLED )
721
+ else if (params . index_cleanup == VACOPTVALUE_ENABLED )
722
722
{
723
723
/* Force index vacuuming. Note that failsafe can still bypass. */
724
724
vacrel -> consider_bypass_optimization = false;
725
725
}
726
726
else
727
727
{
728
728
/* Default/auto, make all decisions dynamically */
729
- Assert (params -> index_cleanup == VACOPTVALUE_AUTO );
729
+ Assert (params . index_cleanup == VACOPTVALUE_AUTO );
730
730
}
731
731
732
732
/* Initialize page counters explicitly (be tidy) */
@@ -789,7 +789,7 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
789
789
*/
790
790
vacrel -> skippedallvis = false;
791
791
skipwithvm = true;
792
- if (params -> options & VACOPT_DISABLE_PAGE_SKIPPING )
792
+ if (params . options & VACOPT_DISABLE_PAGE_SKIPPING )
793
793
{
794
794
/*
795
795
* Force aggressive mode, and disable skipping blocks using the
@@ -830,7 +830,7 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
830
830
* is already dangerously old.)
831
831
*/
832
832
lazy_check_wraparound_failsafe (vacrel );
833
- dead_items_alloc (vacrel , params -> nworkers );
833
+ dead_items_alloc (vacrel , params . nworkers );
834
834
835
835
/*
836
836
* Call lazy_scan_heap to perform all required heap pruning, index
@@ -947,9 +947,9 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
947
947
{
948
948
TimestampTz endtime = GetCurrentTimestamp ();
949
949
950
- if (verbose || params -> log_min_duration == 0 ||
950
+ if (verbose || params . log_min_duration == 0 ||
951
951
TimestampDifferenceExceeds (starttime , endtime ,
952
- params -> log_min_duration ))
952
+ params . log_min_duration ))
953
953
{
954
954
long secs_dur ;
955
955
int usecs_dur ;
@@ -984,10 +984,10 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
984
984
* Aggressiveness already reported earlier, in dedicated
985
985
* VACUUM VERBOSE ereport
986
986
*/
987
- Assert (!params -> is_wraparound );
987
+ Assert (!params . is_wraparound );
988
988
msgfmt = _ ("finished vacuuming \"%s.%s.%s\": index scans: %d\n" );
989
989
}
990
- else if (params -> is_wraparound )
990
+ else if (params . is_wraparound )
991
991
{
992
992
/*
993
993
* While it's possible for a VACUUM to be both is_wraparound
0 commit comments