CUBRID Engine  latest
broker_config.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 
20 /*
21  * broker_config.h - broker configuration utilities
22  */
23 
24 #ifndef _BROKER_CONFIG_H_
25 #define _BROKER_CONFIG_H_
26 
27 #include "config.h"
28 #include "cas_protocol.h"
29 #if !defined(CAS_FOR_ORACLE) && !defined(CAS_FOR_MYSQL)
30 #include "environment_variable.h"
31 #endif /* !CAS_FOR_ORACLE && !CAS_FOR_MYSQL */
32 #include "porting.h"
33 
34 #define APPL_SERVER_CAS 0
35 #define APPL_SERVER_CAS_ORACLE 1
36 #define APPL_SERVER_CAS_MYSQL51 2
37 #define APPL_SERVER_CAS_MYSQL 3
38 
39 #define IS_APPL_SERVER_TYPE_CAS(x) \
40  ((x == APPL_SERVER_CAS) || (x == APPL_SERVER_CAS_ORACLE) || \
41  (x == APPL_SERVER_CAS_MYSQL51) || (x == APPL_SERVER_CAS_MYSQL))
42 #define IS_NOT_APPL_SERVER_TYPE_CAS(x) !IS_APPL_SERVER_TYPE_CAS(x)
43 
44 #define APPL_SERVER_CAS_TYPE_NAME "CAS"
45 #define APPL_SERVER_CAS_ORACLE_TYPE_NAME "CAS_ORACLE"
46 #define APPL_SERVER_CAS_MYSQL_TYPE_NAME "CAS_MYSQL"
47 #define APPL_SERVER_CAS_MYSQL51_TYPE_NAME "CAS_MYSQL51"
48 #define APPL_SERVER_CAS_MYSQL61_TYPE_NAME "CAS_MYSQL61"
49 
50 #define MAX_BROKER_NUM 50
51 
52 #define CONF_LOG_FILE_LEN 128
53 
54 #define DEFAULT_AS_MIN_NUM 5
55 #define DEFAULT_AS_MAX_NUM 40
56 
57 #if defined (WINDOWS)
58 #if __WORDSIZE == 64
59 #define DEFAULT_SERVER_MAX_SIZE "80M"
60 #elif __WORDSIZE == 32
61 #define DEFAULT_SERVER_MAX_SIZE "40M"
62 #else
63 #error "Error __WORDSIZE"
64 #endif
65 #else
66 #define DEFAULT_SERVER_MAX_SIZE "0"
67 #endif
68 
69 #define DEFAULT_SERVER_HARD_LIMIT "1G"
70 
71 #define DEFAULT_TIME_TO_KILL "2min"
72 #define SQL_LOG_TIME_MAX -1
73 
74 #define CONF_ERR_LOG_NONE 0x00
75 #define CONF_ERR_LOG_LOGFILE 0x01
76 #define CONF_ERR_LOG_BROWSER 0x02
77 #define CONF_ERR_LOG_BOTH (CONF_ERR_LOG_LOGFILE | CONF_ERR_LOG_BROWSER)
78 
79 #define DEFAULT_SQL_LOG_MAX_SIZE "10M"
80 #define DEFAULT_LONG_QUERY_TIME "1min"
81 #define DEFAULT_LONG_TRANSACTION_TIME "1min"
82 #define DEFAULT_ACCESS_LOG_MAX_SIZE "10M"
83 #define MAX_SQL_LOG_MAX_SIZE 2097152 /* 2G */
84 #define MAX_ACCESS_LOG_MAX_SIZE 2097152 /* 2G */
85 #define DEFAULT_MAX_NUM_DELAYED_HOSTS_LOOKUP -1
86 
87 #define BROKER_NAME_LEN 64
88 #define BROKER_LOG_MSG_SIZE 64
89 
90 #if !defined(BROKER_PATH_MAX)
91 #define BROKER_PATH_MAX (PATH_MAX)
92 #endif
93 
94 #define DEFAULT_SHARD_NUM_PROXY 1
95 #define DEFAULT_SHARD_MAX_CLIENTS 256
96 
97 #define DEFAULT_SHARD_PROXY_LOG_MAX_SIZE "100M"
98 #define MAX_PROXY_LOG_MAX_SIZE 1048576 /* about 1G */
99 
100 #define SHARD_CONN_STAT_SIZE_LIMIT 256
101 #define SHARD_KEY_STAT_SIZE_LIMIT 2
102 #define CLIENT_INFO_SIZE_LIMIT 10000
103 #define SHARD_INFO_SIZE_LIMIT 256
104 
105 #define BROKER_INFO_PATH_MAX (PATH_MAX)
106 #define BROKER_INFO_NAME_MAX (BROKER_INFO_PATH_MAX)
107 
108 #define DEFAULT_SSL_MODE "OFF"
109 
111 {
118 };
120 
122 {
126 };
128 
130 {
134 };
136 
138 {
142 };
144 
145 /* dbi.h must be updated when a new order is added */
147 {
151 };
153 
155 {
165 };
166 
168 
171 {
182  char sql_log2;
186  int pid;
187  int port;
191 #if defined (WINDOWS)
192  int appl_server_port;
193 #endif
203  int err_code;
206  int long_query_time; /* msec */
207  int long_transaction_time; /* msec */
208 #if defined (WINDOWS)
209  int pdh_workset;
210  float pdh_pct_cpu;
211  int cpu_time;
212  int pdh_num_thr;
213 #endif
217  int access_log_max_size; /* kbytes */
228 
235 
239 
242  char reject_client_flag; /* reject clients due to hanging cas/proxy */
243 
246  int max_num_delayed_hosts_lookup; /* max num of HA delayed hosts to lookup */
247 
248  int cas_rctime; /* sec */
249 
250  char trigger_action_flag; /* enable or disable trigger action */
251 
253  /* from here, these are used only in shard */
255 
257 
261 
265 
268 
269  /* SHARD SHARD_KEY_ID */
273 
277 
280  /* to here, these are used only in shard */
281 
282  char use_SSL;
283 };
284 
285 extern int broker_config_read (const char *conf_file, T_BROKER_INFO * br_info, int *num_broker, int *br_shm_id,
286  char *admin_log_file, char admin_flag, bool * acl_flag, char *acl_file,
287  char *admin_err_msg);
288 extern void broker_config_dump (FILE * fp, const T_BROKER_INFO * br_info, int num_broker, int br_shm_id);
289 
290 extern int conf_get_value_table_on_off (const char *value);
291 extern int conf_get_value_sql_log_mode (const char *value);
292 extern int conf_get_value_keep_con (const char *value);
293 extern int conf_get_value_access_mode (const char *value);
294 extern int conf_get_value_connect_order (const char *value);
295 
296 extern int conf_get_value_proxy_log_mode (const char *value);
297 
298 extern void dir_repath (char *path, size_t path_len);
299 
300 #if defined(SHARD_VERBOSE_DEBUG)
301 #if defined (WINDOWS)
302 #define SHARD_ERR(f, ...) do { \
303 fprintf(stdout, "[%-35s:%05d] <ERR> " f, __FILE__, __LINE__, _VA_ARGS_); \
304 } while (0);
305 
306 #define SHARD_INF(f, ...) do { \
307 fprintf(stdout, "[%-35s:%05d] <INF> " f, __FILE__, __LINE__, _VA_ARGS_); \
308 } while (0);
309 #else /* WINDOWS */
310 #define SHARD_ERR(f, a...) do { \
311 fprintf(stdout, "[%-35s:%05d] <ERR> " f, __FILE__, __LINE__, ##a); \
312 } while (0);
313 
314 #define SHARD_INF(f, a...) do { \
315 fprintf(stdout, "[%-35s:%05d] <INF> " f, __FILE__, __LINE__, ##a); \
316 } while (0);
317 #endif /* !WINDOWS */
318 #else /* SHARD_VERBOSE_DEBUG */
319 #if defined (WINDOWS)
320 #define SHARD_ERR(f, ...)
321 #define SHARD_INF(f, ...)
322 #else /* WINDOWS */
323 #define SHARD_ERR(f, a...)
324 #define SHARD_INF(f, a...)
325 #endif /* !WINDOWS */
326 #endif
327 
328 #endif /* _BROKER_CONFIG_H_ */
char trigger_action_flag
int long_transaction_time
char monitor_hang_flag
char shard_key_library_name[BROKER_INFO_NAME_MAX]
char jdbc_cache_only_hint
char shard_key_function_name[BROKER_INFO_NAME_MAX]
char reject_client_flag
int conf_get_value_keep_con(const char *value)
enum t_keep_con_value T_KEEP_CON_VALUE
int max_num_delayed_hosts_lookup
t_keep_con_value
t_access_mode_value
int proxy_conn_wait_timeout
char slow_log_dir[CONF_LOG_FILE_LEN]
char proxy_log_dir[CONF_LOG_FILE_LEN]
int mysql_keepalive_interval
#define BROKER_INFO_NAME_MAX
#define SRV_CON_DBPASSWD_SIZE
Definition: cas_protocol.h:56
int appl_server_hard_limit
char shard_db_name[SRV_CON_DBNAME_SIZE]
#define SRV_CON_DBNAME_SIZE
int conf_get_value_connect_order(const char *value)
#define BROKER_INFO_PATH_MAX
t_slow_log_value
int jdbc_cache_life_time
char log_dir[CONF_LOG_FILE_LEN]
char cci_default_autocommit
char shard_key_file[BROKER_INFO_PATH_MAX]
int conf_get_value_sql_log_mode(const char *value)
char monitor_server_flag
char stripped_column_name
void broker_config_dump(FILE *fp, const T_BROKER_INFO *br_info, int num_broker, int br_shm_id)
enum t_sql_log_mode_value T_SQL_LOG_MODE_VALUE
void dir_repath(char *path, size_t path_len)
int max_prepared_stmt_count
t_proxy_log_mode_value
#define BROKER_NAME_LEN
Definition: broker_config.h:87
char acl_file[CONF_LOG_FILE_LEN]
char auto_add_appl_server
t_connect_order_value
enum t_slow_log_value T_SLOW_LOG_VALUE
char access_log_dir[CONF_LOG_FILE_LEN]
int conf_get_value_proxy_log_mode(const char *value)
char ignore_shard_hint
char access_log_file[CONF_LOG_FILE_LEN]
enum t_access_mode_value T_ACCESS_MODE_VALUE
int monitor_hang_interval
char preferred_hosts[BROKER_INFO_NAME_MAX]
char admin_err_msg[ADMIN_ERR_MSG_SIZE]
int appl_server_max_size
int conf_get_value_table_on_off(const char *value)
char shard_db_password[SRV_CON_DBPASSWD_SIZE]
int proxy_max_prepared_stmt_count
#define SRV_CON_DBUSER_SIZE
Definition: cas_protocol.h:55
char shard_db_user[SRV_CON_DBUSER_SIZE]
char name[BROKER_NAME_LEN]
int broker_config_read(const char *conf_file, T_BROKER_INFO *br_info, int *num_broker, int *br_shm_id, char *admin_log_file, char admin_flag, bool *acl_flag, char *acl_file, char *admin_err_msg)
char error_log_file[CONF_LOG_FILE_LEN]
char shard_connection_file[BROKER_INFO_PATH_MAX]
char statement_pooling
#define CONF_LOG_FILE_LEN
Definition: broker_config.h:52
char source_env[CONF_LOG_FILE_LEN]
enum t_connect_order_value T_CONNECT_ORDER_VALUE
t_sql_log_mode_value
char err_log_dir[CONF_LOG_FILE_LEN]
int conf_get_value_access_mode(const char *value)
char db_connection_file[BROKER_INFO_PATH_MAX]
enum t_proxy_log_mode_value T_PROXY_LOG_MODE_VALUE