guc.h 24.6 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.
B
Bruce Momjian 已提交
9
 * Copyright (c) 2000-2009, PostgreSQL Global Development Group
10 11
 * Written by Peter Eisentraut <peter_e@gmx.net>.
 *
12
 * $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.102 2009/06/11 14:49:13 momjian Exp $
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
#define MAX_MAX_BACKENDS (INT_MAX / BLCKSZ)
23 24
#define MAX_AUTHENTICATION_TIMEOUT (600)
#define MAX_PRE_AUTH_DELAY (60)
25 26 27 28 29
/*
 * 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)
30 31 32

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

33

34
/*
35 36 37
 * Certain options can only be set at certain times. The rules are
 * like this:
 *
38 39 40 41
 * 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.
 *
42 43 44 45 46
 * 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
47 48 49 50
 * 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.)
51
 *
52
 * BACKEND options can only be set at postmaster startup, from the
53 54 55
 * 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 已提交
56
 * configuration file.	The idea is that these options are fixed for a
57
 * given backend once it's started, but they can vary across backends.
58 59
 *
 * SUSET options can be set at postmaster startup, with the SIGHUP
60
 * mechanism, or from SQL if you're a superuser.
61 62
 *
 * USERSET options can be set by anyone any time.
63
 */
B
Bruce Momjian 已提交
64 65
typedef enum
{
66 67 68 69 70 71
	PGC_INTERNAL,
	PGC_POSTMASTER,
	PGC_SIGHUP,
	PGC_BACKEND,
	PGC_SUSET,
	PGC_USERSET
72 73
} GucContext;

74 75 76 77
/*
 * 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
78 79 80
 * 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
81 82
 * as the current value.  Note that source == PGC_S_OVERRIDE should be
 * used when setting a PGC_INTERNAL option.
83
 *
84
 * PGC_S_INTERACTIVE isn't actually a source value, but is the
85 86 87 88 89
 * 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 已提交
90
 * as the actual source of any value).	This is an interactive case, but
91 92
 * it needs its own source value because some assign hooks need to make
 * different validity checks in this case.
93 94
 *
 * NB: see GucSource_Names in guc.c if you change this.
95 96 97
 */
typedef enum
{
98 99 100 101 102 103 104
	PGC_S_DEFAULT,				/* wired-in default */
	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 */
	PGC_S_CLIENT,				/* from client connection request */
105
	PGC_S_RESGROUP,				/* per-resgroup setting */
106
	PGC_S_OVERRIDE,				/* special case to forcibly set default */
107 108
	PGC_S_INTERACTIVE,			/* dividing line for error reporting */
	PGC_S_TEST,					/* test per-database or per-user setting */
109
	PGC_S_SESSION				/* SET command */
110
} GucSource;
111

112
/*
113
 * Parsing the configuation file will return a list of name-value pairs
114
 */
115
typedef struct ConfigVariable
116 117 118
{
	char       *name;
	char       *value;
119 120
	char	   *filename;
	int			sourceline;
121 122
	struct ConfigVariable  *next;
} ConfigVariable;
123 124

extern bool ParseConfigFile(const char *config_file, const char *calling_file,
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
				int depth, int elevel,
				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);

/*
 * Enum values are made up of an array of name-value pairs
 */
struct config_enum_entry
{
	const char *name;
	int			val;
	bool		hidden;
};
141

B
Bruce Momjian 已提交
142 143 144 145
typedef const char *(*GucStringAssignHook) (const char *newval, bool doit, GucSource source);
typedef bool (*GucBoolAssignHook) (bool newval, bool doit, GucSource source);
typedef bool (*GucIntAssignHook) (int newval, bool doit, GucSource source);
typedef bool (*GucRealAssignHook) (double newval, bool doit, GucSource source);
146
typedef bool (*GucEnumAssignHook) (int newval, bool doit, GucSource source);
147

B
Bruce Momjian 已提交
148
typedef const char *(*GucShowHook) (void);
149

150 151 152 153 154 155
typedef enum
{
	/* Types of set_config_option actions */
	GUC_ACTION_SET,				/* regular SET command */
	GUC_ACTION_LOCAL,			/* SET LOCAL command */
	GUC_ACTION_SAVE				/* function SET option */
156
} GucAction;
157

