From 53abdf9b4ca2e4f0b6f6c6bfbc43cc94d1dcebfd Mon Sep 17 00:00:00 2001 From: David Christensen Date: Fri, 21 Oct 2022 11:06:59 -0400 Subject: [PATCH 5/6] A second page feature just to allocate more space --- src/backend/utils/misc/guc_tables.c | 11 +++++++++++ src/bin/initdb/initdb.c | 10 ++++++++-- src/common/pagefeat.c | 3 +++ src/include/common/pagefeat.h | 2 ++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c index c2fc61f81e..dd7d80feef 100644 --- a/src/backend/utils/misc/guc_tables.c +++ b/src/backend/utils/misc/guc_tables.c @@ -1809,6 +1809,17 @@ struct config_bool ConfigureNamesBool[] = NULL, NULL, NULL }, + { + {"wasted_space", PGC_INTERNAL, PRESET_OPTIONS, + gettext_noop("Waste some space in the page. Not even a fill factor. Just testing multiple page features."), + NULL, + GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE | GUC_RUNTIME_COMPUTED + }, + &page_feature_wasted_space, + false, + NULL, NULL, NULL + }, + { {"syslog_sequence_numbers", PGC_SIGHUP, LOGGING_WHERE, gettext_noop("Add sequence number to syslog messages to avoid duplicate suppression."), diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index 43311f0b79..0622983c06 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -151,6 +151,7 @@ static bool sync_only = false; static bool show_setting = false; static bool data_checksums = false; static bool page_checksums32 = false; +static bool waste_space = false; static char *xlog_dir = NULL; static char *str_wal_segment_size_mb = NULL; static int wal_segment_size_mb; @@ -1323,11 +1324,12 @@ bootstrap_template1(void) unsetenv("PGCLIENTENCODING"); snprintf(cmd, sizeof(cmd), - "\"%s\" --boot -X %d %s %s %s %s %s", + "\"%s\" --boot -X %d %s %s %s %s %s %s", backend_exec, wal_segment_size_mb * (1024 * 1024), data_checksums ? "-k" : "", page_checksums32 ? "-e page_checksums32" : "", + waste_space ? "-e wasted_space" : "", boot_options, extra_options, debug ? "-d 5" : ""); @@ -2807,6 +2809,7 @@ main(int argc, char *argv[]) {"wal-segsize", required_argument, NULL, 12}, {"data-checksums", no_argument, NULL, 'k'}, {"extended-checksums", no_argument, NULL, 'K'}, + {"waste-space", no_argument, NULL, 'w'}, {"allow-group-access", no_argument, NULL, 'g'}, {"discard-caches", no_argument, NULL, 14}, {"locale-provider", required_argument, NULL, 15}, @@ -2852,7 +2855,7 @@ main(int argc, char *argv[]) /* process command-line options */ - while ((c = getopt_long(argc, argv, "A:dD:E:gkKL:nNsST:U:WX:", long_options, &option_index)) != -1) + while ((c = getopt_long(argc, argv, "A:dD:E:gkKL:nNsST:U:WwX:", long_options, &option_index)) != -1) { switch (c) { @@ -2943,6 +2946,9 @@ main(int argc, char *argv[]) case 'T': default_text_search_config = pg_strdup(optarg); break; + case 'w': + waste_space = true; + break; case 'X': xlog_dir = pg_strdup(optarg); break; diff --git a/src/common/pagefeat.c b/src/common/pagefeat.c index a3e3e6686e..1af22b9876 100644 --- a/src/common/pagefeat.c +++ b/src/common/pagefeat.c @@ -22,6 +22,7 @@ PageFeatureSet cluster_page_features; /* status GUCs, display only. set by XLog startup */ bool page_feature_page_checksums32; +bool page_feature_wasted_space; /* * A "page feature" is an optional cluster-defined additional data field that @@ -49,6 +50,8 @@ typedef struct PageFeatureDesc static PageFeatureDesc feature_descs[PF_MAX_FEATURE] = { /* PF_PAGE_CHECKSUMS32 */ { 2, "page_checksums32" }, + /* PF_WASTED_SPACE */ + { 40, "wasted_space" }, }; diff --git a/src/include/common/pagefeat.h b/src/include/common/pagefeat.h index baff058de0..d6a665cd8f 100644 --- a/src/include/common/pagefeat.h +++ b/src/include/common/pagefeat.h @@ -17,6 +17,7 @@ /* revealed for GUCs */ extern int reserved_page_size; extern bool page_feature_page_checksums32; +extern bool page_feature_wasted_space; /* forward declaration to avoid circular includes */ typedef Pointer Page; @@ -29,6 +30,7 @@ extern PageFeatureSet cluster_page_features; /* bit offset for features flags */ typedef enum { PF_PAGE_CHECKSUMS32 = 0, + PF_WASTED_SPACE, PF_MAX_FEATURE /* must be last */ } PageFeature; -- 2.37.0 (Apple Git-136)