Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf41551f

Browse files
committed
Fold vacuum's 'int options' parameter into VacuumParams.
Many places need both, so this allows a few functions to take onefewer parameter. More importantly, as soon as we add a VACUUMoption that takes a non-Boolean parameter, we need to replace'int options' with a struct, and it seems better to thinkof adding more fields to VacuumParams rather than passing aroundboth VacuumParams and a separate struct as well.Patch by me, reviewed by Masahiko SawadaDiscussion:http://postgr.es/m/CA+Tgmob6g6-s50fyv8E8he7APfwCYYJ4z0wbZC2yZeSz=26CYQ@mail.gmail.com
1 parent1ffa59a commitf41551f

File tree

6 files changed

+63
-63
lines changed

6 files changed

+63
-63
lines changed

‎src/backend/access/heap/vacuumlazy.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static bool heap_page_is_all_visible(Relation rel, Buffer buf,
186186
*and locked the relation.
187187
*/
188188
void
189-
heap_vacuum_rel(Relationonerel,intoptions,VacuumParams*params,
189+
heap_vacuum_rel(Relationonerel,VacuumParams*params,
190190
BufferAccessStrategybstrategy)
191191
{
192192
LVRelStats*vacrelstats;
@@ -217,7 +217,7 @@ heap_vacuum_rel(Relation onerel, int options, VacuumParams *params,
217217
starttime=GetCurrentTimestamp();
218218
}
219219

220-
if (options&VACOPT_VERBOSE)
220+
if (params->options&VACOPT_VERBOSE)
221221
elevel=INFO;
222222
else
223223
elevel=DEBUG2;
@@ -245,7 +245,7 @@ heap_vacuum_rel(Relation onerel, int options, VacuumParams *params,
245245
xidFullScanLimit);
246246
aggressive |=MultiXactIdPrecedesOrEquals(onerel->rd_rel->relminmxid,
247247
mxactFullScanLimit);
248-
if (options&VACOPT_DISABLE_PAGE_SKIPPING)
248+
if (params->options&VACOPT_DISABLE_PAGE_SKIPPING)
249249
aggressive= true;
250250

251251
vacrelstats= (LVRelStats*)palloc0(sizeof(LVRelStats));
@@ -261,7 +261,7 @@ heap_vacuum_rel(Relation onerel, int options, VacuumParams *params,
261261
vacrelstats->hasindex= (nindexes>0);
262262

263263
/* Do the vacuuming */
264-
lazy_scan_heap(onerel,options,vacrelstats,Irel,nindexes,aggressive);
264+
lazy_scan_heap(onerel,params->options,vacrelstats,Irel,nindexes,aggressive);
265265

266266
/* Done with indexes */
267267
vac_close_indexes(nindexes,Irel,NoLock);

‎src/backend/commands/analyze.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static MemoryContext anl_context = NULL;
8484
staticBufferAccessStrategyvac_strategy;
8585

8686

87-
staticvoiddo_analyze_rel(Relationonerel,intoptions,
87+
staticvoiddo_analyze_rel(Relationonerel,
8888
VacuumParams*params,List*va_cols,
8989
AcquireSampleRowsFuncacquirefunc,BlockNumberrelpages,
9090
boolinh,boolin_outer_xact,intelevel);
@@ -115,7 +115,7 @@ static Datum ind_fetch_func(VacAttrStatsP stats, int rownum, bool *isNull);
115115
* use it once we've successfully opened the rel, since it might be stale.
116116
*/
117117
void
118-
analyze_rel(Oidrelid,RangeVar*relation,intoptions,
118+
analyze_rel(Oidrelid,RangeVar*relation,
119119
VacuumParams*params,List*va_cols,boolin_outer_xact,
120120
BufferAccessStrategybstrategy)
121121
{
@@ -125,7 +125,7 @@ analyze_rel(Oid relid, RangeVar *relation, int options,
125125
BlockNumberrelpages=0;
126126

127127
/* Select logging level */
128-
if (options&VACOPT_VERBOSE)
128+
if (params->options&VACOPT_VERBOSE)
129129
elevel=INFO;
130130
else
131131
elevel=DEBUG2;
@@ -147,8 +147,8 @@ analyze_rel(Oid relid, RangeVar *relation, int options,
147147
*
148148
* Make sure to generate only logs for ANALYZE in this case.
149149
*/
150-
onerel=vacuum_open_relation(relid,relation,params,
151-
options& ~(VACOPT_VACUUM),
150+
onerel=vacuum_open_relation(relid,relation,params->options& ~(VACOPT_VACUUM),
151+
params->log_min_duration >=0,
152152
ShareUpdateExclusiveLock);
153153

154154
/* leave if relation could not be opened or locked */
@@ -165,7 +165,7 @@ analyze_rel(Oid relid, RangeVar *relation, int options,
165165
*/
166166
if (!vacuum_is_relation_owner(RelationGetRelid(onerel),
167167
onerel->rd_rel,
168-
options&VACOPT_ANALYZE))
168+
params->options&VACOPT_ANALYZE))
169169
{
170170
relation_close(onerel,ShareUpdateExclusiveLock);
171171
return;
@@ -237,7 +237,7 @@ analyze_rel(Oid relid, RangeVar *relation, int options,
237237
else
238238
{
239239
/* No need for a WARNING if we already complained during VACUUM */
240-
if (!(options&VACOPT_VACUUM))
240+
if (!(params->options&VACOPT_VACUUM))
241241
ereport(WARNING,
242242
(errmsg("skipping \"%s\" --- cannot analyze non-tables or special system tables",
243243
RelationGetRelationName(onerel))));
@@ -257,14 +257,14 @@ analyze_rel(Oid relid, RangeVar *relation, int options,
257257
* tables, which don't contain any rows.
258258
*/
259259
if (onerel->rd_rel->relkind!=RELKIND_PARTITIONED_TABLE)
260-
do_analyze_rel(onerel,options,params,va_cols,acquirefunc,
260+
do_analyze_rel(onerel,params,va_cols,acquirefunc,
261261
relpages, false,in_outer_xact,elevel);
262262

263263
/*
264264
* If there are child tables, do recursive ANALYZE.
265265
*/
266266
if (onerel->rd_rel->relhassubclass)
267-
do_analyze_rel(onerel,options,params,va_cols,acquirefunc,relpages,
267+
do_analyze_rel(onerel,params,va_cols,acquirefunc,relpages,
268268
true,in_outer_xact,elevel);
269269

270270
/*
@@ -292,7 +292,7 @@ analyze_rel(Oid relid, RangeVar *relation, int options,
292292
* appropriate acquirefunc for each child table.
293293
*/
294294
staticvoid
295-
do_analyze_rel(Relationonerel,intoptions,VacuumParams*params,
295+
do_analyze_rel(Relationonerel,VacuumParams*params,
296296
List*va_cols,AcquireSampleRowsFuncacquirefunc,
297297
BlockNumberrelpages,boolinh,boolin_outer_xact,
298298
intelevel)
@@ -603,7 +603,7 @@ do_analyze_rel(Relation onerel, int options, VacuumParams *params,
603603
* VACUUM ANALYZE, don't overwrite the accurate count already inserted by
604604
* VACUUM.
605605
*/
606-
if (!inh&& !(options&VACOPT_VACUUM))
606+
if (!inh&& !(params->options&VACOPT_VACUUM))
607607
{
608608
for (ind=0;ind<nindexes;ind++)
609609
{
@@ -634,7 +634,7 @@ do_analyze_rel(Relation onerel, int options, VacuumParams *params,
634634
(va_cols==NIL));
635635

636636
/* If this isn't part of VACUUM ANALYZE, let index AMs do cleanup */
637-
if (!(options&VACOPT_VACUUM))
637+
if (!(params->options&VACOPT_VACUUM))
638638
{
639639
for (ind=0;ind<nindexes;ind++)
640640
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp