guc.h 27.7 KB
Newer Older
1
/*--------------------------------------------------------------------
2 3 4 5 6
 * guc.h
 *
 * External declarations pertaining to backend/utils/misc/guc.c and
 * backend/utils/misc/guc-file.l
 *
7
 * Portions Copyright (c) 2007-2010, Greenplum inc
8
 * Portions Copyright (c) 2012-Present Pivotal Software, Inc.
9
 * Copyright (c) 2000-2012, PostgreSQL Global Development Group
10 11
 * Written by Peter Eisentraut <peter_e@gmx.net>.
 *
12
 * src/include/utils/guc.h
13
 *--------------------------------------------------------------------
14 15 16 17
 */
#ifndef GUC_H
#define GUC_H

18
#include "nodes/parsenodes.h"
19
#include "tcop/dest.h"
20 21
#include "utils/array.h"

22 23
#define MAX_AUTHENTICATION_TIMEOUT (600)
#define MAX_PRE_AUTH_DELAY (60)
24 25 26 27 28
/*
 * One connection must be reserved for FTS to always able to probe
 * primary. So, this acts as lower limit on reserved superuser connections.
*/
#define RESERVED_FTS_CONNECTIONS (1)
29 30 31

struct StringInfoData;                  /* #include "lib/stringinfo.h" */

32

33
/*
34 35 36
 * Certain options can only be set at certain times. The rules are
 * like this:
 *
37 38 39 40
 * INTERNAL options cannot be set by the user at all, but only through
 * internal processes ("server_version" is an example).  These are GUC
 * variables only so they can be shown by SHOW, etc.
 *
41 42 43 44 45
 * POSTMASTER options can only be set when the postmaster starts,
 * either from the configuration file or the command line.
 *
 * SIGHUP options can only be set at postmaster startup or by changing
 * the configuration file and sending the HUP signal to the postmaster
46 47 48 49
 * or a backend process. (Notice that the signal receipt will not be
 * evaluated immediately. The postmaster and the backend check it at a
 * certain point in their main loop. It's safer to wait than to read a
 * file asynchronously.)
50
 *
51
 * BACKEND options can only be set at postmaster startup, from the
52 53 54
 * configuration file, or by client request in the connection startup
 * packet (e.g., from libpq's PGOPTIONS variable).  Furthermore, an
 * already-started backend will ignore changes to such an option in the
B
Bruce Momjian 已提交
55
 * configuration file.	The idea is that these options are fixed for a
56
 * given backend once it's started, but they can vary across backends.
57 58
 *
 * SUSET options can be set at postmaster startup, with the SIGHUP
59
 * mechanism, or from SQL if you're a superuser.
60 61
 *
 * USERSET options can be set by anyone any time.
62
 */
B
Bruce Momjian 已提交
63 64
typedef enum
{
65 66 67 68 69 70
	PGC_INTERNAL,
	PGC_POSTMASTER,
	PGC_SIGHUP,
	PGC_BACKEND,
	PGC_SUSET,
	PGC_USERSET
71 72
} GucContext;

73 74 75 76
/*
 * The following type records the source of the current setting.  A
 * new setting can only take effect if the previous setting had the
 * same or lower level.  (E.g, changing the config file doesn't
77 78 79
 * override the postmaster command line.)  Tracking the source allows us
 * to process sources in any convenient order without affecting results.
 * Sources <= PGC_S_OVERRIDE will set the default used by RESET, as well
80 81
 * as the current value.  Note that source == PGC_S_OVERRIDE should be
 * used when setting a PGC_INTERNAL option.
82
 *
83
 * PGC_S_INTERACTIVE isn't actually a source value, but is the
84 85 86 87 88
 * dividing line between "interactive" and "non-interactive" sources for
 * error reporting purposes.
 *
 * PGC_S_TEST is used when testing values to be stored as per-database or
 * per-user defaults ("doit" will always be false, so this never gets stored
B
Bruce Momjian 已提交
89
 * as the actual source of any value).	This is an interactive case, but
90 91
 * it needs its own source value because some assign hooks need to make
 * different validity checks in this case.
92 93
 *
 * NB: see GucSource_Names in guc.c if you change this.
94 95 96
 */
typedef enum
{
97 98
	PGC_S_DEFAULT,				/* hard-wired default ("boot_val") */
	PGC_S_DYNAMIC_DEFAULT,		/* default computed during initialization */
99 100 101 102 103
	PGC_S_ENV_VAR,				/* postmaster environment variable */
	PGC_S_FILE,					/* postgresql.conf */
	PGC_S_ARGV,					/* postmaster command line */
	PGC_S_DATABASE,				/* per-database setting */
	PGC_S_USER,					/* per-user setting */
104
	PGC_S_DATABASE_USER,		/* per-user-and-database setting */
105
	PGC_S_CLIENT,				/* from client connection request */
106
	PGC_S_RESGROUP,				/* per-resgroup setting */
107
	PGC_S_OVERRIDE,				/* special case to forcibly set default */
108 109
	PGC_S_INTERACTIVE,			/* dividing line for error reporting */
	PGC_S_TEST,					/* test per-database or per-user setting */
110
	PGC_S_SESSION				/* SET command */
111
} GucSource;
112

113
/*
114 115
 * Parsing the configuration file will return a list of name-value pairs
 * with source location info.
116
 */
117
typedef struct ConfigVariable
118
{
119 120
	char	   *name;
	char	   *value;
121 122
	char	   *filename;
	int			sourceline;
123
	struct ConfigVariable *next;
124
} ConfigVariable;
125 126

extern bool ParseConfigFile(const char *config_file, const char *calling_file,
127
				bool strict, int depth, int elevel,
128 129 130 131 132 133 134
				ConfigVariable **head_p, ConfigVariable **tail_p);
extern bool ParseConfigFp(FILE *fp, const char *config_file,
			  int depth, int elevel,
			  ConfigVariable **head_p, ConfigVariable **tail_p);
extern void FreeConfigVariables(ConfigVariable *list);

/*
135 136 137
 * The possible values of an enum variable are specified by an array of
 * name-value pairs.  The "hidden" flag means the value is accepted but
 * won't be displayed when guc.c is asked for a list of acceptable values.
138 139 140 141 142 143 144
 */
struct config_enum_entry
{
	const char *name;
	int			val;
	bool		hidden;
};
145

146 147 148 149 150 151 152 153 154 155 156 157 158 159
/*
 * Signatures for per-variable check/assign/show hook functions
 */
typedef bool (*GucBoolCheckHook) (bool *newval, void **extra, GucSource source);
typedef bool (*GucIntCheckHook) (int *newval, void **extra, GucSource source);
typedef bool (*GucRealCheckHook) (double *newval, void **extra, GucSource source);
typedef bool (*GucStringCheckHook) (char **newval, void **extra, GucSource source);
typedef bool (*GucEnumCheckHook) (int *newval, void **extra, GucSource source);

typedef void (*GucBoolAssignHook) (bool newval, void *extra);
typedef void (*GucIntAssignHook) (int newval, void *extra);
typedef void (*GucRealAssignHook) (double newval, void *extra);
typedef void (*GucStringAssignHook) (const char *newval, void *extra);
typedef void (*GucEnumAssignHook) (int newval, void *extra);
160

B
Bruce Momjian 已提交
161
typedef const char *(*GucShowHook) (void);
162

163 164 165
/*
 * Miscellaneous
 */
166 167 168 169 170
typedef enum
{
	/* Types of set_config_option actions */
	GUC_ACTION_SET,				/* regular SET command */
	GUC_ACTION_LOCAL,			/* SET LOCAL command */
171
	GUC_ACTION_SAVE				/* function SET option, or temp assignment */
172
} GucAction;
173

174 175
#define GUC_QUALIFIER_SEPARATOR '.'

176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
/*
 * bit values in "flags" of a GUC variable
 */
#define GUC_LIST_INPUT			0x0001	/* input can be list format */
#define GUC_LIST_QUOTE			0x0002	/* double-quote list elements */
#define GUC_NO_SHOW_ALL			0x0004	/* exclude from SHOW ALL */
#define GUC_NO_RESET_ALL		0x0008	/* exclude from RESET ALL */
#define GUC_REPORT				0x0010	/* auto-report changes to client */
#define GUC_NOT_IN_SAMPLE		0x0020	/* not in postgresql.conf.sample */
#define GUC_DISALLOW_IN_FILE	0x0040	/* can't set in postgresql.conf */
#define GUC_CUSTOM_PLACEHOLDER	0x0080	/* placeholder for custom variable */
#define GUC_SUPERUSER_ONLY		0x0100	/* show only to superusers */
#define GUC_IS_NAME				0x0200	/* limit string to NAMEDATALEN-1 */

#define GUC_UNIT_KB				0x0400	/* value is in kilobytes */
#define GUC_UNIT_BLOCKS			0x0800	/* value is in blocks */
#define GUC_UNIT_XBLOCKS		0x0C00	/* value is in xlog blocks */
#define GUC_UNIT_MEMORY			0x0C00	/* mask for KB, BLOCKS, XBLOCKS */

#define GUC_UNIT_MS				0x1000	/* value is in milliseconds */
#define GUC_UNIT_S				0x2000	/* value is in seconds */
#define GUC_UNIT_MIN			0x4000	/* value is in minutes */
#define GUC_UNIT_TIME			0x7000	/* mask for MS, S, MIN */

200
#define GUC_NOT_WHILE_SEC_REST	0x8000	/* can't set if security restricted */
201

202 203 204 205
/* GUC lists for gp_guc_list_show().  (List of struct config_generic) */
extern List    *gp_guc_list_for_explain;
extern List    *gp_guc_list_for_no_plan;

206 207 208 209 210 211 212
/* GUC vars that are actually declared in guc.c, rather than elsewhere */
extern bool log_duration;
extern bool Debug_print_plan;
extern bool Debug_print_parse;
extern bool Debug_print_rewritten;
extern bool Debug_pretty_print;

213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
extern bool	Debug_print_full_dtm;
extern bool	Debug_print_snapshot_dtm;
extern bool	Debug_print_qd_mirroring;
extern bool Debug_disable_distributed_snapshot;
extern bool Debug_abort_after_distributed_prepared;
extern bool Debug_abort_after_segment_prepared;
extern bool Debug_appendonly_print_insert;
extern bool Debug_appendonly_print_insert_tuple;
extern bool Debug_appendonly_print_scan;
extern bool Debug_appendonly_print_scan_tuple;
extern bool Debug_appendonly_print_delete;
extern bool Debug_appendonly_print_storage_headers;
extern bool Debug_appendonly_print_verify_write_block;
extern bool Debug_appendonly_use_no_toast;
extern bool Debug_appendonly_print_blockdirectory;
extern bool Debug_appendonly_print_read_block;
extern bool Debug_appendonly_print_append_block;
extern bool Debug_appendonly_print_segfile_choice;
231
extern bool test_AppendOnlyHash_eviction_vs_just_marking_not_inuse;
232 233 234 235 236 237 238 239 240 241 242 243 244 245
extern int  Debug_appendonly_bad_header_print_level;
extern bool Debug_appendonly_print_datumstream;
extern bool Debug_appendonly_print_visimap;
extern bool Debug_appendonly_print_compaction;
extern bool gp_crash_recovery_abort_suppress_fatal;
extern bool Debug_bitmap_print_insert;
extern bool Test_appendonly_override;
extern bool enable_checksum_on_tables;
extern int  Test_compresslevel_override;
extern int  gp_max_local_distributed_cache;
extern bool gp_local_distributed_cache_stats;
extern bool gp_appendonly_verify_block_checksums;
extern bool gp_appendonly_verify_write_block;
extern bool gp_appendonly_compaction;
246

247 248 249 250 251 252 253
/*
 * Threshold of the ratio of dirty data in a segment file
 * over which the segment file will be compacted during
 * lazy vacuum.
 * 0 indicates compact whenever there is hidden data.
 * 10 indicates that a segment should be compacted when more than
 * 10% of the tuples are hidden.
254
 */
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
extern int  gp_appendonly_compaction_threshold;
extern bool gp_heap_require_relhasoids_match;
extern bool	Debug_appendonly_rezero_quicklz_compress_scratch;
extern bool	Debug_appendonly_rezero_quicklz_decompress_scratch;
extern bool	Debug_appendonly_guard_end_quicklz_scratch;
extern bool	debug_xlog_record_read;
extern bool Debug_cancel_print;
extern bool Debug_datumstream_write_print_small_varlena_info;
extern bool Debug_datumstream_write_print_large_varlena_info;
extern bool Debug_datumstream_read_check_large_varlena_integrity;
extern bool Debug_datumstream_block_read_check_integrity;
extern bool Debug_datumstream_block_write_check_integrity;
extern bool Debug_datumstream_read_print_varlena_info;
extern bool Debug_datumstream_write_use_small_initial_buffers;
extern bool	Debug_database_command_print;
extern bool gp_startup_integrity_checks;
271
extern bool Debug_resource_group;
272 273 274
extern bool gp_crash_recovery_suppress_ao_eof;
extern bool gp_create_table_random_default_distribution;
extern bool gp_allow_non_uniform_partitioning_ddl;
275
extern bool gp_enable_exchange_default_partition;
276
extern int  dtx_phase2_retry_count;
277 278 279 280 281 282 283 284 285 286 287 288 289 290

/* WAL replication debug gucs */
extern bool debug_walrepl_snd;
extern bool debug_walrepl_syncrep;
extern bool debug_walrepl_rcv;
extern bool debug_basebackup;

/* Latch mechanism debug GUCs */
extern bool debug_latch;

extern bool gp_upgrade_mode;
extern bool gp_maintenance_mode;
extern bool gp_maintenance_conn;
extern bool allow_segment_DML;
291
extern bool gp_allow_rename_relation_without_lock;
292 293 294

extern bool gp_ignore_window_exclude;

295 296
extern bool gp_ignore_error_table;

297 298 299 300 301 302 303
extern bool rle_type_compression_stats;

extern bool	Debug_print_server_processes;
extern bool Debug_print_control_checkpoints;
extern bool	Debug_dtm_action_primary;

extern bool gp_log_optimization_time;
304 305 306 307
extern bool log_parser_stats;
extern bool log_planner_stats;
extern bool log_executor_stats;
extern bool log_statement_stats;
308
extern bool log_dispatch_stats;
309 310
extern bool log_btree_build_stats;

311
extern PGDLLIMPORT bool check_function_bodies;
312
extern bool default_with_oids;
313
extern bool SQL_inheritance;
314

315 316 317
extern int	log_min_error_statement;
extern int	log_min_messages;
extern int	client_min_messages;
318
extern int	log_min_duration_statement;
319
extern int	log_temp_files;
320

321 322
extern int	temp_file_limit;

323 324
extern int	num_temp_buffers;

325
extern bool vmem_process_interrupt;
326
extern bool execute_pruned_plan;
327 328 329 330 331 332

extern bool gp_partitioning_dynamic_selection_log;
extern int gp_max_partition_level;

extern bool gp_perfmon_print_packet_info;

333 334
extern bool gp_enable_relsize_collection;

335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362
/* Debug DTM Action */
typedef enum
{
	DEBUG_DTM_ACTION_NONE = 0,
	DEBUG_DTM_ACTION_DELAY = 1,
	DEBUG_DTM_ACTION_FAIL_BEGIN_COMMAND = 2,
	DEBUG_DTM_ACTION_FAIL_END_COMMAND = 3,
	DEBUG_DTM_ACTION_PANIC_BEGIN_COMMAND = 4,

	DEBUG_DTM_ACTION_LAST = 4
}	DebugDtmAction;

/* Debug DTM Action */
typedef enum
{
	DEBUG_DTM_ACTION_TARGET_NONE = 0,
	DEBUG_DTM_ACTION_TARGET_PROTOCOL = 1,
	DEBUG_DTM_ACTION_TARGET_SQL = 2,

	DEBUG_DTM_ACTION_TARGET_LAST = 2
}	DebugDtmActionTarget;

extern int Debug_dtm_action;
extern int Debug_dtm_action_target;
extern int Debug_dtm_action_protocol;
extern int Debug_dtm_action_segment;
extern int Debug_dtm_action_nestinglevel;

363
extern char *data_directory;
364
extern char *ConfigFileName;
365 366 367
extern char *HbaFileName;
extern char *IdentFileName;
extern char *external_pid_file;
368

369 370 371 372 373 374 375 376 377
extern char *application_name;

extern char *Debug_dtm_action_sql_command_tag;
extern char *Debug_dtm_action_str;
extern char *Debug_dtm_action_target_str;

/* Enable check for compatibility of encoding and locale in createdb */
extern bool gp_encoding_check_locale_compatibility;

B
Bruce Momjian 已提交
378 379 380
extern int	tcp_keepalives_idle;
extern int	tcp_keepalives_interval;
extern int	tcp_keepalives_count;
381

382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403
extern int	gp_connection_send_timeout;

extern int  WalSendClientTimeout;

extern char  *data_directory;

/* ORCA related definitions */
#define OPTIMIZER_XFORMS_COUNT 400 /* number of transformation rules */

/* types of optimizer failures */
#define OPTIMIZER_ALL_FAIL 			0  /* all failures */
#define OPTIMIZER_UNEXPECTED_FAIL 	1  /* unexpected failures */
#define OPTIMIZER_EXPECTED_FAIL 	2 /* expected failures */

/* optimizer minidump mode */
#define OPTIMIZER_MINIDUMP_FAIL  	0  /* create optimizer minidump on failure */
#define OPTIMIZER_MINIDUMP_ALWAYS 	1  /* always create optimizer minidump */

