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

Commit4220415

Browse files
committed
Fill CommonRdOptions with default values in extract_autovac_opts()
Reported-by: Thomas MunroReported-by: Pavel BorisovDiscussion:https://postgr.es/m/CA%2BhUKGLZzLR50RBvuqOO3MZ%3DF54ETz-rTp1PDX9uDGP_GqyYqA%40mail.gmail.com
1 parent3dbd2ff commit4220415

File tree

4 files changed

+31
-20
lines changed

4 files changed

+31
-20
lines changed

‎src/backend/access/common/reloptions.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,6 +2056,34 @@ view_reloptions(Datum reloptions, bool validate)
20562056
tab,lengthof(tab));
20572057
}
20582058

2059+
/*
2060+
* Fill CommonRdOptions with the default values.
2061+
*/
2062+
void
2063+
fill_default_common_reloptions(CommonRdOptions*common)
2064+
{
2065+
common->autovacuum.enabled= true;
2066+
common->autovacuum.vacuum_threshold=-1;
2067+
common->autovacuum.vacuum_ins_threshold=-2;
2068+
common->autovacuum.analyze_threshold=-1;
2069+
common->autovacuum.vacuum_cost_limit=-1;
2070+
common->autovacuum.freeze_min_age=-1;
2071+
common->autovacuum.freeze_max_age=-1;
2072+
common->autovacuum.freeze_table_age=-1;
2073+
common->autovacuum.multixact_freeze_min_age=-1;
2074+
common->autovacuum.multixact_freeze_max_age=-1;
2075+
common->autovacuum.multixact_freeze_table_age=-1;
2076+
common->autovacuum.log_min_duration=-1;
2077+
common->autovacuum.vacuum_cost_delay=-1;
2078+
common->autovacuum.vacuum_scale_factor=-1;
2079+
common->autovacuum.vacuum_ins_scale_factor=-1;
2080+
common->autovacuum.analyze_scale_factor=-1;
2081+
common->parallel_workers=-1;
2082+
common->user_catalog_table= false;
2083+
common->vacuum_index_cleanup=STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
2084+
common->vacuum_truncate= true;
2085+
}
2086+
20592087
/*
20602088
* Parse options for heaps, views and toast tables.
20612089
*/

‎src/backend/postmaster/autovacuum.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2681,6 +2681,7 @@ extract_autovac_opts(HeapTuple tup, TupleDesc pg_class_desc)
26812681
((Form_pg_class)GETSTRUCT(tup))->relkind==RELKIND_MATVIEW||
26822682
((Form_pg_class)GETSTRUCT(tup))->relkind==RELKIND_TOASTVALUE);
26832683

2684+
fill_default_common_reloptions(&common);
26842685
relopts=extractRelOptions(tup,pg_class_desc,
26852686
GetTableAmRoutineByAmOid(((Form_pg_class)GETSTRUCT(tup))->relam),
26862687
NULL,&common);

‎src/backend/utils/cache/relcache.c

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -480,26 +480,7 @@ RelationParseRelOptions(Relation relation, HeapTuple tuple)
480480
{
481481
common=MemoryContextAlloc(CacheMemoryContext,
482482
sizeof(CommonRdOptions));
483-
common->autovacuum.enabled= true;
484-
common->autovacuum.vacuum_threshold=-1;
485-
common->autovacuum.vacuum_ins_threshold=-2;
486-
common->autovacuum.analyze_threshold=-1;
487-
common->autovacuum.vacuum_cost_limit=-1;
488-
common->autovacuum.freeze_min_age=-1;
489-
common->autovacuum.freeze_max_age=-1;
490-
common->autovacuum.freeze_table_age=-1;
491-
common->autovacuum.multixact_freeze_min_age=-1;
492-
common->autovacuum.multixact_freeze_max_age=-1;
493-
common->autovacuum.multixact_freeze_table_age=-1;
494-
common->autovacuum.log_min_duration=-1;
495-
common->autovacuum.vacuum_cost_delay=-1;
496-
common->autovacuum.vacuum_scale_factor=-1;
497-
common->autovacuum.vacuum_ins_scale_factor=-1;
498-
common->autovacuum.analyze_scale_factor=-1;
499-
common->parallel_workers=-1;
500-
common->user_catalog_table= false;
501-
common->vacuum_index_cleanup=STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
502-
common->vacuum_truncate= true;
483+
fill_default_common_reloptions(common);
503484
relation->rd_common_options=common;
504485
}
505486
else

‎src/include/access/reloptions.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ extern void *build_reloptions(Datum reloptions, bool validate,
236236
externvoid*build_local_reloptions(local_relopts*relopts,Datumoptions,
237237
boolvalidate);
238238

239+
externvoidfill_default_common_reloptions(CommonRdOptions*common);
239240
externbytea*heap_reloptions(charrelkind,Datumreloptions,
240241
CommonRdOptions*common,boolvalidate);
241242
externbytea*view_reloptions(Datumreloptions,boolvalidate);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp