提交 59165cfa 编写于 作者: J Jacob Champion 提交者: GitHub

Convert GPDB-specific GUCs to the new "enum" type

Several GUCs are simply enumerated strings that are parsed into integer
types behind the scenes. As of 8.4, the GUC system recognizes a new
type, enum, which will do this for us. Move as many as we can to the new
system.

As part of this,
- gp_idf_deduplicate was changed from a char* string to an int, and new
  IDF_DEDUPLICATE_* macros were added for each option
- password_hash_algorithm was changed to an int
- for codegen_optimization_level, "none" is the default now when codegen
  is not enabled during compilation (instead of the empty string).

A couple of GUCs that *could* be represented as enums
(optimizer_minidump, gp_workfile_compress_algorithm) have been
purposefully kept with the prior system because they require the GUC
variable to be something other than an integer anyway.
Signed-off-by: NJacob Champion <pchampion@pivotal.io>
上级 4c7f65be
...@@ -5144,9 +5144,9 @@ choose_deduplicate(PlannerInfo *root, List *sortExprs, ...@@ -5144,9 +5144,9 @@ choose_deduplicate(PlannerInfo *root, List *sortExprs,
*numGroups = num_distinct; *numGroups = num_distinct;
/* we need some calculates above even if the flag is off */ /* we need some calculates above even if the flag is off */
if (pg_strcasecmp(gp_idf_deduplicate_str, "force") == 0) if (gp_idf_deduplicate == IDF_DEDUPLICATE_FORCE)
return true; return true;
if (pg_strcasecmp(gp_idf_deduplicate_str, "none") == 0) if (gp_idf_deduplicate == IDF_DEDUPLICATE_NONE)
return false; return false;
return dedup_cost < naive_cost; return dedup_cost < naive_cost;
......
...@@ -70,41 +70,20 @@ ...@@ -70,41 +70,20 @@
* Assign/Show hook functions defined in this module * Assign/Show hook functions defined in this module
*/ */
static const char *assign_gp_workfile_compress_algorithm(const char *newval, bool doit, GucSource source); static const char *assign_gp_workfile_compress_algorithm(const char *newval, bool doit, GucSource source);
static const char *assign_gp_workfile_type_hashjoin(const char *newval, bool doit, GucSource source);
static const char *assign_optimizer_log_failure(const char *newval,
bool doit, GucSource source);
static const char *assign_optimizer_minidump(const char *newval, static const char *assign_optimizer_minidump(const char *newval,
bool doit, GucSource source); bool doit, GucSource source);
static bool assign_optimizer(bool newval, bool doit, GucSource source); static bool assign_optimizer(bool newval, bool doit, GucSource source);
static bool assign_codegen(bool newval, bool doit, GucSource source); static bool assign_codegen(bool newval, bool doit, GucSource source);
static const char *assign_codegen_optimization_level(const char *newval, static bool assign_codegen_optimization_level(int newval, bool doit,
bool doit, GucSource source);
static const char *assign_optimizer_cost_model(const char *newval,
bool doit, GucSource source);
static const char *assign_system_cache_flush_force(const char *newval, bool doit,
GucSource source);
static const char *assign_gp_idf_deduplicate(const char *newval, bool doit,
GucSource source); GucSource source);
static const char *assign_explain_memory_verbosity(const char *newval, bool doit, GucSource source);
static bool assign_dispatch_log_stats(bool newval, bool doit, GucSource source); static bool assign_dispatch_log_stats(bool newval, bool doit, GucSource source);
static bool assign_gp_hashagg_default_nbatches(int newval, bool doit, GucSource source); static bool assign_gp_hashagg_default_nbatches(int newval, bool doit, GucSource source);
static const char *assign_debug_dtm_action(const char *newval,
bool doit, GucSource source);
static const char *assign_debug_dtm_action_target(const char *newval,
bool doit, GucSource source);
static const char *assign_debug_dtm_action_protocol(const char *newval,
bool doit, GucSource source);
static const char *assign_gp_log_format(const char *value, bool doit,
GucSource source);
/* Helper function for guc setter */ /* Helper function for guc setter */
extern const char *gpvars_assign_gp_resqueue_priority_default_value(const char *newval, extern const char *gpvars_assign_gp_resqueue_priority_default_value(const char *newval,
bool doit, bool doit,
GucSource source __attribute__((unused))); GucSource source __attribute__((unused)));
static const char *assign_password_hash_algorithm(const char *newval,
bool doit, GucSource source);
static const char *assign_gp_default_storage_options( static const char *assign_gp_default_storage_options(
const char *newval, bool doit, GucSource source); const char *newval, bool doit, GucSource source);
...@@ -122,9 +101,6 @@ List *gp_guc_list_for_explain; ...@@ -122,9 +101,6 @@ List *gp_guc_list_for_explain;
List *gp_guc_list_for_no_plan; List *gp_guc_list_for_no_plan;
char *Debug_dtm_action_sql_command_tag; char *Debug_dtm_action_sql_command_tag;
char *Debug_dtm_action_str;
char *Debug_dtm_action_target_str;
char *Debug_dtm_action_protocol_str;
bool Debug_print_full_dtm = false; bool Debug_print_full_dtm = false;
bool Debug_print_snapshot_dtm = false; bool Debug_print_snapshot_dtm = false;
...@@ -334,12 +310,7 @@ static char *gp_resource_manager_str; ...@@ -334,12 +310,7 @@ static char *gp_resource_manager_str;
* and is kept in sync by assign_hooks. * and is kept in sync by assign_hooks.
*/ */
static char *gp_workfile_compress_algorithm_str; static char *gp_workfile_compress_algorithm_str;
static char *gp_workfile_type_hashjoin_str;
static char *optimizer_log_failure_str;
static char *optimizer_minidump_str; static char *optimizer_minidump_str;
static char *optimizer_cost_model_str;
static char *gp_log_format_string;
static char *explain_memory_verbosity_str;
/* Backoff-related GUCs */ /* Backoff-related GUCs */
bool gp_enable_resqueue_priority; bool gp_enable_resqueue_priority;
...@@ -407,12 +378,10 @@ char *gp_hadoop_home; ...@@ -407,12 +378,10 @@ char *gp_hadoop_home;
char *gp_auth_time_override_str = NULL; char *gp_auth_time_override_str = NULL;
/* Password hashing */ /* Password hashing */
char *password_hash_algorithm_str = "MD5"; int password_hash_algorithm = PASSWORD_HASH_MD5;
PasswdHashAlg password_hash_algorithm = PASSWORD_HASH_MD5;
/* system cache invalidation mode*/ /* system cache invalidation mode*/
int gp_test_system_cache_flush_force = SysCacheFlushForce_Off; int gp_test_system_cache_flush_force = SysCacheFlushForce_Off;
static char *gp_test_system_cache_flush_force_str;
/* include file/line information to stack traces */ /* include file/line information to stack traces */
bool gp_log_stack_trace_lines; bool gp_log_stack_trace_lines;
...@@ -424,7 +393,7 @@ bool gp_log_stack_trace_lines; ...@@ -424,7 +393,7 @@ bool gp_log_stack_trace_lines;
*/ */
bool dml_ignore_target_partition_check = false; bool dml_ignore_target_partition_check = false;
char *gp_idf_deduplicate_str; int gp_idf_deduplicate;
bool fts_diskio_check = false; bool fts_diskio_check = false;
...@@ -569,7 +538,6 @@ bool codegen_exec_eval_expr; ...@@ -569,7 +538,6 @@ bool codegen_exec_eval_expr;
bool codegen_advance_aggregate; bool codegen_advance_aggregate;
int codegen_varlen_tolerance; int codegen_varlen_tolerance;
int codegen_optimization_level; int codegen_optimization_level;
static char *codegen_optimization_level_str = NULL;
/* System Information */ /* System Information */
static int gp_server_version_num; static int gp_server_version_num;
...@@ -588,6 +556,100 @@ char *gp_default_storage_options = NULL; ...@@ -588,6 +556,100 @@ char *gp_default_storage_options = NULL;
int writable_external_table_bufsize = 64; int writable_external_table_bufsize = 64;
static const struct config_enum_entry gp_log_format_options[] = {
{"text", 0},
{"csv", 1},
{NULL, 0}
};
static const struct config_enum_entry debug_dtm_action_protocol_options[] = {
{"none", DTX_PROTOCOL_COMMAND_NONE},
{"abort_no_prepared", DTX_PROTOCOL_COMMAND_ABORT_NO_PREPARED},
{"prepare", DTX_PROTOCOL_COMMAND_PREPARE},
{"abort_some_prepared", DTX_PROTOCOL_COMMAND_ABORT_SOME_PREPARED},
{"commit_prepared", DTX_PROTOCOL_COMMAND_COMMIT_PREPARED},
{"abort_prepared", DTX_PROTOCOL_COMMAND_ABORT_PREPARED},
{"retry_commit_prepared", DTX_PROTOCOL_COMMAND_RETRY_COMMIT_PREPARED},
{"retry_abort_prepared", DTX_PROTOCOL_COMMAND_RETRY_ABORT_PREPARED},
{"recovery_commit_prepared", DTX_PROTOCOL_COMMAND_RECOVERY_COMMIT_PREPARED},
{"recovery_abort_prepared", DTX_PROTOCOL_COMMAND_RECOVERY_ABORT_PREPARED},
{"subtransaction_begin", DTX_PROTOCOL_COMMAND_SUBTRANSACTION_BEGIN_INTERNAL},
{"subtransaction_release", DTX_PROTOCOL_COMMAND_SUBTRANSACTION_RELEASE_INTERNAL},
{"subtransaction_rollback", DTX_PROTOCOL_COMMAND_SUBTRANSACTION_ROLLBACK_INTERNAL},
{NULL, 0}
};
static const struct config_enum_entry optimizer_log_failure_options[] = {
{"all", OPTIMIZER_ALL_FAIL},
{"unexpected", OPTIMIZER_UNEXPECTED_FAIL},
{"expected", OPTIMIZER_EXPECTED_FAIL},
{NULL, 0}
};
static const struct config_enum_entry codegen_optimization_level_options[] = {
{"none", CODEGEN_OPTIMIZATION_LEVEL_NONE},
{"less", CODEGEN_OPTIMIZATION_LEVEL_LESS},
{"default", CODEGEN_OPTIMIZATION_LEVEL_DEFAULT},
{"aggressive", CODEGEN_OPTIMIZATION_LEVEL_AGGRESSIVE},
{NULL, 0}
};
static const struct config_enum_entry optimizer_cost_model_options[] = {
{"legacy", OPTIMIZER_GPDB_LEGACY},
{"calibrated", OPTIMIZER_GPDB_CALIBRATED},
{NULL, 0}
};
static const struct config_enum_entry explain_memory_verbosity_options[] = {
{"suppress", EXPLAIN_MEMORY_VERBOSITY_SUPPRESS},
{"summary", EXPLAIN_MEMORY_VERBOSITY_SUMMARY},
{"detail", EXPLAIN_MEMORY_VERBOSITY_DETAIL},
{NULL, 0}
};
static const struct config_enum_entry system_cache_flush_force_options[] = {
{"off", SysCacheFlushForce_Off},
{"recursive", SysCacheFlushForce_Recursive},
{"plain", SysCacheFlushForce_NonRecursive},
{NULL, 0}
};
static const struct config_enum_entry gp_idf_deduplicate_options[] = {
{"auto", IDF_DEDUPLICATE_AUTO},
{"none", IDF_DEDUPLICATE_NONE},
{"force", IDF_DEDUPLICATE_FORCE},
{NULL, 0}
};
static const struct config_enum_entry debug_dtm_action_options[] = {
{"none", DEBUG_DTM_ACTION_NONE},
{"delay", DEBUG_DTM_ACTION_DELAY},
{"fail_begin_command", DEBUG_DTM_ACTION_FAIL_BEGIN_COMMAND},
{"fail_end_command", DEBUG_DTM_ACTION_FAIL_END_COMMAND},
{"panic_begin_command", DEBUG_DTM_ACTION_PANIC_BEGIN_COMMAND},
{NULL, 0}
};
static const struct config_enum_entry debug_dtm_action_target_options[] = {
{"none", DEBUG_DTM_ACTION_TARGET_NONE},
{"protocol", DEBUG_DTM_ACTION_TARGET_PROTOCOL},
{"sql", DEBUG_DTM_ACTION_TARGET_SQL},
{NULL, 0}
};
static const struct config_enum_entry gp_workfile_type_hashjoin_options[] = {
{"bfz", BFZ},
{"buffile", BUFFILE},
{NULL, 0}
};
static const struct config_enum_entry password_hash_algorithm_options[] = {
/* {"none", PASSWORD_HASH_NONE}, * this option is not exposed */
{"MD5", PASSWORD_HASH_MD5},
{"SHA-256", PASSWORD_HASH_SHA_256},
{NULL, 0}
};
IndexCheckType gp_indexcheck_insert = INDEX_CHECK_NONE; IndexCheckType gp_indexcheck_insert = INDEX_CHECK_NONE;
IndexCheckType gp_indexcheck_vacuum = INDEX_CHECK_NONE; IndexCheckType gp_indexcheck_vacuum = INDEX_CHECK_NONE;
...@@ -4936,16 +4998,6 @@ struct config_string ConfigureNamesString_gp[] = ...@@ -4936,16 +4998,6 @@ struct config_string ConfigureNamesString_gp[] =
"none", assign_gp_workfile_compress_algorithm, NULL "none", assign_gp_workfile_compress_algorithm, NULL
}, },
{
{"gp_workfile_type_hashjoin", PGC_USERSET, QUERY_TUNING_OTHER,
gettext_noop("Specify the type of work files to use for executing hash join plans."),
gettext_noop("Valid values are \"BFZ\", \"BUFFILE\"."),
GUC_GPDB_ADDOPT | GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
},
&gp_workfile_type_hashjoin_str,
"bfz", assign_gp_workfile_type_hashjoin, NULL
},
{ {
{"gpperfmon_log_alert_level", PGC_USERSET, LOGGING, {"gpperfmon_log_alert_level", PGC_USERSET, LOGGING,
gettext_noop("Specify the log alert level used by gpperfmon."), gettext_noop("Specify the log alert level used by gpperfmon."),
...@@ -4955,16 +5007,6 @@ struct config_string ConfigureNamesString_gp[] = ...@@ -4955,16 +5007,6 @@ struct config_string ConfigureNamesString_gp[] =
"none", gpvars_assign_gp_gpperfmon_log_alert_level, gpvars_show_gp_gpperfmon_log_alert_level "none", gpvars_assign_gp_gpperfmon_log_alert_level, gpvars_show_gp_gpperfmon_log_alert_level
}, },
{
{"explain_memory_verbosity", PGC_USERSET, RESOURCES_MEM,
gettext_noop("Experimental feature: show memory account usage in EXPLAIN ANALYZE."),
gettext_noop("Valid values are SUPPRESS, SUMMARY, and DETAIL."),
GUC_GPDB_ADDOPT
},
&explain_memory_verbosity_str,
"suppress", assign_explain_memory_verbosity, NULL
},
{ {
{"memory_profiler_run_id", PGC_USERSET, DEVELOPER_OPTIONS, {"memory_profiler_run_id", PGC_USERSET, DEVELOPER_OPTIONS,
gettext_noop("Set the unique run ID for memory profiling"), gettext_noop("Set the unique run ID for memory profiling"),
...@@ -4995,16 +5037,6 @@ struct config_string ConfigureNamesString_gp[] = ...@@ -4995,16 +5037,6 @@ struct config_string ConfigureNamesString_gp[] =
"none", NULL, NULL "none", NULL, NULL
}, },
{
{"optimizer_log_failure", PGC_USERSET, LOGGING_WHEN,
gettext_noop("Sets which optimizer failures are logged."),
gettext_noop("Valid values are unexpected, expected, all"),
GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
},
&optimizer_log_failure_str,
"all", assign_optimizer_log_failure, NULL
},
{ {
{"optimizer_minidump", PGC_USERSET, LOGGING_WHEN, {"optimizer_minidump", PGC_USERSET, LOGGING_WHEN,
gettext_noop("Generate optimizer minidump."), gettext_noop("Generate optimizer minidump."),
...@@ -5014,15 +5046,6 @@ struct config_string ConfigureNamesString_gp[] = ...@@ -5014,15 +5046,6 @@ struct config_string ConfigureNamesString_gp[] =
"onerror", assign_optimizer_minidump, NULL "onerror", assign_optimizer_minidump, NULL
}, },
{
{"optimizer_cost_model", PGC_USERSET, DEVELOPER_OPTIONS,
gettext_noop("Set optimizer cost model."),
gettext_noop("Valid values are legacy, calibrated"),
GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
},
&optimizer_cost_model_str,
"calibrated", assign_optimizer_cost_model, NULL
},
{ {
{"gp_session_role", PGC_BACKEND, GP_WORKER_IDENTITY, {"gp_session_role", PGC_BACKEND, GP_WORKER_IDENTITY,
gettext_noop("Reports the default role for the session."), gettext_noop("Reports the default role for the session."),
...@@ -5113,36 +5136,6 @@ struct config_string ConfigureNamesString_gp[] = ...@@ -5113,36 +5136,6 @@ struct config_string ConfigureNamesString_gp[] =
"", NULL, NULL "", NULL, NULL
}, },
{
{"debug_dtm_action", PGC_SUSET, DEVELOPER_OPTIONS,
gettext_noop("Sets the debug DTM action."),
NULL,
GUC_SUPERUSER_ONLY | GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
},
&Debug_dtm_action_str,
"none", assign_debug_dtm_action, NULL
},
{
{"debug_dtm_action_target", PGC_SUSET, DEVELOPER_OPTIONS,
gettext_noop("Sets the debug DTM action target."),
NULL,
GUC_SUPERUSER_ONLY | GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
},
&Debug_dtm_action_target_str,
"none", assign_debug_dtm_action_target, NULL
},
{
{"debug_dtm_action_protocol", PGC_SUSET, DEVELOPER_OPTIONS,
gettext_noop("Sets the debug DTM action protocol."),
NULL,
GUC_SUPERUSER_ONLY | GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
},
&Debug_dtm_action_protocol_str,
"none", assign_debug_dtm_action_protocol, NULL
},
{ {
{"debug_dtm_action_sql_command_tag", PGC_SUSET, DEVELOPER_OPTIONS, {"debug_dtm_action_sql_command_tag", PGC_SUSET, DEVELOPER_OPTIONS,
gettext_noop("Sets the debug DTM action sql command tag."), gettext_noop("Sets the debug DTM action sql command tag."),
...@@ -5310,16 +5303,6 @@ struct config_string ConfigureNamesString_gp[] = ...@@ -5310,16 +5303,6 @@ struct config_string ConfigureNamesString_gp[] =
"eager_free", gpvars_assign_gp_resgroup_memory_policy, gpvars_show_gp_resgroup_memory_policy "eager_free", gpvars_assign_gp_resgroup_memory_policy, gpvars_show_gp_resgroup_memory_policy
}, },
{
{"gp_test_system_cache_flush_force", PGC_USERSET, GP_ERROR_HANDLING,
gettext_noop("Force invalidation of system caches on each access"),
gettext_noop("Valid values are OFF, PLAIN and RECURSIVE."),
GUC_GPDB_ADDOPT | GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
},
&gp_test_system_cache_flush_force_str,
"off", assign_system_cache_flush_force, NULL
},
{ {
{"gp_hadoop_connector_jardir", PGC_USERSET, CUSTOM_OPTIONS, {"gp_hadoop_connector_jardir", PGC_USERSET, CUSTOM_OPTIONS,
gettext_noop("The directory of the Hadoop connector JAR, relative to $GPHOME."), gettext_noop("The directory of the Hadoop connector JAR, relative to $GPHOME."),
...@@ -5360,25 +5343,6 @@ struct config_string ConfigureNamesString_gp[] = ...@@ -5360,25 +5343,6 @@ struct config_string ConfigureNamesString_gp[] =
"", NULL, NULL "", NULL, NULL
}, },
{
{"password_hash_algorithm", PGC_SUSET, CONN_AUTH_SECURITY,
gettext_noop("The cryptograph hash algorithm to apply to passwords before storing them."),
gettext_noop("Valid values are MD5 or SHA-256."),
GUC_SUPERUSER_ONLY
},
&password_hash_algorithm_str,
"MD5", assign_password_hash_algorithm, NULL
},
{
{"gp_idf_deduplicate", PGC_USERSET, QUERY_TUNING_METHOD,
gettext_noop("Sets the mode to control inverse distribution function's de-duplicate strategy."),
gettext_noop("Valid values are AUTO, NONE, and FORCE.")
},
&gp_idf_deduplicate_str,
"auto", assign_gp_idf_deduplicate, NULL
},
{ {
{"optimizer_search_strategy_path", PGC_USERSET, QUERY_TUNING_METHOD, {"optimizer_search_strategy_path", PGC_USERSET, QUERY_TUNING_METHOD,
gettext_noop("Sets the search strategy used by gp optimizer."), gettext_noop("Sets the search strategy used by gp optimizer."),
...@@ -5398,30 +5362,6 @@ struct config_string ConfigureNamesString_gp[] = ...@@ -5398,30 +5362,6 @@ struct config_string ConfigureNamesString_gp[] =
&gp_default_storage_options, "", assign_gp_default_storage_options, NULL &gp_default_storage_options, "", assign_gp_default_storage_options, NULL
}, },
{
{"gp_log_format", PGC_POSTMASTER, LOGGING_WHERE,
gettext_noop("Sets the format for log files."),
gettext_noop("Valid values are TEXT, CSV.")
},
&gp_log_format_string,
"csv", assign_gp_log_format, NULL
},
{
{"codegen_optimization_level", PGC_USERSET, DEVELOPER_OPTIONS,
gettext_noop("Sets optimizer level to use when compiling generated code."),
gettext_noop("Valid values are none, less, default, aggressive."),
GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE | GUC_GPDB_ADDOPT
},
&codegen_optimization_level_str,
#ifdef USE_CODEGEN
"default",
#else
"",
#endif
assign_codegen_optimization_level, NULL
},
{ {
/* Can't be set in postgresql.conf */ /* Can't be set in postgresql.conf */
{"gp_server_version", PGC_INTERNAL, PRESET_OPTIONS, {"gp_server_version", PGC_INTERNAL, PRESET_OPTIONS,
...@@ -5535,129 +5475,134 @@ struct config_enum ConfigureNamesEnum_gp[] = ...@@ -5535,129 +5475,134 @@ struct config_enum ConfigureNamesEnum_gp[] =
ERROR, message_level_options, NULL, NULL ERROR, message_level_options, NULL, NULL
}, },
/* End-of-list marker */
{ {
{NULL, 0, 0, NULL, NULL}, NULL, 0, NULL, NULL, NULL {"gp_log_format", PGC_POSTMASTER, LOGGING_WHERE,
} gettext_noop("Sets the format for log files."),
}; gettext_noop("Valid values are TEXT, CSV.")
},
static const char * &gp_log_format,
assign_gp_log_format(const char *value, bool doit, GucSource source) 1, gp_log_format_options, NULL, NULL
{ },
int log_format = 0;
if (pg_strcasecmp(value, "text") == 0)
log_format = 0;
else if (pg_strcasecmp(value, "csv") == 0)
log_format = 1;
else
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("unrecognized \"gp_log_format\" key word: \"%s\"",
value)));
if (doit)
gp_log_format = log_format;
return value;
}
static const char *
assign_debug_dtm_action_protocol(const char *newval,
bool doit, GucSource source)
{
if (pg_strcasecmp(newval, "none") == 0)
{
if (doit)
Debug_dtm_action_protocol = DTX_PROTOCOL_COMMAND_NONE;
}
else if (pg_strcasecmp(newval, "abort_no_prepared") == 0)
{ {
if (doit) {"debug_dtm_action_protocol", PGC_SUSET, DEVELOPER_OPTIONS,
Debug_dtm_action_protocol = DTX_PROTOCOL_COMMAND_ABORT_NO_PREPARED; gettext_noop("Sets the debug DTM action protocol."),
} NULL,
else if (pg_strcasecmp(newval, "prepare") == 0) GUC_SUPERUSER_ONLY | GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
{ },
if (doit) &Debug_dtm_action_protocol,
Debug_dtm_action_protocol = DTX_PROTOCOL_COMMAND_PREPARE; DTX_PROTOCOL_COMMAND_NONE, debug_dtm_action_protocol_options, NULL, NULL
} },
else if (pg_strcasecmp(newval, "abort_some_prepared") == 0)
{
if (doit)
Debug_dtm_action_protocol = DTX_PROTOCOL_COMMAND_ABORT_SOME_PREPARED;
}
else if (pg_strcasecmp(newval, "commit_prepared") == 0)
{
if (doit)
Debug_dtm_action_protocol = DTX_PROTOCOL_COMMAND_COMMIT_PREPARED;
}
else if (pg_strcasecmp(newval, "abort_prepared") == 0)
{
if (doit)
Debug_dtm_action_protocol = DTX_PROTOCOL_COMMAND_ABORT_PREPARED;
}
else if (pg_strcasecmp(newval, "retry_commit_prepared") == 0)
{ {
if (doit) {"optimizer_log_failure", PGC_USERSET, LOGGING_WHEN,
Debug_dtm_action_protocol = DTX_PROTOCOL_COMMAND_RETRY_COMMIT_PREPARED; gettext_noop("Sets which optimizer failures are logged."),
} gettext_noop("Valid values are unexpected, expected, all"),
else if (pg_strcasecmp(newval, "retry_abort_prepared") == 0) GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
},
&optimizer_log_failure,
OPTIMIZER_ALL_FAIL, optimizer_log_failure_options, NULL, NULL
},
{ {
if (doit) {"password_hash_algorithm", PGC_SUSET, CONN_AUTH_SECURITY,
Debug_dtm_action_protocol = DTX_PROTOCOL_COMMAND_RETRY_ABORT_PREPARED; gettext_noop("The cryptograph hash algorithm to apply to passwords before storing them."),
} gettext_noop("Valid values are MD5 or SHA-256."),
else if (pg_strcasecmp(newval, "recovery_commit_prepared") == 0) GUC_SUPERUSER_ONLY
},
&password_hash_algorithm,
PASSWORD_HASH_MD5, password_hash_algorithm_options, NULL, NULL
},
{ {
if (doit) {"codegen_optimization_level", PGC_USERSET, DEVELOPER_OPTIONS,
Debug_dtm_action_protocol = DTX_PROTOCOL_COMMAND_RECOVERY_COMMIT_PREPARED; gettext_noop("Sets optimizer level to use when compiling generated code."),
} gettext_noop("Valid values are none, less, default, aggressive."),
else if (pg_strcasecmp(newval, "recovery_abort_prepared") == 0) GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE | GUC_GPDB_ADDOPT
},
&codegen_optimization_level,
#ifdef USE_CODEGEN
CODEGEN_OPTIMIZATION_LEVEL_DEFAULT,
#else
CODEGEN_OPTIMIZATION_LEVEL_NONE,
#endif
codegen_optimization_level_options, assign_codegen_optimization_level, NULL
},
{ {
if (doit) {"optimizer_cost_model", PGC_USERSET, DEVELOPER_OPTIONS,
Debug_dtm_action_protocol = DTX_PROTOCOL_COMMAND_RECOVERY_ABORT_PREPARED; gettext_noop("Set optimizer cost model."),
} gettext_noop("Valid values are legacy, calibrated"),
else if (pg_strcasecmp(newval, "subtransaction_begin") == 0) GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
},
&optimizer_cost_model,
OPTIMIZER_GPDB_CALIBRATED, optimizer_cost_model_options, NULL, NULL
},
{ {
if (doit) {"explain_memory_verbosity", PGC_USERSET, RESOURCES_MEM,
Debug_dtm_action_protocol = DTX_PROTOCOL_COMMAND_SUBTRANSACTION_BEGIN_INTERNAL; gettext_noop("Experimental feature: show memory account usage in EXPLAIN ANALYZE."),
} gettext_noop("Valid values are SUPPRESS, SUMMARY, and DETAIL."),
else if (pg_strcasecmp(newval, "subtransaction_release") == 0) GUC_GPDB_ADDOPT
},
&explain_memory_verbosity,
EXPLAIN_MEMORY_VERBOSITY_SUPPRESS, explain_memory_verbosity_options, NULL, NULL
},
{ {
if (doit) {"gp_test_system_cache_flush_force", PGC_USERSET, GP_ERROR_HANDLING,
Debug_dtm_action_protocol = DTX_PROTOCOL_COMMAND_SUBTRANSACTION_RELEASE_INTERNAL; gettext_noop("Force invalidation of system caches on each access"),
} gettext_noop("Valid values are OFF, PLAIN and RECURSIVE."),
else if (pg_strcasecmp(newval, "subtransaction_rollback") == 0) GUC_GPDB_ADDOPT | GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
},
&gp_test_system_cache_flush_force,
SysCacheFlushForce_Off, system_cache_flush_force_options, NULL, NULL
},
{ {
if (doit) {"gp_idf_deduplicate", PGC_USERSET, QUERY_TUNING_METHOD,
Debug_dtm_action_protocol = DTX_PROTOCOL_COMMAND_SUBTRANSACTION_ROLLBACK_INTERNAL; gettext_noop("Sets the mode to control inverse distribution function's de-duplicate strategy."),
} gettext_noop("Valid values are AUTO, NONE, and FORCE.")
else },
return NULL; /* fail */ &gp_idf_deduplicate,
return newval; /* OK */ IDF_DEDUPLICATE_AUTO, gp_idf_deduplicate_options, NULL, NULL
} },
static const char *
assign_optimizer_log_failure(const char *val, bool assign, GucSource source)
{
if (pg_strcasecmp(val, "all") == 0 && assign)
{ {
optimizer_log_failure = OPTIMIZER_ALL_FAIL; {"debug_dtm_action", PGC_SUSET, DEVELOPER_OPTIONS,
} gettext_noop("Sets the debug DTM action."),
else if (pg_strcasecmp(val, "unexpected") == 0 && assign) NULL,
GUC_SUPERUSER_ONLY | GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
},
&Debug_dtm_action,
DEBUG_DTM_ACTION_NONE, debug_dtm_action_options, NULL, NULL
},
{ {
optimizer_log_failure = OPTIMIZER_UNEXPECTED_FAIL; {"debug_dtm_action_target", PGC_SUSET, DEVELOPER_OPTIONS,
} gettext_noop("Sets the debug DTM action target."),
else if (pg_strcasecmp(val, "expected") == 0 && assign) NULL,
GUC_SUPERUSER_ONLY | GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
},
&Debug_dtm_action_target,
DEBUG_DTM_ACTION_TARGET_NONE, debug_dtm_action_target_options, NULL, NULL
},
{ {
optimizer_log_failure = OPTIMIZER_EXPECTED_FAIL; {"gp_workfile_type_hashjoin", PGC_USERSET, QUERY_TUNING_OTHER,
} gettext_noop("Specify the type of work files to use for executing hash join plans."),
else gettext_noop("Valid values are \"BFZ\", \"BUFFILE\"."),
GUC_GPDB_ADDOPT | GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
},
&gp_workfile_type_hashjoin,
BFZ, gp_workfile_type_hashjoin_options, NULL, NULL
},
/* End-of-list marker */
{ {
return NULL; /* fail */ {NULL, 0, 0, NULL, NULL}, NULL, 0, NULL, NULL, NULL
} }
};
return val;
}
static bool static bool
assign_pljava_classpath_insecure(bool newval, bool doit, GucSource source) assign_pljava_classpath_insecure(bool newval, bool doit, GucSource source)
...@@ -5670,41 +5615,21 @@ assign_pljava_classpath_insecure(bool newval, bool doit, GucSource source) ...@@ -5670,41 +5615,21 @@ assign_pljava_classpath_insecure(bool newval, bool doit, GucSource source)
return true; return true;
} }
static const char* static bool
assign_codegen_optimization_level(const char *val, bool assign, GucSource source) { assign_codegen_optimization_level(int val, bool assign, GucSource source) {
#ifndef USE_CODEGEN #ifndef USE_CODEGEN
if (val && pg_strcasecmp(val, "") != 0) if (val != CODEGEN_OPTIMIZATION_LEVEL_NONE)
{
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("Code generation is not supported by this build"))); errmsg("Code generation is not supported by this build")));
#else return false;
if (pg_strcasecmp(val, "none") == 0 && assign)
{
codegen_optimization_level = CODEGEN_OPTIMIZATION_LEVEL_NONE;
}
else if (pg_strcasecmp(val, "less") == 0 && assign)
{
codegen_optimization_level = CODEGEN_OPTIMIZATION_LEVEL_LESS;
}
else if (pg_strcasecmp(val, "default") == 0 && assign)
{
codegen_optimization_level = CODEGEN_OPTIMIZATION_LEVEL_DEFAULT;
}
else if (pg_strcasecmp(val, "aggressive") == 0 && assign)
{
codegen_optimization_level = CODEGEN_OPTIMIZATION_LEVEL_AGGRESSIVE;
}
else
{
return NULL; /* fail */
} }
#endif #endif
return val; return true;
} }
static const char * static const char *
assign_optimizer_minidump(const char *val, bool assign, GucSource source) assign_optimizer_minidump(const char *val, bool assign, GucSource source)
{ {
...@@ -5724,108 +5649,6 @@ assign_optimizer_minidump(const char *val, bool assign, GucSource source) ...@@ -5724,108 +5649,6 @@ assign_optimizer_minidump(const char *val, bool assign, GucSource source)
return val; return val;
} }
static const char *
assign_optimizer_cost_model(const char *val, bool assign, GucSource source)
{
if (pg_strcasecmp(val, "legacy") == 0 && assign)
{
optimizer_cost_model = OPTIMIZER_GPDB_LEGACY;
}
else if (pg_strcasecmp(val, "calibrated") == 0 && assign)
{
optimizer_cost_model = OPTIMIZER_GPDB_CALIBRATED;
}
else
{
return NULL; /* fail */
}
return val;
}
static const char *
assign_explain_memory_verbosity(const char *newval, bool doit, GucSource source)
{
if (pg_strcasecmp(newval, "suppress") == 0)
{
if (doit)
explain_memory_verbosity = EXPLAIN_MEMORY_VERBOSITY_SUPPRESS;
}
else if (pg_strcasecmp(newval, "summary") == 0)
{
if (doit)
explain_memory_verbosity = EXPLAIN_MEMORY_VERBOSITY_SUMMARY;
}
else if (pg_strcasecmp(newval, "detail") == 0)
{
if (doit)
explain_memory_verbosity = EXPLAIN_MEMORY_VERBOSITY_DETAIL;
}
else
{
printf("Unknown memory verbosity.");
return NULL;
}
return newval;
}
static const char *
assign_system_cache_flush_force(const char *newval, bool doit, GucSource source)
{
if (pg_strcasecmp(newval, "off") == 0)
{
if (doit)
gp_test_system_cache_flush_force = SysCacheFlushForce_Off;
}
else if (pg_strcasecmp(newval, "recursive") == 0)
{
if (doit)
gp_test_system_cache_flush_force = SysCacheFlushForce_Recursive;
}
else if (pg_strcasecmp(newval, "plain") == 0)
{
if (doit)
gp_test_system_cache_flush_force = SysCacheFlushForce_NonRecursive;
}
else
{
return NULL;
}
return newval;
}
static const char *
assign_password_hash_algorithm(const char *newval, bool doit, GucSource source)
{
if (pg_strcasecmp(newval, "MD5") == 0)
{
if (doit)
password_hash_algorithm = PASSWORD_HASH_MD5;
}
else if (pg_strcasecmp(newval, "SHA-256") == 0)
{
if (doit)
password_hash_algorithm = PASSWORD_HASH_SHA_256;
}
else
return NULL;
return newval;
}
static const char *
assign_gp_idf_deduplicate(const char *newval, bool doit, GucSource source)
{
if (pg_strcasecmp(newval, "auto") == 0 ||
pg_strcasecmp(newval, "none") == 0 ||
pg_strcasecmp(newval, "force") == 0)
{
return newval;
}
return NULL;
}
static const char * static const char *
assign_gp_workfile_compress_algorithm(const char *newval, bool doit, GucSource source) assign_gp_workfile_compress_algorithm(const char *newval, bool doit, GucSource source)
{ {
...@@ -5838,27 +5661,6 @@ assign_gp_workfile_compress_algorithm(const char *newval, bool doit, GucSource s ...@@ -5838,27 +5661,6 @@ assign_gp_workfile_compress_algorithm(const char *newval, bool doit, GucSource s
return newval; /* OK */ return newval; /* OK */
} }
static const char *
assign_gp_workfile_type_hashjoin(const char *newval, bool doit, GucSource source)
{
ExecWorkFileType newtype = BFZ;
if (!pg_strcasecmp(newval, "bfz"))
{
newtype = BFZ;
}
else if (!pg_strcasecmp(newval, "buffile"))
{
newtype = BUFFILE;
}
else
return NULL;
if (doit)
gp_workfile_type_hashjoin = newtype;
return newval;
}
static bool static bool
assign_optimizer(bool newval, bool doit, GucSource source) assign_optimizer(bool newval, bool doit, GucSource source)
{ {
...@@ -5942,64 +5744,6 @@ assign_gp_hashagg_default_nbatches(int newval, bool doit, GucSource source) ...@@ -5942,64 +5744,6 @@ assign_gp_hashagg_default_nbatches(int newval, bool doit, GucSource source)
return true; /* OK */ return true; /* OK */
} }
static const char *
assign_debug_dtm_action(const char *newval,
bool doit, GucSource source)
{
if (pg_strcasecmp(newval, "none") == 0)
{
if (doit)
Debug_dtm_action = DEBUG_DTM_ACTION_NONE;
}
else if (pg_strcasecmp(newval, "delay") == 0)
{
if (doit)
Debug_dtm_action = DEBUG_DTM_ACTION_DELAY;
}
else if (pg_strcasecmp(newval, "fail_begin_command") == 0)
{
if (doit)
Debug_dtm_action = DEBUG_DTM_ACTION_FAIL_BEGIN_COMMAND;
}
else if (pg_strcasecmp(newval, "fail_end_command") == 0)
{
if (doit)
Debug_dtm_action = DEBUG_DTM_ACTION_FAIL_END_COMMAND;
}
else if (pg_strcasecmp(newval, "panic_begin_command") == 0)
{
if (doit)
Debug_dtm_action = DEBUG_DTM_ACTION_PANIC_BEGIN_COMMAND;
}
else
return NULL; /* fail */
return newval; /* OK */
}
static const char *
assign_debug_dtm_action_target(const char *newval,
bool doit, GucSource source)
{
if (pg_strcasecmp(newval, "none") == 0)
{
if (doit)
Debug_dtm_action_target = DEBUG_DTM_ACTION_TARGET_NONE;
}
else if (pg_strcasecmp(newval, "protocol") == 0)
{
if (doit)
Debug_dtm_action_target = DEBUG_DTM_ACTION_TARGET_PROTOCOL;
}
else if (pg_strcasecmp(newval, "sql") == 0)
{
if (doit)
Debug_dtm_action_target = DEBUG_DTM_ACTION_TARGET_SQL;
}
else
return NULL; /* fail */
return newval; /* OK */
}
/* /*
* Malloc a new string representing current storage_opts. * Malloc a new string representing current storage_opts.
*/ */
......
...@@ -1065,7 +1065,11 @@ extern void increment_command_count(void); ...@@ -1065,7 +1065,11 @@ extern void increment_command_count(void);
/* /*
* switch to control inverse distribution function strategy. * switch to control inverse distribution function strategy.
*/ */
extern char *gp_idf_deduplicate_str; extern int gp_idf_deduplicate;
#define IDF_DEDUPLICATE_AUTO 0
#define IDF_DEDUPLICATE_NONE 1
#define IDF_DEDUPLICATE_FORCE 2
/* default to RANDOM distribution for CREATE TABLE without DISTRIBUTED BY */ /* default to RANDOM distribution for CREATE TABLE without DISTRIBUTED BY */
extern bool gp_create_table_random_default_distribution; extern bool gp_create_table_random_default_distribution;
......
...@@ -26,6 +26,6 @@ typedef enum ...@@ -26,6 +26,6 @@ typedef enum
PASSWORD_HASH_SHA_256 PASSWORD_HASH_SHA_256
} PasswdHashAlg; } PasswdHashAlg;
extern PasswdHashAlg password_hash_algorithm; extern int password_hash_algorithm;
#endif #endif
...@@ -361,7 +361,6 @@ extern char *application_name; ...@@ -361,7 +361,6 @@ extern char *application_name;
extern char *Debug_dtm_action_sql_command_tag; extern char *Debug_dtm_action_sql_command_tag;
extern char *Debug_dtm_action_str; extern char *Debug_dtm_action_str;
extern char *Debug_dtm_action_target_str; extern char *Debug_dtm_action_target_str;
extern char *Debug_dtm_action_protocol_str;
/* Enable check for compatibility of encoding and locale in createdb */ /* Enable check for compatibility of encoding and locale in createdb */
extern bool gp_encoding_check_locale_compatibility; extern bool gp_encoding_check_locale_compatibility;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册