/* optimizer cost model */
#define OPTIMIZER_GPDB_LEGACY           0       /* GPDB's legacy cost model */
#define OPTIMIZER_GPDB_CALIBRATED       1       /* GPDB's calibrated cost model */

V
Venkatesh Raghavan 已提交
404
/* Optimizer related gucs */
405
extern bool	optimizer;
V
Venkatesh Raghavan 已提交
406
extern bool optimizer_control;	/* controls whether the user can change the setting of the "optimizer" guc */
407
extern bool	optimizer_log;
V
Venkatesh Raghavan 已提交
408
extern int  optimizer_log_failure;
409
extern bool	optimizer_trace_fallback;
A
Asim R P 已提交
410
extern int optimizer_minidump;
411
extern int  optimizer_cost_model;
V
Venkatesh Raghavan 已提交
412 413 414 415
extern bool optimizer_metadata_caching;
extern int	optimizer_mdcache_size;

/* Optimizer debugging GUCs */
416 417 418 419 420 421 422 423 424 425 426
extern bool optimizer_print_query;
extern bool optimizer_print_plan;
extern bool optimizer_print_xform;
extern bool	optimizer_print_memo_after_exploration;
extern bool	optimizer_print_memo_after_implementation;
extern bool	optimizer_print_memo_after_optimization;
extern bool	optimizer_print_job_scheduler;
extern bool	optimizer_print_expression_properties;
extern bool	optimizer_print_group_properties;
extern bool	optimizer_print_optimization_context;
extern bool optimizer_print_optimization_stats;
V
Venkatesh Raghavan 已提交
427 428 429 430
extern bool optimizer_print_xform_results;

/* array of xforms disable flags */
extern bool optimizer_xforms[OPTIMIZER_XFORMS_COUNT];
431
extern char *optimizer_search_strategy_path;
V
Venkatesh Raghavan 已提交
432 433

/* GUCs to tell Optimizer to enable a physical operator */
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448
extern bool optimizer_enable_indexjoin;
extern bool optimizer_enable_motions_masteronly_queries;
extern bool optimizer_enable_motions;
extern bool optimizer_enable_motion_broadcast;
extern bool optimizer_enable_motion_gather;
extern bool optimizer_enable_motion_redistribute;
extern bool optimizer_enable_sort;
extern bool optimizer_enable_materialize;
extern bool optimizer_enable_partition_propagation;
extern bool optimizer_enable_partition_selection;
extern bool optimizer_enable_outerjoin_rewrite;
extern bool optimizer_enable_multiple_distinct_aggs;
extern bool optimizer_enable_hashjoin_redistribute_broadcast_children;
extern bool optimizer_enable_broadcast_nestloop_outer_child;
extern bool optimizer_enable_assert_maxonerow;
V
Venkatesh Raghavan 已提交
449 450 451 452 453 454 455 456 457
extern bool optimizer_enable_constant_expression_evaluation;
extern bool optimizer_enable_bitmapscan;
extern bool optimizer_enable_outerjoin_to_unionall_rewrite;
extern bool optimizer_enable_ctas;
extern bool optimizer_enable_partial_index;
extern bool optimizer_enable_dml_triggers;
extern bool	optimizer_enable_dml_constraints;
extern bool optimizer_enable_direct_dispatch;
extern bool optimizer_enable_master_only_queries;
458 459 460
extern bool optimizer_enable_hashjoin;
extern bool optimizer_enable_dynamictablescan;
extern bool optimizer_enable_indexscan;
461
extern bool optimizer_enable_tablescan;
V
Venkatesh Raghavan 已提交
462 463

/* Optimizer plan enumeration related GUCs */
464 465 466 467
extern bool optimizer_enumerate_plans;
extern bool optimizer_sample_plans;
extern int	optimizer_plan_id;
extern int	optimizer_samples_number;
V
Venkatesh Raghavan 已提交
468 469 470 471 472

/* Cardinality estimation related GUCs used by the Optimizer */
extern bool optimizer_extract_dxl_stats;
extern bool optimizer_extract_dxl_stats_all_nodes;
extern bool optimizer_print_missing_stats;
473 474 475
extern double optimizer_damping_factor_filter;
extern double optimizer_damping_factor_join;
extern double optimizer_damping_factor_groupby;
V
Venkatesh Raghavan 已提交
476 477 478 479
extern bool optimizer_dpe_stats;
extern bool optimizer_enable_derive_stats_all_groups;

