From 355f2d05ef8243feb7143375f88bb3c762414672 Mon Sep 17 00:00:00 2001 From: David Christensen Date: Thu, 18 Jan 2024 13:53:57 -0500 Subject: [PATCH v3 10/28] feature: Add hook for setting reloptions defaults at runtime This is necessary due to the various toast constants being non-constant due to runtime differences in usable space. Future commits will utilize this to tweak. This is run once on startup, so while this is not the most efficient way to handle this, it doesn't really matter for one-time spinup cost. --- src/backend/access/common/reloptions.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c index 0921a736ab..52c8c546ee 100644 --- a/src/backend/access/common/reloptions.c +++ b/src/backend/access/common/reloptions.c @@ -563,6 +563,8 @@ static void initialize_reloptions(void); static void parse_one_reloption(relopt_value *option, char *text_str, int text_len, bool validate); +static void update_dynamic_reloptions(void); + /* * Get the length of a string reloption (either default or the user-defined * value). This is used for allocation purposes when building a set of @@ -572,6 +574,20 @@ static void parse_one_reloption(relopt_value *option, char *text_str, ((option).isset ? strlen((option).values.string_val) : \ ((relopt_string *) (option).gen)->default_len) +/* + * handle adjustments to the config table based on dynamic parameters' limits + */ + +static void +update_dynamic_reloptions(void) +{ + int i; + + for (i = 0; intRelOpts[i].gen.name; i++) + { + } +} + /* * initialize_reloptions * initialization routine, must be called before parsing @@ -584,6 +600,13 @@ initialize_reloptions(void) int i; int j; + /* + * Set the dynamic limits based on block size; if we get multiple can make + * more sophisticated. + */ + + update_dynamic_reloptions(); + j = 0; for (i = 0; boolRelOpts[i].gen.name; i++) { -- 2.40.1