158 159
#define GUC_QUALIFIER_SEPARATOR '.'

160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
/*
 * 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 */

184 185 186 187
/* 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;

188 189 190 191 192 193 194
/* 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;

195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
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;
213
extern bool test_AppendOnlyHash_eviction_vs_just_marking_not_inuse;
214 215 216 217 218 219 220 221 222 223 224 225 226 227
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;
228

229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 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.
 */ 
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_insert_print;
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;
254
extern bool Debug_resource_group;
255 256 257
extern bool gp_crash_recovery_suppress_ao_eof;
extern bool gp_create_table_random_default_distribution;
extern bool gp_allow_non_uniform_partitioning_ddl;
258
extern bool gp_enable_exchange_default_partition;
259
extern int  dtx_phase2_retry_count;
260 261 262 263 264 265 266 267 268 269 270 271 272 273

/* 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;
274
extern bool gp_allow_rename_relation_without_lock;
275 276 277 278 279 280 281 282 283 284

extern bool gp_ignore_window_exclude;

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;
285 286 287 288
extern bool log_parser_stats;
extern bool log_planner_stats;
extern bool log_executor_stats;
extern bool log_statement_stats;
289
extern bool log_dispatch_stats;
290 291
extern bool log_btree_build_stats;

292
extern PGDLLIMPORT bool check_function_bodies;
293
extern bool default_with_oids;
294
extern bool SQL_inheritance;
295

296 297 298
extern int	log_min_error_statement;
extern int	log_min_messages;
extern int	client_min_messages;
299
extern int	log_min_duration_statement;
300
extern int	log_temp_files;
301

302 303
extern int	num_temp_buffers;

304 305
extern bool gp_cancel_query_print_log;
extern int gp_cancel_query_delay_time;
306
extern bool vmem_process_interrupt;
307
extern bool execute_pruned_plan;
308 309 310 311 312 313

extern bool gp_partitioning_dynamic_selection_log;
extern int gp_max_partition_level;

extern bool gp_perfmon_print_packet_info;

314 315
extern bool gp_enable_relsize_collection;

316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343
/* 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;

344
extern char *data_directory;
345
extern char *ConfigFileName;
346 347 348
extern char *HbaFileName;
extern char *IdentFileName;
extern char *external_pid_file;
349

350 351 352 353 354 355 356 357 358
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 已提交
359 360 361
extern int	tcp_keepalives_idle;
extern int	tcp_keepalives_interval;
extern int	tcp_keepalives_count;
362

363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384
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 已提交
385
/* Optimizer related gucs */
386
extern bool	optimizer;
V
Venkatesh Raghavan 已提交
387
extern bool optimizer_control;	/* controls whether the user can change the setting of the "optimizer" guc */
388
extern bool	optimizer_log;
V
Venkatesh Raghavan 已提交
389
extern int  optimizer_log_failure;
390
extern bool	optimizer_trace_fallback;
391 392
extern bool optimizer_minidump;
extern int  optimizer_cost_model;
V
Venkatesh Raghavan 已提交
393 394 395 396
extern bool optimizer_metadata_caching;
extern int	optimizer_mdcache_size;

/* Optimizer debugging GUCs */
397 398 399 400 401 402 403 404 405 406 407
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 已提交
408 409 410 411
extern bool optimizer_print_xform_results;

/* array of xforms disable flags */
extern bool optimizer_xforms[OPTIMIZER_XFORMS_COUNT];
412
extern char *optimizer_search_strategy_path;
V
Venkatesh Raghavan 已提交
413 414

/* GUCs to tell Optimizer to enable a physical operator */
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429
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 已提交
430 431 432 433 434 435 436 437 438
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;
439 440 441
extern bool optimizer_enable_hashjoin;
extern bool optimizer_enable_dynamictablescan;
extern bool optimizer_enable_indexscan;
442
extern bool optimizer_enable_tablescan;
V
Venkatesh Raghavan 已提交
443 444

/* Optimizer plan enumeration related GUCs */
445 446 447 448
extern bool optimizer_enumerate_plans;
extern bool optimizer_sample_plans;
extern int	optimizer_plan_id;
extern int	optimizer_samples_number;
V
Venkatesh Raghavan 已提交
449 450 451 452 453

/* 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;
454 455 456
extern double optimizer_damping_factor_filter;
extern double optimizer_damping_factor_join;
extern double optimizer_damping_factor_groupby;
V
Venkatesh Raghavan 已提交
457 458 459 460
extern bool optimizer_dpe_stats;
extern bool optimizer_enable_derive_stats_all_groups;

/* Costing or tuning related GUCs used by the Optimizer */
461
extern int optimizer_segments;
462
extern int optimizer_penalize_broadcast_threshold;
V
Venkatesh Raghavan 已提交
463 464 465 466 467
extern double optimizer_cost_threshold;
extern double optimizer_nestloop_factor;
extern double optimizer_sort_factor;

/* Optimizer hints */
468
extern int optimizer_array_expansion_threshold;
469
extern int optimizer_join_order_threshold;
470
extern int optimizer_join_order;
V
Venkatesh Raghavan 已提交
471 472 473 474 475 476 477 478
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;
479
extern bool optimizer_apply_left_outer_to_union_all_disregarding_stats;
V
Venkatesh Raghavan 已提交
480
extern bool optimizer_use_external_constant_expression_evaluation_for_ints;
481 482
extern bool optimizer_remove_order_below_dml;
extern bool optimizer_multilevel_partitioning;
483
extern bool optimizer_parallel_union;
484
extern bool optimizer_array_constraints;
V
Venkatesh Raghavan 已提交
485 486 487 488 489 490 491
extern bool optimizer_cte_inlining;
extern bool optimizer_enable_space_pruning;

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

492 493
extern bool optimizer_use_gpdb_allocators;

494 495 496 497 498 499

/**
 * Enable logging of DPE match in optimizer.
 */
extern bool	optimizer_partition_selection_log;

500 501 502 503 504
/* optimizer join heuristic models */
#define JOIN_ORDER_IN_QUERY                 0
#define JOIN_ORDER_GREEDY_SEARCH            1
#define JOIN_ORDER_EXHAUSTIVE_SEARCH        2

505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531
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;
extern int   gp_email_connect_avoid_duration; 

#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;

532 533 534
/* copy GUC */
extern bool gp_enable_segment_copy_checking;

535 536
extern int writable_external_table_bufsize;

537 538 539 540 541 542 543 544 545 546
typedef enum
{
	INDEX_CHECK_NONE,
	INDEX_CHECK_SYSTEM,
	INDEX_CHECK_ALL
} IndexCheckType;

extern IndexCheckType gp_indexcheck_insert;
extern IndexCheckType gp_indexcheck_vacuum;

547 548 549 550 551 552 553 554 555 556 557
/* 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

558
extern void SetConfigOption(const char *name, const char *value,
559
				GucContext context, GucSource source);
560 561

extern void DefineCustomBoolVariable(
B
Bruce Momjian 已提交
562 563 564 565
						 const char *name,
						 const char *short_desc,
						 const char *long_desc,
						 bool *valueAddr,
566
						 bool bootValue,
B
Bruce Momjian 已提交
567
						 GucContext context,
568
						 int flags,
B
Bruce Momjian 已提交
569 570
						 GucBoolAssignHook assign_hook,
						 GucShowHook show_hook);
571 572

extern void DefineCustomIntVariable(
B
Bruce Momjian 已提交
573 574 575 576
						const char *name,
						const char *short_desc,
						const char *long_desc,
						int *valueAddr,
577
						int bootValue,
578 579
						int minValue,
						int maxValue,
B
Bruce Momjian 已提交
580
						GucContext context,
581
						int flags,
B
Bruce Momjian 已提交
582 583
						GucIntAssignHook assign_hook,
						GucShowHook show_hook);
584 585

extern void DefineCustomRealVariable(
B
Bruce Momjian 已提交
586 587 588 589
						 const char *name,
						 const char *short_desc,
						 const char *long_desc,
						 double *valueAddr,
590
						 double bootValue,
591 592
						 double minValue,
						 double maxValue,
B
Bruce Momjian 已提交
593
						 GucContext context,
594
						 int flags,
B
Bruce Momjian 已提交
595 596
						 GucRealAssignHook assign_hook,
						 GucShowHook show_hook);
597 598

extern void DefineCustomStringVariable(
B
Bruce Momjian 已提交
599 600 601 602
						   const char *name,
						   const char *short_desc,
						   const char *long_desc,
						   char **valueAddr,
603
						   const char *bootValue,
B
Bruce Momjian 已提交
604
						   GucContext context,
605
						   int flags,
B
Bruce Momjian 已提交
606 607
						   GucStringAssignHook assign_hook,
						   GucShowHook show_hook);
608

609
extern void DefineCustomEnumVariable(
610 611 612 613 614 615 616 617 618 619
						 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,
						 GucEnumAssignHook assign_hook,
						 GucShowHook show_hook);
620

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

623
extern const char *GetConfigOption(const char *name);
624
extern const char *GetConfigOptionResetString(const char *name);
625
extern bool IsSuperuserConfigOption(const char *name);
626
extern void ProcessConfigFile(GucContext context);
627
extern void InitializeGUCOptions(void);
628
extern bool SelectConfigFiles(const char *userDoption, const char *progname);
629
extern void ResetAllOptions(void);
630 631 632
extern void AtStart_GUC(void);
extern int	NewGUCNestLevel(void);
extern void AtEOXact_GUC(bool isCommit, int nestLevel);
633
extern void BeginReportingGUCOptions(void);
634
extern void ParseLongOption(const char *string, char **name, char **value);
635
extern bool parse_int(const char *value, int *result, int flags,
636
		  const char **hintmsg);
637
extern bool parse_real(const char *value, double *result);
638
extern bool set_config_option(const char *name, const char *value,
B
Bruce Momjian 已提交
639
				  GucContext context, GucSource source,
640
				  GucAction action, bool changeVal);
641
extern char *GetConfigOptionByName(const char *name, const char **varname);
642
extern void GetConfigOptionByNum(int varnum, const char **values, bool *noshow);
B
Bruce Momjian 已提交
643
extern int	GetNumConfigOptions(void);
644

645
extern void SetPGVariable(const char *name, List *args, bool is_local);
646
extern void SetPGVariableOptDispatch(const char *name, List *args, bool is_local, bool gp_dispatch);
647 648
extern void GetPGVariable(const char *name, DestReceiver *dest);
extern TupleDesc GetPGVariableResultDesc(const char *name);
649

650 651
extern void ExecSetVariableStmt(VariableSetStmt *stmt);
extern char *ExtractSetVariableArgs(VariableSetStmt *stmt);
652

653
extern void ProcessGUCArray(ArrayType *array,
654
				GucContext context, GucSource source, GucAction action);
655 656
extern ArrayType *GUCArrayAdd(ArrayType *array, const char *name, const char *value);
extern ArrayType *GUCArrayDelete(ArrayType *array, const char *name);
657
extern ArrayType *GUCArrayReset(ArrayType *array);
658

659 660
extern int	GUC_complaint_elevel(GucSource source);

661 662
extern void pg_timezone_abbrev_initialize(void);

663
extern char *gp_guc_list_show(GucSource excluding, List *guclist);
664

665 666 667
extern struct config_generic *find_option(const char *name,
				bool create_placeholders, int elevel);

668 669
extern char  *gp_replication_config_filename;

670 671
extern bool select_gp_replication_config_files(const char *configdir, const char *progname);

672
extern void set_gp_replication_config(const char *name, const char *value);
673

674 675
extern bool parse_real(const char *value, double *result);

B
Bruce Momjian 已提交
676
#ifdef EXEC_BACKEND
677 678
extern void write_nondefault_variables(GucContext context);
extern void read_nondefault_variables(void);
B
Bruce Momjian 已提交
679 680
#endif

681 682 683 684 685 686
/*
 * 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.
 */

687 688
/* in commands/tablespace.c */
extern const char *assign_default_tablespace(const char *newval,
B
Bruce Momjian 已提交
689
						  bool doit, GucSource source);
690
extern const char *assign_temp_tablespaces(const char *newval,
B
Bruce Momjian 已提交
691
						bool doit, GucSource source);
692

693 694 695
/* in catalog/namespace.c */
extern const char *assign_search_path(const char *newval,
				   bool doit, GucSource source);
B
Bruce Momjian 已提交
696

697
/* in access/transam/xlog.c */
698
extern bool assign_xlog_sync_method(int newval,
699
						bool doit, GucSource source);
700

701 702
extern StdRdOptions *defaultStdRdOptions(char relkind);

703
#endif   /* GUC_H */