/* Costing or tuning related GUCs used by the Optimizer */
480
extern int optimizer_segments;
481
extern int optimizer_penalize_broadcast_threshold;
V
Venkatesh Raghavan 已提交
482 483 484 485 486
extern double optimizer_cost_threshold;
extern double optimizer_nestloop_factor;
extern double optimizer_sort_factor;

/* Optimizer hints */
487
extern int optimizer_array_expansion_threshold;
488
extern int optimizer_join_order_threshold;
489
extern int optimizer_join_order;
V
Venkatesh Raghavan 已提交
490 491 492 493 494 495 496 497
extern int optimizer_join_arity_for_associativity_commutativity;
extern int optimizer_cte_inlining_bound;
extern bool optimizer_force_multistage_agg;
extern bool optimizer_force_three_stage_scalar_dqa;
extern bool optimizer_force_expanded_distinct_aggs;
extern bool optimizer_prune_computed_columns;
extern bool optimizer_push_requirements_from_consumer_to_producer;
extern bool optimizer_enforce_subplans;
498
extern bool optimizer_apply_left_outer_to_union_all_disregarding_stats;
V
Venkatesh Raghavan 已提交
499
extern bool optimizer_use_external_constant_expression_evaluation_for_ints;
500 501
extern bool optimizer_remove_order_below_dml;
extern bool optimizer_multilevel_partitioning;
502
extern bool optimizer_parallel_union;
503
extern bool optimizer_array_constraints;
V
Venkatesh Raghavan 已提交
504 505
extern bool optimizer_cte_inlining;
extern bool optimizer_enable_space_pruning;
506
extern bool optimizer_enable_associativity;
V
Venkatesh Raghavan 已提交
507 508 509 510 511

/* Analyze related GUCs for Optimizer */
extern bool optimizer_analyze_root_partition;
extern bool optimizer_analyze_midlevel_partition;

512 513
extern bool optimizer_use_gpdb_allocators;

P
Pengzhou Tang 已提交
514 515
/* optimizer GUCs for replicated table */
extern bool optimizer_replicated_table_insert;
516

517 518 519
/* GUCs for slice table*/
extern int	gp_max_slices;

520 521 522 523 524
/**
 * Enable logging of DPE match in optimizer.
 */
extern bool	optimizer_partition_selection_log;

525 526 527 528 529
/* optimizer join heuristic models */
#define JOIN_ORDER_IN_QUERY                 0
#define JOIN_ORDER_GREEDY_SEARCH            1
#define JOIN_ORDER_EXHAUSTIVE_SEARCH        2

530 531 532 533 534 535 536
extern char  *gp_email_smtp_server;
extern char  *gp_email_smtp_userid;
extern char  *gp_email_smtp_password;
extern char  *gp_email_from;
extern char  *gp_email_to;
extern int   gp_email_connect_timeout;
extern int   gp_email_connect_failures;
537
extern int   gp_email_connect_avoid_duration;
538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556

#if USE_SNMP
extern char   *gp_snmp_community;
extern char   *gp_snmp_monitor_address;
extern char   *gp_snmp_use_inform_or_trap;
extern char   *gp_snmp_debug_log;
#endif

/* Hadoop Integration GUCs */
extern char  *gp_hadoop_connector_jardir;  /* relative dir on $GPHOME of the Hadoop connector jar is located */
extern char  *gp_hadoop_connector_version; /* connector version (internal use only) */
extern char  *gp_hadoop_target_version; /* the target hadoop distro/version */
extern char  *gp_hadoop_home;    /* $HADOOP_HOME on all segments */

/* Time based authentication GUC */
extern char  *gp_auth_time_override_str;

extern char  *gp_default_storage_options;

557 558 559
/* copy GUC */
extern bool gp_enable_segment_copy_checking;

560 561
extern int writable_external_table_bufsize;

562 563 564
/* Enable passing of query constraints to external table providers */
extern bool gp_external_enable_filter_pushdown;

565 566 567 568 569 570 571 572 573 574
typedef enum
{
	INDEX_CHECK_NONE,
	INDEX_CHECK_SYSTEM,
	INDEX_CHECK_ALL
} IndexCheckType;

extern IndexCheckType gp_indexcheck_insert;
extern IndexCheckType gp_indexcheck_vacuum;

575 576 577 578 579 580 581 582 583 584 585
/* Storage option names */
#define SOPT_FILLFACTOR    "fillfactor"
#define SOPT_APPENDONLY    "appendonly"
#define SOPT_BLOCKSIZE     "blocksize"
#define SOPT_COMPTYPE      "compresstype"
#define SOPT_COMPLEVEL     "compresslevel"
#define SOPT_CHECKSUM      "checksum"
#define SOPT_ORIENTATION   "orientation"
/* Max number of chars needed to hold value of a storage option. */
#define MAX_SOPT_VALUE_LEN 15

