From b2c0762bb4f8cf18d48c2af05a08b68a310089f1 Mon Sep 17 00:00:00 2001 From: David Christensen Date: Fri, 21 Oct 2022 11:06:59 -0400 Subject: [PATCH v2 5/5] 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 24a38642a0..73ff74c486 100644 --- a/src/backend/utils/misc/guc_tables.c +++ b/src/backend/utils/misc/guc_tables.c @@ -1815,6 +1815,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 876e0bbe97..b9e46771e4 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 extended_checksums = false; +static bool wasted_space = true; 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" : "", extended_checksums ? "-e extended_checksums" : "", + wasted_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': + wasted_space = true; + break; case 'X': xlog_dir = pg_strdup(optarg); break; diff --git a/src/common/pagefeat.c b/src/common/pagefeat.c index 2037713ccb..aa7e993690 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_extended_checksums; +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_EXT_CHECKSUMS */ { 7, "extended_checksums" }, /* occupies the 7 bytes atop the 1-byte trailer */ + /* PF_WASTED_SPACE */ + { 40, "wasted_space" }, }; diff --git a/src/include/common/pagefeat.h b/src/include/common/pagefeat.h index c286062af6..6634ce22c6 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_extended_checksums; +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_EXT_CHECKSUMS = 0, /* must be first */ + PF_WASTED_SPACE, PF_MAX_FEATURE /* must be last */ } PageFeature; -- 2.31.1