586 587 588
/*
 * Functions exported by guc.c
 */
589
extern void SetConfigOption(const char *name, const char *value,
590
				GucContext context, GucSource source);
591 592

extern void DefineCustomBoolVariable(
B
Bruce Momjian 已提交
593 594 595 596
						 const char *name,
						 const char *short_desc,
						 const char *long_desc,
						 bool *valueAddr,
597
						 bool bootValue,
B
Bruce Momjian 已提交
598
						 GucContext context,
599
						 int flags,
600
						 GucBoolCheckHook check_hook,
B
Bruce Momjian 已提交
601 602
						 GucBoolAssignHook assign_hook,
						 GucShowHook show_hook);
603 604

extern void DefineCustomIntVariable(
B
Bruce Momjian 已提交
605 606 607 608
						const char *name,
						const char *short_desc,
						const char *long_desc,
						int *valueAddr,
609
						int bootValue,
610 611
						int minValue,
						int maxValue,
B
Bruce Momjian 已提交
612
						GucContext context,
613
						int flags,
614
						GucIntCheckHook check_hook,
B
Bruce Momjian 已提交
615 616
						GucIntAssignHook assign_hook,
						GucShowHook show_hook);
617 618

extern void DefineCustomRealVariable(
B
Bruce Momjian 已提交
619 620 621 622
						 const char *name,
						 const char *short_desc,
						 const char *long_desc,
						 double *valueAddr,
623
						 double bootValue,
624 625
						 double minValue,
						 double maxValue,
B
Bruce Momjian 已提交
626
						 GucContext context,
627
						 int flags,
628
						 GucRealCheckHook check_hook,
B
Bruce Momjian 已提交
629 630
						 GucRealAssignHook assign_hook,
						 GucShowHook show_hook);
631 632

extern void DefineCustomStringVariable(
B
Bruce Momjian 已提交
633 634 635 636
						   const char *name,
						   const char *short_desc,
						   const char *long_desc,
						   char **valueAddr,
637
						   const char *bootValue,
B
Bruce Momjian 已提交
638
						   GucContext context,
639
						   int flags,
640
						   GucStringCheckHook check_hook,
B
Bruce Momjian 已提交
641 642
						   GucStringAssignHook assign_hook,
						   GucShowHook show_hook);
643

644
extern void DefineCustomEnumVariable(
645 646 647 648 649 650 651 652
						 const char *name,
						 const char *short_desc,
						 const char *long_desc,
						 int *valueAddr,
						 int bootValue,
						 const struct config_enum_entry * options,
						 GucContext context,
						 int flags,
653
						 GucEnumCheckHook check_hook,
654 655
						 GucEnumAssignHook assign_hook,
						 GucShowHook show_hook);
656

B
Bruce Momjian 已提交
657
extern void EmitWarningsOnPlaceholders(const char *className);
658

659 660
extern const char *GetConfigOption(const char *name, bool missing_ok,
				bool restrict_superuser);
661
extern const char *GetConfigOptionResetString(const char *name);
662
extern void ProcessConfigFile(GucContext context);
663
extern void InitializeGUCOptions(void);
664
extern bool SelectConfigFiles(const char *userDoption, const char *progname);
665
extern void ResetAllOptions(void);
666 667 668
extern void AtStart_GUC(void);
extern int	NewGUCNestLevel(void);
extern void AtEOXact_GUC(bool isCommit, int nestLevel);
669
extern void BeginReportingGUCOptions(void);
670
extern void ParseLongOption(const char *string, char **name, char **value);
671
extern bool parse_int(const char *value, int *result, int flags,
672
		  const char **hintmsg);
673
extern bool parse_real(const char *value, double *result);
674
extern int set_config_option(const char *name, const char *value,
B
Bruce Momjian 已提交
675
				  GucContext context, GucSource source,
676
				  GucAction action, bool changeVal, int elevel);
677
extern char *GetConfigOptionByName(const char *name, const char **varname);
678
extern void GetConfigOptionByNum(int varnum, const char **values, bool *noshow);
B
Bruce Momjian 已提交
679
extern int	GetNumConfigOptions(void);
680

681
extern void SetPGVariable(const char *name, List *args, bool is_local);
682
extern void SetPGVariableOptDispatch(const char *name, List *args, bool is_local, bool gp_dispatch);
683 684
extern void GetPGVariable(const char *name, DestReceiver *dest);
extern TupleDesc GetPGVariableResultDesc(const char *name);
685

686 687
extern void ExecSetVariableStmt(VariableSetStmt *stmt);
extern char *ExtractSetVariableArgs(VariableSetStmt *stmt);
688

689
extern void ProcessGUCArray(ArrayType *array,
690
				GucContext context, GucSource source, GucAction action);
691 692
extern ArrayType *GUCArrayAdd(ArrayType *array, const char *name, const char *value);
extern ArrayType *GUCArrayDelete(ArrayType *array, const char *name);
693
extern ArrayType *GUCArrayReset(ArrayType *array);
694

695
extern void pg_timezone_abbrev_initialize(void);
696

697
extern List *gp_guc_list_show(GucSource excluding, List *guclist);
698

699 700 701
extern struct config_generic *find_option(const char *name,
				bool create_placeholders, int elevel);

702 703
extern char  *gp_replication_config_filename;

704 705
extern bool select_gp_replication_config_files(const char *configdir, const char *progname);

706
extern void set_gp_replication_config(const char *name, const char *value);
707

708 709
extern bool parse_real(const char *value, double *result);

B
Bruce Momjian 已提交
710
#ifdef EXEC_BACKEND
711 712
extern void write_nondefault_variables(GucContext context);
extern void read_nondefault_variables(void);
B
Bruce Momjian 已提交
713 714
#endif

715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735
/* Support for messages reported from GUC check hooks */

extern PGDLLIMPORT char *GUC_check_errmsg_string;
extern PGDLLIMPORT char *GUC_check_errdetail_string;
extern PGDLLIMPORT char *GUC_check_errhint_string;

extern void GUC_check_errcode(int sqlerrcode);

#define GUC_check_errmsg \
	pre_format_elog_string(errno, TEXTDOMAIN), \
	GUC_check_errmsg_string = format_elog_string

#define GUC_check_errdetail \
	pre_format_elog_string(errno, TEXTDOMAIN), \
	GUC_check_errdetail_string = format_elog_string

#define GUC_check_errhint \
	pre_format_elog_string(errno, TEXTDOMAIN), \
	GUC_check_errhint_string = format_elog_string


736 737 738 739 740 741
/*
 * The following functions are not in guc.c, but are declared here to avoid
 * having to include guc.h in some widely used headers that it really doesn't
 * belong in.
 */

742
/* in commands/tablespace.c */
743 744 745
extern bool check_default_tablespace(char **newval, void **extra, GucSource source);
extern bool check_temp_tablespaces(char **newval, void **extra, GucSource source);
extern void assign_temp_tablespaces(const char *newval, void *extra);
746

747
/* in catalog/namespace.c */
748 749
extern bool check_search_path(char **newval, void **extra, GucSource source);
extern void assign_search_path(const char *newval, void *extra);
B
Bruce Momjian 已提交
750

751
/* in access/transam/xlog.c */
752 753
extern bool check_wal_buffers(int *newval, void **extra, GucSource source);
extern void assign_xlog_sync_method(int new_sync_method, void *extra);
754

A
Asim R P 已提交
755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772
/* in cdb/cdbvars.c */
extern bool check_gp_session_role(char **newval, void **extra, GucSource source);
extern void assign_gp_session_role(const char *newval, void *extra);
extern const char *show_gp_session_role(void);
extern bool check_gp_role(char **newval, void **extra, GucSource source);
extern void assign_gp_role(const char *newval, void *extra);
extern const char *show_gp_role(void);
extern void assign_gp_connections_per_thread(int newval, void *extra);
extern void assign_gp_write_shared_snapshot(bool newval, void *extra);
extern bool gpvars_check_gp_resource_manager_policy(char **newval, void **extra, GucSource source);
extern void gpvars_assign_gp_resource_manager_policy(const char *newval, void *extra);
extern const char *gpvars_show_gp_resource_manager_policy(void);
extern const char *gpvars_assign_gp_resqueue_memory_policy(const char *newval, bool doit, GucSource source);
extern const char *gpvars_show_gp_resqueue_memory_policy(void);
extern bool gpvars_check_statement_mem(int *newval, void **extra, GucSource source);
extern bool gpvars_check_gp_enable_gpperfmon(bool *newval, void **extra, GucSource source);
extern bool gpvars_check_gp_gpperfmon_send_interval(int *newval, void **extra, GucSource source);

773

774 775
extern StdRdOptions *defaultStdRdOptions(char relkind);

776
#endif   /* GUC_H */