1
by brian
clean slate |
1 |
/* Copyright (C) 2000-2003 MySQL AB
|
2 |
||
3 |
This program is free software; you can redistribute it and/or modify
|
|
4 |
it under the terms of the GNU General Public License as published by
|
|
5 |
the Free Software Foundation; version 2 of the License.
|
|
6 |
||
7 |
This program is distributed in the hope that it will be useful,
|
|
8 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
9 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
10 |
GNU General Public License for more details.
|
|
11 |
||
12 |
You should have received a copy of the GNU General Public License
|
|
13 |
along with this program; if not, write to the Free Software
|
|
14 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
15 |
||
16 |
#include "mysql_priv.h" |
|
17 |
#include <m_ctype.h> |
|
18 |
#include <my_dir.h> |
|
19 |
#include <my_bit.h> |
|
20 |
#include "slave.h" |
|
21 |
#include "rpl_mi.h" |
|
22 |
#include "sql_repl.h" |
|
23 |
#include "rpl_filter.h" |
|
24 |
#include "repl_failsafe.h" |
|
25 |
#include "stacktrace.h" |
|
26 |
#include "mysqld_suffix.h" |
|
27 |
#include "mysys_err.h" |
|
28 |
||
29 |
#include "../storage/myisam/ha_myisam.h" |
|
30 |
||
31 |
#ifdef HAVE_SYS_PRCTL_H
|
|
32 |
#include <sys/prctl.h> |
|
33 |
#endif
|
|
34 |
||
35 |
#ifndef DEFAULT_SKIP_THREAD_PRIORITY
|
|
36 |
#define DEFAULT_SKIP_THREAD_PRIORITY 0
|
|
37 |
#endif
|
|
38 |
||
39 |
#include <thr_alarm.h> |
|
40 |
#include <errmsg.h> |
|
41 |
||
42 |
#define mysqld_charset &my_charset_latin1
|
|
43 |
||
44 |
#ifdef HAVE_purify
|
|
45 |
#define IF_PURIFY(A,B) (A)
|
|
46 |
#else
|
|
47 |
#define IF_PURIFY(A,B) (B)
|
|
48 |
#endif
|
|
49 |
||
50 |
#if SIZEOF_CHARP == 4
|
|
51 |
#define MAX_MEM_TABLE_SIZE ~(ulong) 0
|
|
52 |
#else
|
|
151
by Brian Aker
Ulonglong to uint64_t |
53 |
#define MAX_MEM_TABLE_SIZE ~(uint64_t) 0
|
1
by brian
clean slate |
54 |
#endif
|
55 |
||
56 |
/* We have HAVE_purify below as this speeds up the shutdown of MySQL */
|
|
57 |
||
58 |
#if defined(HAVE_DEC_3_2_THREADS) || defined(SIGNALS_DONT_BREAK_READ) || defined(HAVE_purify) && defined(__linux__)
|
|
59 |
#define HAVE_CLOSE_SERVER_SOCK 1
|
|
60 |
#endif
|
|
61 |
||
62 |
extern "C" { // Because of SCO 3.2V4.2 |
|
63 |
#include <errno.h> |
|
64 |
#include <sys/stat.h> |
|
65 |
#ifndef __GNU_LIBRARY__
|
|
66 |
#define __GNU_LIBRARY__ // Skip warnings in getopt.h |
|
67 |
#endif
|
|
68 |
#include <my_getopt.h> |
|
69 |
#ifdef HAVE_SYSENT_H
|
|
70 |
#include <sysent.h> |
|
71 |
#endif
|
|
72 |
#ifdef HAVE_PWD_H
|
|
73 |
#include <pwd.h> // For getpwent |
|
74 |
#endif
|
|
75 |
#ifdef HAVE_GRP_H
|
|
76 |
#include <grp.h> |
|
77 |
#endif
|
|
78 |
#include <my_net.h> |
|
79 |
||
80 |
#include <sys/resource.h> |
|
81 |
||
82 |
#ifdef HAVE_SELECT_H
|
|
83 |
# include <select.h>
|
|
84 |
#endif
|
|
85 |
||
86 |
#ifdef HAVE_SYS_SELECT_H
|
|
87 |
#include <sys/select.h> |
|
88 |
#endif
|
|
89 |
||
90 |
#include <sys/utsname.h> |
|
91 |
||
92 |
#ifdef HAVE_SYS_MMAN_H
|
|
93 |
#include <sys/mman.h> |
|
94 |
#endif
|
|
95 |
||
96 |
#define SIGNAL_FMT "signal %d"
|
|
97 |
||
98 |
||
99 |
#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H)
|
|
100 |
#include <ieeefp.h> |
|
101 |
#ifdef HAVE_FP_EXCEPT // Fix type conflict |
|
102 |
typedef fp_except fp_except_t; |
|
103 |
#endif
|
|
104 |
#endif /* __FreeBSD__ && HAVE_IEEEFP_H */ |
|
105 |
||
106 |
#ifdef HAVE_FPU_CONTROL_H
|
|
107 |
#include <fpu_control.h> |
|
108 |
#endif
|
|
109 |
||
110 |
#ifdef HAVE_SYS_FPU_H
|
|
111 |
/* for IRIX to use set_fpc_csr() */
|
|
112 |
#include <sys/fpu.h> |
|
113 |
#endif
|
|
114 |
||
115 |
inline void setup_fpu() |
|
116 |
{
|
|
117 |
#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H)
|
|
118 |
/*
|
|
119 |
We can't handle floating point exceptions with threads, so disable
|
|
120 |
this on freebsd.
|
|
121 |
Don't fall for overflow, underflow,divide-by-zero or loss of precision
|
|
122 |
*/
|
|
123 |
#if defined(__i386__)
|
|
124 |
fpsetmask(~(FP_X_INV | FP_X_DNML | FP_X_OFL | FP_X_UFL | FP_X_DZ | |
|
125 |
FP_X_IMP)); |
|
126 |
#else
|
|
127 |
fpsetmask(~(FP_X_INV | FP_X_OFL | FP_X_UFL | FP_X_DZ | |
|
128 |
FP_X_IMP)); |
|
129 |
#endif /* __i386__ */ |
|
130 |
#endif /* __FreeBSD__ && HAVE_IEEEFP_H */ |
|
131 |
||
132 |
/*
|
|
133 |
x86 (32-bit) requires FPU precision to be explicitly set to 64 bit for
|
|
134 |
portable results of floating point operations
|
|
135 |
*/
|
|
136 |
#if defined(__i386__) && defined(HAVE_FPU_CONTROL_H) && defined(_FPU_DOUBLE)
|
|
137 |
fpu_control_t cw; |
|
138 |
_FPU_GETCW(cw); |
|
139 |
cw= (cw & ~_FPU_EXTENDED) | _FPU_DOUBLE; |
|
140 |
_FPU_SETCW(cw); |
|
141 |
#endif /* __i386__ && HAVE_FPU_CONTROL_H && _FPU_DOUBLE */ |
|
142 |
}
|
|
143 |
||
144 |
} /* cplusplus */ |
|
145 |
||
146 |
#define MYSQL_KILL_SIGNAL SIGTERM
|
|
147 |
||
148 |
#include <my_pthread.h> // For thr_setconcurency() |
|
149 |
||
150 |
#ifdef SOLARIS
|
|
151 |
extern "C" int gethostname(char *name, int namelen); |
|
152 |
#endif
|
|
153 |
||
154 |
extern "C" sig_handler handle_segfault(int sig); |
|
155 |
||
156 |
/* Constants */
|
|
157 |
||
158 |
const char *show_comp_option_name[]= {"YES", "NO", "DISABLED"}; |
|
159 |
/*
|
|
160 |
WARNING: When adding new SQL modes don't forget to update the
|
|
161 |
tables definitions that stores it's value.
|
|
162 |
(ie: mysql.event, mysql.proc)
|
|
163 |
*/
|
|
164 |
static const char *optimizer_switch_names[]= |
|
165 |
{
|
|
166 |
"no_materialization", "no_semijoin", |
|
167 |
NullS
|
|
168 |
};
|
|
169 |
||
170 |
/* Corresponding defines are named OPTIMIZER_SWITCH_XXX */
|
|
171 |
static const unsigned int optimizer_switch_names_len[]= |
|
172 |
{
|
|
173 |
/*no_materialization*/ 19, |
|
174 |
/*no_semijoin*/ 11 |
|
175 |
};
|
|
176 |
||
177 |
TYPELIB optimizer_switch_typelib= { array_elements(optimizer_switch_names)-1,"", |
|
178 |
optimizer_switch_names, |
|
179 |
(unsigned int *)optimizer_switch_names_len }; |
|
180 |
||
181 |
static const char *tc_heuristic_recover_names[]= |
|
182 |
{
|
|
183 |
"COMMIT", "ROLLBACK", NullS |
|
184 |
};
|
|
185 |
static TYPELIB tc_heuristic_recover_typelib= |
|
186 |
{
|
|
187 |
array_elements(tc_heuristic_recover_names)-1,"", |
|
188 |
tc_heuristic_recover_names, NULL |
|
189 |
};
|
|
190 |
||
191 |
const char *first_keyword= "first", *binary_keyword= "BINARY"; |
|
192 |
const char *my_localhost= "localhost"; |
|
193 |
#if SIZEOF_OFF_T > 4 && defined(BIG_TABLES)
|
|
194 |
#define GET_HA_ROWS GET_ULL
|
|
195 |
#else
|
|
196 |
#define GET_HA_ROWS GET_ULONG
|
|
197 |
#endif
|
|
198 |
||
199 |
/*
|
|
200 |
Used with --help for detailed option
|
|
201 |
*/
|
|
150
by Brian Aker
More bool removal. More cow bell! |
202 |
static bool opt_help= 0, opt_verbose= 0; |
1
by brian
clean slate |
203 |
|
204 |
arg_cmp_func Arg_comparator::comparator_matrix[5][2] = |
|
205 |
{{&Arg_comparator::compare_string, &Arg_comparator::compare_e_string}, |
|
206 |
{&Arg_comparator::compare_real, &Arg_comparator::compare_e_real}, |
|
207 |
{&Arg_comparator::compare_int_signed, &Arg_comparator::compare_e_int}, |
|
208 |
{&Arg_comparator::compare_row, &Arg_comparator::compare_e_row}, |
|
209 |
{&Arg_comparator::compare_decimal, &Arg_comparator::compare_e_decimal}}; |
|
210 |
||
211 |
const char *log_output_names[] = { "NONE", "FILE", "TABLE", NullS}; |
|
212 |
static const unsigned int log_output_names_len[]= { 4, 4, 5, 0 }; |
|
213 |
TYPELIB log_output_typelib= {array_elements(log_output_names)-1,"", |
|
214 |
log_output_names, |
|
215 |
(unsigned int *) log_output_names_len}; |
|
216 |
||
217 |
/* static variables */
|
|
218 |
||
219 |
/* the default log output is log tables */
|
|
220 |
static bool lower_case_table_names_used= 0; |
|
221 |
static bool volatile select_thread_in_use, signal_thread_in_use; |
|
222 |
static bool volatile ready_to_exit; |
|
77.1.96
by Monty Taylor
Removed skip-external-locking. |
223 |
static bool opt_debugging= 0, opt_console= 0; |
150
by Brian Aker
More bool removal. More cow bell! |
224 |
static bool opt_short_log_format= 0; |
1
by brian
clean slate |
225 |
static uint kill_cached_threads, wake_thread; |
226 |
static ulong killed_threads, thread_created; |
|
227 |
static ulong max_used_connections; |
|
228 |
static volatile ulong cached_thread_count= 0; |
|
229 |
static char *mysqld_user, *mysqld_chroot, *log_error_file_ptr; |
|
230 |
static char *opt_init_slave, *language_ptr, *opt_init_connect; |
|
231 |
static char *default_character_set_name; |
|
232 |
static char *character_set_filesystem_name; |
|
233 |
static char *lc_time_names_name; |
|
234 |
static char *my_bind_addr_str; |
|
235 |
static char *default_collation_name; |
|
236 |
static char *default_storage_engine_str; |
|
237 |
static char compiled_default_collation_name[]= MYSQL_DEFAULT_COLLATION_NAME; |
|
238 |
static I_List<THD> thread_cache; |
|
239 |
static double long_query_time; |
|
240 |
||
241 |
static pthread_cond_t COND_thread_cache, COND_flush_thread_cache; |
|
242 |
||
243 |
/* Global variables */
|
|
244 |
||
92
by Brian Aker
Removed opt_update_log |
245 |
bool opt_bin_log; |
147
by Brian Aker
More my_bool conversion. This time the set_var class. |
246 |
bool opt_log; |
247 |
bool opt_slow_log; |
|
1
by brian
clean slate |
248 |
ulong log_output_options; |
147
by Brian Aker
More my_bool conversion. This time the set_var class. |
249 |
bool opt_log_queries_not_using_indexes= false; |
1
by brian
clean slate |
250 |
bool opt_error_log= IF_WIN(1,0); |
147
by Brian Aker
More my_bool conversion. This time the set_var class. |
251 |
bool opt_disable_networking= false; |
252 |
bool opt_skip_show_db= false; |
|
150
by Brian Aker
More bool removal. More cow bell! |
253 |
bool opt_character_set_client_handshake= 1; |
1
by brian
clean slate |
254 |
bool server_id_supplied = 0; |
255 |
bool opt_endinfo, using_udf_functions; |
|
150
by Brian Aker
More bool removal. More cow bell! |
256 |
bool locked_in_memory; |
1
by brian
clean slate |
257 |
bool opt_using_transactions, using_update_log; |
258 |
bool volatile abort_loop; |
|
259 |
bool volatile shutdown_in_progress; |
|
150
by Brian Aker
More bool removal. More cow bell! |
260 |
bool opt_skip_slave_start = 0; ///< If set, slave is not autostarted |
261 |
bool opt_reckless_slave = 0; |
|
262 |
bool opt_enable_named_pipe= 0; |
|
147
by Brian Aker
More my_bool conversion. This time the set_var class. |
263 |
bool opt_local_infile; |
264 |
bool opt_slave_compressed_protocol; |
|
150
by Brian Aker
More bool removal. More cow bell! |
265 |
bool opt_safe_user_create = 0; |
266 |
bool opt_show_slave_auth_info, opt_sql_bin_update = 0; |
|
267 |
bool opt_log_slave_updates= 0; |
|
1
by brian
clean slate |
268 |
|
269 |
/*
|
|
270 |
Legacy global handlerton. These will be removed (please do not add more).
|
|
271 |
*/
|
|
272 |
handlerton *heap_hton; |
|
273 |
handlerton *myisam_hton; |
|
274 |
||
147
by Brian Aker
More my_bool conversion. This time the set_var class. |
275 |
bool opt_readonly; |
150
by Brian Aker
More bool removal. More cow bell! |
276 |
bool use_temp_pool; |
147
by Brian Aker
More my_bool conversion. This time the set_var class. |
277 |
bool relay_log_purge; |
278 |
bool opt_sync_frm; |
|
279 |
bool opt_secure_auth= false; |
|
1
by brian
clean slate |
280 |
char* opt_secure_file_priv= 0; |
150
by Brian Aker
More bool removal. More cow bell! |
281 |
bool opt_log_slow_admin_statements= 0; |
282 |
bool opt_log_slow_slave_statements= 0; |
|
147
by Brian Aker
More my_bool conversion. This time the set_var class. |
283 |
bool lower_case_file_system= 0; |
150
by Brian Aker
More bool removal. More cow bell! |
284 |
bool opt_old_style_user_limits= 0; |
285 |
bool trust_function_creators= 0; |
|
1
by brian
clean slate |
286 |
/*
|
287 |
True if there is at least one per-hour limit for some user, so we should
|
|
288 |
check them before each query (and possibly reset counters when hour is
|
|
289 |
changed). False otherwise.
|
|
290 |
*/
|
|
150
by Brian Aker
More bool removal. More cow bell! |
291 |
bool opt_noacl; |
1
by brian
clean slate |
292 |
|
293 |
ulong opt_binlog_rows_event_max_size; |
|
294 |
const char *binlog_format_names[]= {"MIXED", "STATEMENT", "ROW", NullS}; |
|
295 |
TYPELIB binlog_format_typelib= |
|
296 |
{ array_elements(binlog_format_names) - 1, "", |
|
297 |
binlog_format_names, NULL }; |
|
298 |
ulong opt_binlog_format_id= (ulong) BINLOG_FORMAT_UNSPEC; |
|
299 |
const char *opt_binlog_format= binlog_format_names[opt_binlog_format_id]; |
|
300 |
#ifdef HAVE_INITGROUPS
|
|
163
by Brian Aker
Merge Monty's code. |
301 |
static bool calling_initgroups= false; /**< Used in SIGSEGV handler. */ |
1
by brian
clean slate |
302 |
#endif
|
303 |
uint mysqld_port, test_flags, select_errors, dropping_tables, ha_open_options; |
|
304 |
uint mysqld_port_timeout; |
|
305 |
uint delay_key_write_options, protocol_version; |
|
306 |
uint lower_case_table_names; |
|
307 |
uint tc_heuristic_recover= 0; |
|
308 |
uint volatile thread_count, thread_running; |
|
151
by Brian Aker
Ulonglong to uint64_t |
309 |
uint64_t thd_startup_options; |
9
by Brian Aker
Warnings cleanup |
310 |
ulong back_log, connect_timeout, server_id; |
1
by brian
clean slate |
311 |
ulong table_cache_size, table_def_size; |
312 |
ulong what_to_log; |
|
313 |
ulong query_buff_size, slow_launch_time, slave_open_temp_tables; |
|
314 |
ulong open_files_limit, max_binlog_size, max_relay_log_size; |
|
315 |
ulong slave_net_timeout, slave_trans_retries; |
|
147
by Brian Aker
More my_bool conversion. This time the set_var class. |
316 |
bool slave_allow_batching; |
1
by brian
clean slate |
317 |
ulong slave_exec_mode_options; |
318 |
const char *slave_exec_mode_str= "STRICT"; |
|
319 |
ulong thread_cache_size=0, thread_pool_size= 0; |
|
320 |
ulong binlog_cache_size=0, max_binlog_cache_size=0; |
|
321 |
ulong refresh_version; /* Increments on each reload */ |
|
322 |
query_id_t global_query_id; |
|
323 |
ulong aborted_threads, aborted_connects; |
|
324 |
ulong specialflag=0; |
|
325 |
ulong binlog_cache_use= 0, binlog_cache_disk_use= 0; |
|
326 |
ulong max_connections, max_connect_errors; |
|
327 |
uint max_user_connections= 0; |
|
328 |
ulong thread_id=1L,current_pid; |
|
329 |
ulong slow_launch_threads = 0, sync_binlog_period; |
|
330 |
ulong expire_logs_days = 0; |
|
331 |
ulong rpl_recovery_rank=0; |
|
332 |
const char *log_output_str= "FILE"; |
|
333 |
||
334 |
const double log_10[] = { |
|
335 |
1e000, 1e001, 1e002, 1e003, 1e004, 1e005, 1e006, 1e007, 1e008, 1e009, |
|
336 |
1e010, 1e011, 1e012, 1e013, 1e014, 1e015, 1e016, 1e017, 1e018, 1e019, |
|
337 |
1e020, 1e021, 1e022, 1e023, 1e024, 1e025, 1e026, 1e027, 1e028, 1e029, |
|
338 |
1e030, 1e031, 1e032, 1e033, 1e034, 1e035, 1e036, 1e037, 1e038, 1e039, |
|
339 |
1e040, 1e041, 1e042, 1e043, 1e044, 1e045, 1e046, 1e047, 1e048, 1e049, |
|
340 |
1e050, 1e051, 1e052, 1e053, 1e054, 1e055, 1e056, 1e057, 1e058, 1e059, |
|
341 |
1e060, 1e061, 1e062, 1e063, 1e064, 1e065, 1e066, 1e067, 1e068, 1e069, |
|
342 |
1e070, 1e071, 1e072, 1e073, 1e074, 1e075, 1e076, 1e077, 1e078, 1e079, |
|
343 |
1e080, 1e081, 1e082, 1e083, 1e084, 1e085, 1e086, 1e087, 1e088, 1e089, |
|
344 |
1e090, 1e091, 1e092, 1e093, 1e094, 1e095, 1e096, 1e097, 1e098, 1e099, |
|
345 |
1e100, 1e101, 1e102, 1e103, 1e104, 1e105, 1e106, 1e107, 1e108, 1e109, |
|
346 |
1e110, 1e111, 1e112, 1e113, 1e114, 1e115, 1e116, 1e117, 1e118, 1e119, |
|
347 |
1e120, 1e121, 1e122, 1e123, 1e124, 1e125, 1e126, 1e127, 1e128, 1e129, |
|
348 |
1e130, 1e131, 1e132, 1e133, 1e134, 1e135, 1e136, 1e137, 1e138, 1e139, |
|
349 |
1e140, 1e141, 1e142, 1e143, 1e144, 1e145, 1e146, 1e147, 1e148, 1e149, |
|
350 |
1e150, 1e151, 1e152, 1e153, 1e154, 1e155, 1e156, 1e157, 1e158, 1e159, |
|
351 |
1e160, 1e161, 1e162, 1e163, 1e164, 1e165, 1e166, 1e167, 1e168, 1e169, |
|
352 |
1e170, 1e171, 1e172, 1e173, 1e174, 1e175, 1e176, 1e177, 1e178, 1e179, |
|
353 |
1e180, 1e181, 1e182, 1e183, 1e184, 1e185, 1e186, 1e187, 1e188, 1e189, |
|
354 |
1e190, 1e191, 1e192, 1e193, 1e194, 1e195, 1e196, 1e197, 1e198, 1e199, |
|
355 |
1e200, 1e201, 1e202, 1e203, 1e204, 1e205, 1e206, 1e207, 1e208, 1e209, |
|
356 |
1e210, 1e211, 1e212, 1e213, 1e214, 1e215, 1e216, 1e217, 1e218, 1e219, |
|
357 |
1e220, 1e221, 1e222, 1e223, 1e224, 1e225, 1e226, 1e227, 1e228, 1e229, |
|
358 |
1e230, 1e231, 1e232, 1e233, 1e234, 1e235, 1e236, 1e237, 1e238, 1e239, |
|
359 |
1e240, 1e241, 1e242, 1e243, 1e244, 1e245, 1e246, 1e247, 1e248, 1e249, |
|
360 |
1e250, 1e251, 1e252, 1e253, 1e254, 1e255, 1e256, 1e257, 1e258, 1e259, |
|
361 |
1e260, 1e261, 1e262, 1e263, 1e264, 1e265, 1e266, 1e267, 1e268, 1e269, |
|
362 |
1e270, 1e271, 1e272, 1e273, 1e274, 1e275, 1e276, 1e277, 1e278, 1e279, |
|
363 |
1e280, 1e281, 1e282, 1e283, 1e284, 1e285, 1e286, 1e287, 1e288, 1e289, |
|
364 |
1e290, 1e291, 1e292, 1e293, 1e294, 1e295, 1e296, 1e297, 1e298, 1e299, |
|
365 |
1e300, 1e301, 1e302, 1e303, 1e304, 1e305, 1e306, 1e307, 1e308 |
|
366 |
};
|
|
367 |
||
368 |
time_t server_start_time, flush_status_time; |
|
369 |
||
370 |
char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], system_time_zone[30]; |
|
371 |
char *default_tz_name; |
|
372 |
char log_error_file[FN_REFLEN], glob_hostname[FN_REFLEN]; |
|
373 |
char mysql_real_data_home[FN_REFLEN], |
|
374 |
language[FN_REFLEN], reg_ext[FN_EXTLEN], mysql_charsets_dir[FN_REFLEN], |
|
375 |
*opt_init_file, *opt_tc_log_file; |
|
376 |
char mysql_unpacked_real_data_home[FN_REFLEN]; |
|
377 |
uint reg_ext_length; |
|
378 |
const key_map key_map_empty(0); |
|
379 |
key_map key_map_full(0); // Will be initialized later |
|
380 |
||
381 |
const char *opt_date_time_formats[3]; |
|
382 |
||
383 |
uint mysql_data_home_len; |
|
384 |
char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home; |
|
385 |
char server_version[SERVER_VERSION_LENGTH]; |
|
11
by Brian Aker
Removing old UNIX socket bits |
386 |
char *opt_mysql_tmpdir; |
1
by brian
clean slate |
387 |
const char **errmesg; /**< Error messages */ |
388 |
const char *myisam_recover_options_str="OFF"; |
|
389 |
const char *myisam_stats_method_str="nulls_unequal"; |
|
390 |
||
391 |
/** name of reference on left espression in rewritten IN subquery */
|
|
392 |
const char *in_left_expr_name= "<left expr>"; |
|
393 |
/** name of additional condition */
|
|
394 |
const char *in_additional_cond= "<IN COND>"; |
|
395 |
const char *in_having_cond= "<IN HAVING>"; |
|
396 |
||
397 |
my_decimal decimal_zero; |
|
398 |
/* classes for comparation parsing/processing */
|
|
399 |
Eq_creator eq_creator; |
|
400 |
Ne_creator ne_creator; |
|
401 |
Gt_creator gt_creator; |
|
402 |
Lt_creator lt_creator; |
|
403 |
Ge_creator ge_creator; |
|
404 |
Le_creator le_creator; |
|
405 |
||
406 |
FILE *bootstrap_file; |
|
407 |
int bootstrap_error; |
|
408 |
FILE *stderror_file=0; |
|
409 |
||
410 |
I_List<THD> threads; |
|
411 |
I_List<NAMED_LIST> key_caches; |
|
412 |
Rpl_filter* rpl_filter; |
|
413 |
Rpl_filter* binlog_filter; |
|
414 |
||
415 |
struct system_variables global_system_variables; |
|
416 |
struct system_variables max_system_variables; |
|
417 |
struct system_status_var global_status_var; |
|
418 |
||
419 |
MY_TMPDIR mysql_tmpdir_list; |
|
420 |
MY_BITMAP temp_pool; |
|
421 |
||
422 |
CHARSET_INFO *system_charset_info, *files_charset_info ; |
|
423 |
CHARSET_INFO *national_charset_info, *table_alias_charset; |
|
424 |
CHARSET_INFO *character_set_filesystem; |
|
425 |
||
426 |
MY_LOCALE *my_default_lc_time_names; |
|
427 |
||
177.3.1
by mark
remove ifdef HAVE_DLOPEN, make configure require dlopen() |
428 |
SHOW_COMP_OPTION have_symlink; |
429 |
SHOW_COMP_OPTION have_crypt; |
|
430 |
SHOW_COMP_OPTION have_compress; |
|
1
by brian
clean slate |
431 |
|
432 |
/* Thread specific variables */
|
|
433 |
||
434 |
pthread_key(MEM_ROOT**,THR_MALLOC); |
|
435 |
pthread_key(THD*, THR_THD); |
|
436 |
pthread_mutex_t LOCK_mysql_create_db, LOCK_open, LOCK_thread_count, |
|
437 |
LOCK_mapped_file, LOCK_status, LOCK_global_read_lock, |
|
438 |
LOCK_error_log, LOCK_uuid_generator, |
|
12
by Brian Aker
More dead code removal. |
439 |
LOCK_crypt, |
1
by brian
clean slate |
440 |
LOCK_global_system_variables, |
441 |
LOCK_user_conn, LOCK_slave_list, LOCK_active_mi, |
|
442 |
LOCK_connection_count; |
|
443 |
||
444 |
rw_lock_t LOCK_sys_init_connect, LOCK_sys_init_slave; |
|
445 |
rw_lock_t LOCK_system_variables_hash; |
|
446 |
pthread_cond_t COND_refresh, COND_thread_count, COND_global_read_lock; |
|
447 |
pthread_t signal_thread; |
|
448 |
pthread_attr_t connection_attrib; |
|
449 |
pthread_cond_t COND_server_started; |
|
450 |
||
451 |
/* replication parameters, if master_host is not NULL, we are a slave */
|
|
452 |
uint report_port= MYSQL_PORT; |
|
130
by Brian Aker
ulong cleanup |
453 |
uint32_t master_retry_count= 0; |
1
by brian
clean slate |
454 |
char *master_info_file; |
455 |
char *relay_log_info_file, *report_user, *report_password, *report_host; |
|
456 |
char *opt_relay_logname = 0, *opt_relaylog_index_name=0; |
|
457 |
char *opt_logname, *opt_slow_logname; |
|
458 |
||
459 |
/* Static variables */
|
|
460 |
||
461 |
static bool kill_in_progress, segfaulted; |
|
462 |
#ifdef HAVE_STACK_TRACE_ON_SEGV
|
|
150
by Brian Aker
More bool removal. More cow bell! |
463 |
static bool opt_do_pstack; |
1
by brian
clean slate |
464 |
#endif /* HAVE_STACK_TRACE_ON_SEGV */ |
150
by Brian Aker
More bool removal. More cow bell! |
465 |
static bool opt_bootstrap, opt_myisam_log; |
1
by brian
clean slate |
466 |
static int cleanup_done; |
467 |
static ulong opt_specialflag, opt_myisam_block_size; |
|
92
by Brian Aker
Removed opt_update_log |
468 |
static char *opt_binlog_index_name; |
1
by brian
clean slate |
469 |
static char *opt_tc_heuristic_recover; |
470 |
static char *mysql_home_ptr, *pidfile_name_ptr; |
|
471 |
static int defaults_argc; |
|
472 |
static char **defaults_argv; |
|
473 |
static char *opt_bin_logname; |
|
474 |
||
11
by Brian Aker
Removing old UNIX socket bits |
475 |
static my_socket ip_sock; |
1
by brian
clean slate |
476 |
struct rand_struct sql_rand; ///< used by sql_class.cc:THD::THD() |
477 |
||
478 |
struct passwd *user_info; |
|
479 |
static pthread_t select_thread; |
|
480 |
static uint thr_kill_signal; |
|
481 |
||
482 |
/* OS specific variables */
|
|
483 |
||
484 |
bool mysqld_embedded=0; |
|
485 |
||
486 |
scheduler_functions thread_scheduler; |
|
487 |
||
488 |
/**
|
|
489 |
Number of currently active user connections. The variable is protected by
|
|
490 |
LOCK_connection_count.
|
|
491 |
*/
|
|
492 |
uint connection_count= 0; |
|
493 |
||
494 |
/* Function declarations */
|
|
495 |
||
496 |
pthread_handler_t signal_hand(void *arg); |
|
497 |
static void mysql_init_variables(void); |
|
498 |
static void get_options(int *argc,char **argv); |
|
143
by Brian Aker
Bool cleanup. |
499 |
extern "C" bool mysqld_get_one_option(int, const struct my_option *, char *); |
1
by brian
clean slate |
500 |
static void set_server_version(void); |
501 |
static int init_thread_environment(); |
|
502 |
static char *get_relative_path(const char *path); |
|
503 |
static void fix_paths(void); |
|
11
by Brian Aker
Removing old UNIX socket bits |
504 |
void handle_connections_sockets(); |
1
by brian
clean slate |
505 |
pthread_handler_t kill_server_thread(void *arg); |
506 |
pthread_handler_t handle_slave(void *arg); |
|
507 |
static ulong find_bit_type(const char *x, TYPELIB *bit_lib); |
|
508 |
static ulong find_bit_type_or_exit(const char *x, TYPELIB *bit_lib, |
|
509 |
const char *option); |
|
510 |
static void clean_up(bool print_message); |
|
511 |
static int test_if_case_insensitive(const char *dir_name); |
|
512 |
||
513 |
static void usage(void); |
|
514 |
static void start_signal_handler(void); |
|
515 |
static void close_server_sock(); |
|
516 |
static void clean_up_mutexes(void); |
|
517 |
static void wait_for_signal_thread_to_end(void); |
|
518 |
static void create_pid_file(); |
|
519 |
static void mysqld_exit(int exit_code) __attribute__((noreturn)); |
|
520 |
||
521 |
/****************************************************************************
|
|
522 |
** Code to end mysqld
|
|
523 |
****************************************************************************/
|
|
524 |
||
525 |
static void close_connections(void) |
|
526 |
{
|
|
527 |
#ifdef EXTRA_DEBUG
|
|
528 |
int count=0; |
|
529 |
#endif
|
|
530 |
||
531 |
/* Clear thread cache */
|
|
532 |
kill_cached_threads++; |
|
533 |
flush_thread_cache(); |
|
534 |
||
535 |
/* kill connection thread */
|
|
536 |
(void) pthread_mutex_lock(&LOCK_thread_count); |
|
537 |
||
538 |
while (select_thread_in_use) |
|
539 |
{
|
|
540 |
struct timespec abstime; |
|
541 |
int error; |
|
542 |
||
543 |
#ifndef DONT_USE_THR_ALARM
|
|
544 |
if (pthread_kill(select_thread, thr_client_alarm)) |
|
545 |
break; // allready dead |
|
546 |
#endif
|
|
547 |
set_timespec(abstime, 2); |
|
548 |
for (uint tmp=0 ; tmp < 10 && select_thread_in_use; tmp++) |
|
549 |
{
|
|
550 |
error=pthread_cond_timedwait(&COND_thread_count,&LOCK_thread_count, |
|
551 |
&abstime); |
|
552 |
if (error != EINTR) |
|
553 |
break; |
|
554 |
}
|
|
555 |
#ifdef EXTRA_DEBUG
|
|
556 |
if (error != 0 && !count++) |
|
557 |
sql_print_error("Got error %d from pthread_cond_timedwait",error); |
|
558 |
#endif
|
|
559 |
close_server_sock(); |
|
560 |
}
|
|
561 |
(void) pthread_mutex_unlock(&LOCK_thread_count); |
|
562 |
||
563 |
||
564 |
/* Abort listening to new connections */
|
|
565 |
if (!opt_disable_networking ) |
|
566 |
{
|
|
567 |
if (ip_sock != INVALID_SOCKET) |
|
568 |
{
|
|
569 |
(void) shutdown(ip_sock, SHUT_RDWR); |
|
570 |
(void) closesocket(ip_sock); |
|
571 |
ip_sock= INVALID_SOCKET; |
|
572 |
}
|
|
573 |
}
|
|
574 |
end_thr_alarm(0); // Abort old alarms. |
|
575 |
||
576 |
/*
|
|
577 |
First signal all threads that it's time to die
|
|
578 |
This will give the threads some time to gracefully abort their
|
|
579 |
statements and inform their clients that the server is about to die.
|
|
580 |
*/
|
|
581 |
||
582 |
THD *tmp; |
|
583 |
(void) pthread_mutex_lock(&LOCK_thread_count); // For unlink from list |
|
584 |
||
585 |
I_List_iterator<THD> it(threads); |
|
586 |
while ((tmp=it++)) |
|
587 |
{
|
|
588 |
/* We skip slave threads & scheduler on this first loop through. */
|
|
589 |
if (tmp->slave_thread) |
|
590 |
continue; |
|
591 |
||
592 |
tmp->killed= THD::KILL_CONNECTION; |
|
593 |
thread_scheduler.post_kill_notification(tmp); |
|
594 |
if (tmp->mysys_var) |
|
595 |
{
|
|
596 |
tmp->mysys_var->abort=1; |
|
597 |
pthread_mutex_lock(&tmp->mysys_var->mutex); |
|
598 |
if (tmp->mysys_var->current_cond) |
|
599 |
{
|
|
600 |
pthread_mutex_lock(tmp->mysys_var->current_mutex); |
|
601 |
pthread_cond_broadcast(tmp->mysys_var->current_cond); |
|
602 |
pthread_mutex_unlock(tmp->mysys_var->current_mutex); |
|
603 |
}
|
|
604 |
pthread_mutex_unlock(&tmp->mysys_var->mutex); |
|
605 |
}
|
|
606 |
}
|
|
607 |
(void) pthread_mutex_unlock(&LOCK_thread_count); // For unlink from list |
|
608 |
||
609 |
end_slave(); |
|
610 |
||
611 |
if (thread_count) |
|
612 |
sleep(2); // Give threads time to die |
|
613 |
||
614 |
/*
|
|
615 |
Force remaining threads to die by closing the connection to the client
|
|
616 |
This will ensure that threads that are waiting for a command from the
|
|
617 |
client on a blocking read call are aborted.
|
|
618 |
*/
|
|
619 |
||
620 |
for (;;) |
|
621 |
{
|
|
622 |
(void) pthread_mutex_lock(&LOCK_thread_count); // For unlink from list |
|
623 |
if (!(tmp=threads.get())) |
|
624 |
{
|
|
625 |
(void) pthread_mutex_unlock(&LOCK_thread_count); |
|
626 |
break; |
|
627 |
}
|
|
628 |
if (tmp->vio_ok()) |
|
629 |
{
|
|
630 |
if (global_system_variables.log_warnings) |
|
631 |
sql_print_warning(ER(ER_FORCING_CLOSE),my_progname, |
|
632 |
tmp->thread_id, |
|
633 |
(tmp->main_security_ctx.user ? |
|
634 |
tmp->main_security_ctx.user : "")); |
|
635 |
close_connection(tmp,0,0); |
|
636 |
}
|
|
637 |
(void) pthread_mutex_unlock(&LOCK_thread_count); |
|
638 |
}
|
|
639 |
/* All threads has now been aborted */
|
|
640 |
(void) pthread_mutex_lock(&LOCK_thread_count); |
|
641 |
while (thread_count) |
|
642 |
{
|
|
643 |
(void) pthread_cond_wait(&COND_thread_count,&LOCK_thread_count); |
|
644 |
}
|
|
645 |
(void) pthread_mutex_unlock(&LOCK_thread_count); |
|
646 |
||
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
647 |
return;; |
1
by brian
clean slate |
648 |
}
|
649 |
||
650 |
||
651 |
static void close_server_sock() |
|
652 |
{
|
|
653 |
#ifdef HAVE_CLOSE_SERVER_SOCK
|
|
654 |
my_socket tmp_sock; |
|
655 |
tmp_sock=ip_sock; |
|
656 |
if (tmp_sock != INVALID_SOCKET) |
|
657 |
{
|
|
658 |
ip_sock=INVALID_SOCKET; |
|
659 |
VOID(shutdown(tmp_sock, SHUT_RDWR)); |
|
660 |
}
|
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
661 |
return;; |
1
by brian
clean slate |
662 |
#endif
|
663 |
}
|
|
664 |
||
665 |
||
666 |
void kill_mysql(void) |
|
667 |
{
|
|
668 |
||
669 |
#if defined(SIGNALS_DONT_BREAK_READ)
|
|
670 |
abort_loop=1; // Break connection loops |
|
671 |
close_server_sock(); // Force accept to wake up |
|
672 |
#endif
|
|
673 |
||
674 |
#if defined(HAVE_PTHREAD_KILL)
|
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
675 |
pthread_kill(signal_thread, MYSQL_KILL_SIGNAL); |
1
by brian
clean slate |
676 |
#elif !defined(SIGNALS_DONT_BREAK_READ)
|
677 |
kill(current_pid, MYSQL_KILL_SIGNAL); |
|
678 |
#endif
|
|
679 |
shutdown_in_progress=1; // Safety if kill didn't work |
|
680 |
#ifdef SIGNALS_DONT_BREAK_READ
|
|
681 |
if (!kill_in_progress) |
|
682 |
{
|
|
683 |
pthread_t tmp; |
|
684 |
abort_loop=1; |
|
685 |
if (pthread_create(&tmp,&connection_attrib, kill_server_thread, |
|
686 |
(void*) 0)) |
|
687 |
sql_print_error("Can't create thread to kill server"); |
|
688 |
}
|
|
689 |
#endif
|
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
690 |
return;; |
1
by brian
clean slate |
691 |
}
|
692 |
||
693 |
/**
|
|
694 |
Force server down. Kill all connections and threads and exit.
|
|
695 |
||
696 |
@param sig_ptr Signal number that caused kill_server to be called.
|
|
697 |
||
698 |
@note
|
|
699 |
A signal number of 0 mean that the function was not called
|
|
700 |
from a signal handler and there is thus no signal to block
|
|
701 |
or stop, we just want to kill the server.
|
|
702 |
*/
|
|
703 |
||
704 |
static void *kill_server(void *sig_ptr) |
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
705 |
#define RETURN_FROM_KILL_SERVER return(0)
|
1
by brian
clean slate |
706 |
{
|
707 |
int sig=(int) (long) sig_ptr; // This is passed a int |
|
708 |
// if there is a signal during the kill in progress, ignore the other
|
|
709 |
if (kill_in_progress) // Safety |
|
710 |
RETURN_FROM_KILL_SERVER; |
|
163
by Brian Aker
Merge Monty's code. |
711 |
kill_in_progress=true; |
1
by brian
clean slate |
712 |
abort_loop=1; // This should be set |
713 |
if (sig != 0) // 0 is not a valid signal number |
|
714 |
my_sigset(sig, SIG_IGN); /* purify inspected */ |
|
715 |
if (sig == MYSQL_KILL_SIGNAL || sig == 0) |
|
716 |
sql_print_information(ER(ER_NORMAL_SHUTDOWN),my_progname); |
|
717 |
else
|
|
718 |
sql_print_error(ER(ER_GOT_SIGNAL),my_progname,sig); /* purecov: inspected */ |
|
719 |
||
720 |
close_connections(); |
|
721 |
if (sig != MYSQL_KILL_SIGNAL && |
|
722 |
sig != 0) |
|
723 |
unireg_abort(1); /* purecov: inspected */ |
|
724 |
else
|
|
725 |
unireg_end(); |
|
726 |
||
727 |
/* purecov: begin deadcode */
|
|
728 |
||
729 |
my_thread_end(); |
|
730 |
pthread_exit(0); |
|
731 |
/* purecov: end */
|
|
732 |
||
733 |
RETURN_FROM_KILL_SERVER; |
|
734 |
}
|
|
735 |
||
736 |
||
737 |
#if defined(USE_ONE_SIGNAL_HAND)
|
|
738 |
pthread_handler_t kill_server_thread(void *arg __attribute__((unused))) |
|
739 |
{
|
|
740 |
my_thread_init(); // Initialize new thread |
|
741 |
kill_server(0); |
|
742 |
/* purecov: begin deadcode */
|
|
743 |
my_thread_end(); |
|
744 |
pthread_exit(0); |
|
745 |
return 0; |
|
746 |
/* purecov: end */
|
|
747 |
}
|
|
748 |
#endif
|
|
749 |
||
750 |
||
751 |
extern "C" sig_handler print_signal_warning(int sig) |
|
752 |
{
|
|
753 |
if (global_system_variables.log_warnings) |
|
754 |
sql_print_warning("Got signal %d from thread %ld", sig,my_thread_id()); |
|
755 |
#ifdef DONT_REMEMBER_SIGNAL
|
|
756 |
my_sigset(sig,print_signal_warning); /* int. thread system calls */ |
|
757 |
#endif
|
|
758 |
if (sig == SIGALRM) |
|
759 |
alarm(2); /* reschedule alarm */ |
|
760 |
}
|
|
761 |
||
762 |
/**
|
|
763 |
cleanup all memory and end program nicely.
|
|
764 |
||
765 |
If SIGNALS_DONT_BREAK_READ is defined, this function is called
|
|
766 |
by the main thread. To get MySQL to shut down nicely in this case
|
|
767 |
(Mac OS X) we have to call exit() instead if pthread_exit().
|
|
768 |
||
769 |
@note
|
|
770 |
This function never returns.
|
|
771 |
*/
|
|
772 |
void unireg_end(void) |
|
773 |
{
|
|
774 |
clean_up(1); |
|
775 |
my_thread_end(); |
|
776 |
#if defined(SIGNALS_DONT_BREAK_READ)
|
|
777 |
exit(0); |
|
778 |
#else
|
|
779 |
pthread_exit(0); // Exit is in main thread |
|
780 |
#endif
|
|
781 |
}
|
|
782 |
||
783 |
||
784 |
extern "C" void unireg_abort(int exit_code) |
|
785 |
{
|
|
786 |
||
787 |
if (exit_code) |
|
788 |
sql_print_error("Aborting\n"); |
|
789 |
else if (opt_help) |
|
790 |
usage(); |
|
791 |
clean_up(!opt_help && (exit_code || !opt_bootstrap)); /* purecov: inspected */ |
|
792 |
mysqld_exit(exit_code); |
|
793 |
}
|
|
794 |
||
795 |
||
796 |
static void mysqld_exit(int exit_code) |
|
797 |
{
|
|
798 |
wait_for_signal_thread_to_end(); |
|
799 |
clean_up_mutexes(); |
|
800 |
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0); |
|
801 |
exit(exit_code); /* purecov: inspected */ |
|
802 |
}
|
|
803 |
||
804 |
||
805 |
void clean_up(bool print_message) |
|
806 |
{
|
|
807 |
if (cleanup_done++) |
|
808 |
return; /* purecov: inspected */ |
|
809 |
||
810 |
/*
|
|
811 |
make sure that handlers finish up
|
|
812 |
what they have that is dependent on the binlog
|
|
813 |
*/
|
|
814 |
ha_binlog_end(current_thd); |
|
815 |
||
816 |
logger.cleanup_base(); |
|
817 |
||
818 |
mysql_bin_log.cleanup(); |
|
819 |
||
820 |
if (use_slave_mask) |
|
821 |
bitmap_free(&slave_error_mask); |
|
822 |
my_database_names_free(); |
|
823 |
table_cache_free(); |
|
824 |
table_def_free(); |
|
825 |
lex_free(); /* Free some memory */ |
|
826 |
item_create_cleanup(); |
|
827 |
set_var_free(); |
|
828 |
free_charsets(); |
|
829 |
udf_free(); |
|
830 |
plugin_shutdown(); |
|
831 |
ha_end(); |
|
832 |
if (tc_log) |
|
833 |
tc_log->close(); |
|
834 |
xid_cache_free(); |
|
835 |
delete_elements(&key_caches, (void (*)(const char*, uchar*)) free_key_cache); |
|
836 |
multi_keycache_free(); |
|
837 |
free_status_vars(); |
|
838 |
end_thr_alarm(1); /* Free allocated memory */ |
|
839 |
my_free_open_file_info(); |
|
840 |
my_free((char*) global_system_variables.date_format, |
|
841 |
MYF(MY_ALLOW_ZERO_PTR)); |
|
842 |
my_free((char*) global_system_variables.time_format, |
|
843 |
MYF(MY_ALLOW_ZERO_PTR)); |
|
844 |
my_free((char*) global_system_variables.datetime_format, |
|
845 |
MYF(MY_ALLOW_ZERO_PTR)); |
|
846 |
if (defaults_argv) |
|
847 |
free_defaults(defaults_argv); |
|
848 |
my_free(sys_init_connect.value, MYF(MY_ALLOW_ZERO_PTR)); |
|
849 |
my_free(sys_init_slave.value, MYF(MY_ALLOW_ZERO_PTR)); |
|
850 |
my_free(sys_var_general_log_path.value, MYF(MY_ALLOW_ZERO_PTR)); |
|
851 |
my_free(sys_var_slow_log_path.value, MYF(MY_ALLOW_ZERO_PTR)); |
|
852 |
free_tmpdir(&mysql_tmpdir_list); |
|
853 |
my_free(slave_load_tmpdir,MYF(MY_ALLOW_ZERO_PTR)); |
|
854 |
x_free(opt_bin_logname); |
|
855 |
x_free(opt_relay_logname); |
|
856 |
x_free(opt_secure_file_priv); |
|
857 |
bitmap_free(&temp_pool); |
|
858 |
end_slave_list(); |
|
859 |
delete binlog_filter; |
|
860 |
delete rpl_filter; |
|
861 |
vio_end(); |
|
862 |
||
863 |
if (!opt_bootstrap) |
|
864 |
(void) my_delete(pidfile_name,MYF(0)); // This may not always exist |
|
865 |
if (print_message && errmesg && server_start_time) |
|
866 |
sql_print_information(ER(ER_SHUTDOWN_COMPLETE),my_progname); |
|
867 |
thread_scheduler.end(); |
|
868 |
finish_client_errs(); |
|
869 |
my_free((uchar*) my_error_unregister(ER_ERROR_FIRST, ER_ERROR_LAST), |
|
870 |
MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); |
|
871 |
/* Tell main we are ready */
|
|
872 |
logger.cleanup_end(); |
|
873 |
(void) pthread_mutex_lock(&LOCK_thread_count); |
|
874 |
ready_to_exit=1; |
|
875 |
/* do the broadcast inside the lock to ensure that my_end() is not called */
|
|
876 |
(void) pthread_cond_broadcast(&COND_thread_count); |
|
877 |
(void) pthread_mutex_unlock(&LOCK_thread_count); |
|
878 |
||
879 |
/*
|
|
880 |
The following lines may never be executed as the main thread may have
|
|
881 |
killed us
|
|
882 |
*/
|
|
883 |
} /* clean_up */ |
|
884 |
||
885 |
||
886 |
/**
|
|
887 |
This is mainly needed when running with purify, but it's still nice to
|
|
888 |
know that all child threads have died when mysqld exits.
|
|
889 |
*/
|
|
890 |
static void wait_for_signal_thread_to_end() |
|
891 |
{
|
|
892 |
uint i; |
|
893 |
/*
|
|
894 |
Wait up to 10 seconds for signal thread to die. We use this mainly to
|
|
895 |
avoid getting warnings that my_thread_end has not been called
|
|
896 |
*/
|
|
897 |
for (i= 0 ; i < 100 && signal_thread_in_use; i++) |
|
898 |
{
|
|
899 |
if (pthread_kill(signal_thread, MYSQL_KILL_SIGNAL) != ESRCH) |
|
900 |
break; |
|
901 |
my_sleep(100); // Give it time to die |
|
902 |
}
|
|
903 |
}
|
|
904 |
||
905 |
||
906 |
static void clean_up_mutexes() |
|
907 |
{
|
|
908 |
(void) pthread_mutex_destroy(&LOCK_mysql_create_db); |
|
909 |
(void) pthread_mutex_destroy(&LOCK_lock_db); |
|
910 |
(void) pthread_mutex_destroy(&LOCK_open); |
|
911 |
(void) pthread_mutex_destroy(&LOCK_thread_count); |
|
912 |
(void) pthread_mutex_destroy(&LOCK_mapped_file); |
|
913 |
(void) pthread_mutex_destroy(&LOCK_status); |
|
914 |
(void) pthread_mutex_destroy(&LOCK_error_log); |
|
915 |
(void) pthread_mutex_destroy(&LOCK_crypt); |
|
916 |
(void) pthread_mutex_destroy(&LOCK_user_conn); |
|
917 |
(void) pthread_mutex_destroy(&LOCK_connection_count); |
|
918 |
(void) pthread_mutex_destroy(&LOCK_rpl_status); |
|
919 |
(void) pthread_cond_destroy(&COND_rpl_status); |
|
920 |
(void) pthread_mutex_destroy(&LOCK_active_mi); |
|
921 |
(void) rwlock_destroy(&LOCK_sys_init_connect); |
|
922 |
(void) rwlock_destroy(&LOCK_sys_init_slave); |
|
923 |
(void) pthread_mutex_destroy(&LOCK_global_system_variables); |
|
924 |
(void) rwlock_destroy(&LOCK_system_variables_hash); |
|
925 |
(void) pthread_mutex_destroy(&LOCK_global_read_lock); |
|
926 |
(void) pthread_mutex_destroy(&LOCK_uuid_generator); |
|
927 |
(void) pthread_cond_destroy(&COND_thread_count); |
|
928 |
(void) pthread_cond_destroy(&COND_refresh); |
|
929 |
(void) pthread_cond_destroy(&COND_global_read_lock); |
|
930 |
(void) pthread_cond_destroy(&COND_thread_cache); |
|
931 |
(void) pthread_cond_destroy(&COND_flush_thread_cache); |
|
932 |
}
|
|
933 |
||
934 |
||
935 |
/****************************************************************************
|
|
936 |
** Init IP and UNIX socket
|
|
937 |
****************************************************************************/
|
|
938 |
||
939 |
static void set_ports() |
|
940 |
{
|
|
941 |
char *env; |
|
942 |
if (!mysqld_port && !opt_disable_networking) |
|
943 |
{ // Get port if not from commandline |
|
944 |
mysqld_port= MYSQL_PORT; |
|
945 |
||
946 |
/*
|
|
947 |
if builder specifically requested a default port, use that
|
|
948 |
(even if it coincides with our factory default).
|
|
949 |
only if they didn't do we check /etc/services (and, failing
|
|
165.1.1
by Elliot Murphy
new port number from IANA |
950 |
on that, fall back to the factory default of 4427).
|
1
by brian
clean slate |
951 |
either default can be overridden by the environment variable
|
952 |
MYSQL_TCP_PORT, which in turn can be overridden with command
|
|
953 |
line options.
|
|
954 |
*/
|
|
955 |
||
956 |
#if MYSQL_PORT_DEFAULT == 0
|
|
957 |
struct servent *serv_ptr; |
|
958 |
if ((serv_ptr= getservbyname("mysql", "tcp"))) |
|
959 |
mysqld_port= ntohs((u_short) serv_ptr->s_port); /* purecov: inspected */ |
|
960 |
#endif
|
|
961 |
if ((env = getenv("MYSQL_TCP_PORT"))) |
|
962 |
mysqld_port= (uint) atoi(env); /* purecov: inspected */ |
|
963 |
}
|
|
964 |
}
|
|
965 |
||
966 |
/* Change to run as another user if started with --user */
|
|
967 |
||
968 |
static struct passwd *check_user(const char *user) |
|
969 |
{
|
|
970 |
struct passwd *tmp_user_info; |
|
971 |
uid_t user_id= geteuid(); |
|
972 |
||
973 |
// Don't bother if we aren't superuser
|
|
974 |
if (user_id) |
|
975 |
{
|
|
976 |
if (user) |
|
977 |
{
|
|
978 |
/* Don't give a warning, if real user is same as given with --user */
|
|
979 |
/* purecov: begin tested */
|
|
980 |
tmp_user_info= getpwnam(user); |
|
981 |
if ((!tmp_user_info || user_id != tmp_user_info->pw_uid) && |
|
982 |
global_system_variables.log_warnings) |
|
983 |
sql_print_warning( |
|
984 |
"One can only use the --user switch if running as root\n"); |
|
985 |
/* purecov: end */
|
|
986 |
}
|
|
987 |
return NULL; |
|
988 |
}
|
|
989 |
if (!user) |
|
990 |
{
|
|
991 |
if (!opt_bootstrap) |
|
992 |
{
|
|
993 |
sql_print_error("Fatal error: Please read \"Security\" section of the manual to find out how to run mysqld as root!\n"); |
|
994 |
unireg_abort(1); |
|
995 |
}
|
|
996 |
return NULL; |
|
997 |
}
|
|
998 |
/* purecov: begin tested */
|
|
999 |
if (!strcmp(user,"root")) |
|
1000 |
return NULL; // Avoid problem with dynamic libraries |
|
1001 |
||
1002 |
if (!(tmp_user_info= getpwnam(user))) |
|
1003 |
{
|
|
1004 |
// Allow a numeric uid to be used
|
|
1005 |
const char *pos; |
|
1006 |
for (pos= user; my_isdigit(mysqld_charset,*pos); pos++) ; |
|
1007 |
if (*pos) // Not numeric id |
|
1008 |
goto err; |
|
1009 |
if (!(tmp_user_info= getpwuid(atoi(user)))) |
|
1010 |
goto err; |
|
1011 |
}
|
|
1012 |
return tmp_user_info; |
|
1013 |
/* purecov: end */
|
|
1014 |
||
1015 |
err: |
|
1016 |
sql_print_error("Fatal error: Can't change to run as user '%s' ; Please check that the user exists!\n",user); |
|
1017 |
unireg_abort(1); |
|
1018 |
||
1019 |
#ifdef PR_SET_DUMPABLE
|
|
1020 |
if (test_flags & TEST_CORE_ON_SIGNAL) |
|
1021 |
{
|
|
1022 |
/* inform kernel that process is dumpable */
|
|
1023 |
(void) prctl(PR_SET_DUMPABLE, 1); |
|
1024 |
}
|
|
1025 |
#endif
|
|
1026 |
||
1027 |
return NULL; |
|
1028 |
}
|
|
1029 |
||
1030 |
static void set_user(const char *user, struct passwd *user_info_arg) |
|
1031 |
{
|
|
1032 |
/* purecov: begin tested */
|
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
1033 |
assert(user_info_arg != 0); |
1
by brian
clean slate |
1034 |
#ifdef HAVE_INITGROUPS
|
1035 |
/*
|
|
1036 |
We can get a SIGSEGV when calling initgroups() on some systems when NSS
|
|
1037 |
is configured to use LDAP and the server is statically linked. We set
|
|
1038 |
calling_initgroups as a flag to the SIGSEGV handler that is then used to
|
|
1039 |
output a specific message to help the user resolve this problem.
|
|
1040 |
*/
|
|
163
by Brian Aker
Merge Monty's code. |
1041 |
calling_initgroups= true; |
1
by brian
clean slate |
1042 |
initgroups((char*) user, user_info_arg->pw_gid); |
163
by Brian Aker
Merge Monty's code. |
1043 |
calling_initgroups= false; |
1
by brian
clean slate |
1044 |
#endif
|
1045 |
if (setgid(user_info_arg->pw_gid) == -1) |
|
1046 |
{
|
|
1047 |
sql_perror("setgid"); |
|
1048 |
unireg_abort(1); |
|
1049 |
}
|
|
1050 |
if (setuid(user_info_arg->pw_uid) == -1) |
|
1051 |
{
|
|
1052 |
sql_perror("setuid"); |
|
1053 |
unireg_abort(1); |
|
1054 |
}
|
|
1055 |
/* purecov: end */
|
|
1056 |
}
|
|
1057 |
||
1058 |
||
1059 |
static void set_effective_user(struct passwd *user_info_arg) |
|
1060 |
{
|
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
1061 |
assert(user_info_arg != 0); |
1
by brian
clean slate |
1062 |
if (setregid((gid_t)-1, user_info_arg->pw_gid) == -1) |
1063 |
{
|
|
1064 |
sql_perror("setregid"); |
|
1065 |
unireg_abort(1); |
|
1066 |
}
|
|
1067 |
if (setreuid((uid_t)-1, user_info_arg->pw_uid) == -1) |
|
1068 |
{
|
|
1069 |
sql_perror("setreuid"); |
|
1070 |
unireg_abort(1); |
|
1071 |
}
|
|
1072 |
}
|
|
1073 |
||
1074 |
||
1075 |
/** Change root user if started with @c --chroot . */
|
|
1076 |
static void set_root(const char *path) |
|
1077 |
{
|
|
1078 |
if (chroot(path) == -1) |
|
1079 |
{
|
|
1080 |
sql_perror("chroot"); |
|
1081 |
unireg_abort(1); |
|
1082 |
}
|
|
1083 |
my_setwd("/", MYF(0)); |
|
1084 |
}
|
|
1085 |
||
1086 |
||
1087 |
static void network_init(void) |
|
1088 |
{
|
|
1089 |
int arg; |
|
1090 |
int ret; |
|
1091 |
uint waited; |
|
1092 |
uint this_wait; |
|
1093 |
uint retry; |
|
1094 |
char port_buf[NI_MAXSERV]; |
|
1095 |
||
1096 |
if (thread_scheduler.init()) |
|
1097 |
unireg_abort(1); /* purecov: inspected */ |
|
1098 |
||
1099 |
set_ports(); |
|
1100 |
||
1101 |
if (mysqld_port != 0 && !opt_disable_networking && !opt_bootstrap) |
|
1102 |
{
|
|
1103 |
struct addrinfo *ai; |
|
1104 |
struct addrinfo hints; |
|
1105 |
int error; |
|
1106 |
||
1107 |
bzero(&hints, sizeof (hints)); |
|
1108 |
hints.ai_flags= AI_PASSIVE; |
|
1109 |
hints.ai_socktype= SOCK_STREAM; |
|
1110 |
hints.ai_family= AF_UNSPEC; |
|
1111 |
||
77.1.18
by Monty Taylor
Removed my_vsnprintf and my_snprintf. |
1112 |
snprintf(port_buf, NI_MAXSERV, "%d", mysqld_port); |
1
by brian
clean slate |
1113 |
error= getaddrinfo(my_bind_addr_str, port_buf, &hints, &ai); |
1114 |
if (error != 0) |
|
1115 |
{
|
|
1116 |
sql_perror(ER(ER_IPSOCK_ERROR)); /* purecov: tested */ |
|
1117 |
unireg_abort(1); /* purecov: tested */ |
|
1118 |
}
|
|
1119 |
||
1120 |
||
1121 |
ip_sock= socket(ai->ai_family, ai->ai_socktype, |
|
1122 |
ai->ai_protocol); |
|
1123 |
||
1124 |
if (ip_sock == INVALID_SOCKET) |
|
1125 |
{
|
|
1126 |
sql_perror(ER(ER_IPSOCK_ERROR)); /* purecov: tested */ |
|
1127 |
unireg_abort(1); /* purecov: tested */ |
|
1128 |
}
|
|
1129 |
||
1130 |
/*
|
|
1131 |
We should not use SO_REUSEADDR on windows as this would enable a
|
|
1132 |
user to open two mysqld servers with the same TCP/IP port.
|
|
1133 |
*/
|
|
1134 |
arg= 1; |
|
1135 |
(void) setsockopt(ip_sock,SOL_SOCKET,SO_REUSEADDR,(char*)&arg,sizeof(arg)); |
|
1136 |
||
1137 |
#ifdef IPV6_V6ONLY
|
|
1138 |
/*
|
|
1139 |
For interoperability with older clients, IPv6 socket should
|
|
1140 |
listen on both IPv6 and IPv4 wildcard addresses.
|
|
1141 |
Turn off IPV6_V6ONLY option.
|
|
1142 |
*/
|
|
1143 |
if (ai->ai_family == AF_INET6) |
|
1144 |
{
|
|
1145 |
arg= 0; |
|
1146 |
(void) setsockopt(ip_sock, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&arg, |
|
1147 |
sizeof(arg)); |
|
1148 |
}
|
|
1149 |
#endif
|
|
1150 |
/*
|
|
1151 |
Sometimes the port is not released fast enough when stopping and
|
|
1152 |
restarting the server. This happens quite often with the test suite
|
|
1153 |
on busy Linux systems. Retry to bind the address at these intervals:
|
|
1154 |
Sleep intervals: 1, 2, 4, 6, 9, 13, 17, 22, ...
|
|
1155 |
Retry at second: 1, 3, 7, 13, 22, 35, 52, 74, ...
|
|
1156 |
Limit the sequence by mysqld_port_timeout (set --port-open-timeout=#).
|
|
1157 |
*/
|
|
1158 |
for (waited= 0, retry= 1; ; retry++, waited+= this_wait) |
|
1159 |
{
|
|
1160 |
if (((ret= bind(ip_sock, ai->ai_addr, ai->ai_addrlen)) >= 0 ) || |
|
1161 |
(socket_errno != SOCKET_EADDRINUSE) || |
|
1162 |
(waited >= mysqld_port_timeout)) |
|
1163 |
break; |
|
1164 |
sql_print_information("Retrying bind on TCP/IP port %u", mysqld_port); |
|
1165 |
this_wait= retry * retry / 3 + 1; |
|
1166 |
sleep(this_wait); |
|
1167 |
}
|
|
1168 |
freeaddrinfo(ai); |
|
1169 |
if (ret < 0) |
|
1170 |
{
|
|
1171 |
sql_perror("Can't start server: Bind on TCP/IP port"); |
|
1172 |
sql_print_error("Do you already have another mysqld server running on port: %d ?",mysqld_port); |
|
1173 |
unireg_abort(1); |
|
1174 |
}
|
|
1175 |
if (listen(ip_sock,(int) back_log) < 0) |
|
1176 |
{
|
|
1177 |
sql_perror("Can't start server: listen() on TCP/IP port"); |
|
1178 |
sql_print_error("listen() on TCP/IP failed with error %d", |
|
1179 |
socket_errno); |
|
1180 |
unireg_abort(1); |
|
1181 |
}
|
|
1182 |
}
|
|
1183 |
||
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
1184 |
return;; |
1
by brian
clean slate |
1185 |
}
|
1186 |
||
1187 |
/**
|
|
1188 |
Close a connection.
|
|
1189 |
||
1190 |
@param thd Thread handle
|
|
1191 |
@param errcode Error code to print to console
|
|
1192 |
@param lock 1 if we have have to lock LOCK_thread_count
|
|
1193 |
||
1194 |
@note
|
|
1195 |
For the connection that is doing shutdown, this is called twice
|
|
1196 |
*/
|
|
1197 |
void close_connection(THD *thd, uint errcode, bool lock) |
|
1198 |
{
|
|
1199 |
st_vio *vio; |
|
1200 |
if (lock) |
|
1201 |
(void) pthread_mutex_lock(&LOCK_thread_count); |
|
1202 |
thd->killed= THD::KILL_CONNECTION; |
|
1203 |
if ((vio= thd->net.vio) != 0) |
|
1204 |
{
|
|
1205 |
if (errcode) |
|
1206 |
net_send_error(thd, errcode, ER(errcode)); /* purecov: inspected */ |
|
1207 |
vio_close(vio); /* vio is freed in delete thd */ |
|
1208 |
}
|
|
1209 |
if (lock) |
|
1210 |
(void) pthread_mutex_unlock(&LOCK_thread_count); |
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
1211 |
return;; |
1
by brian
clean slate |
1212 |
}
|
1213 |
||
1214 |
||
1215 |
/** Called when a thread is aborted. */
|
|
1216 |
/* ARGSUSED */
|
|
1217 |
extern "C" sig_handler end_thread_signal(int sig __attribute__((unused))) |
|
1218 |
{
|
|
1219 |
THD *thd=current_thd; |
|
1220 |
if (thd && ! thd->bootstrap) |
|
1221 |
{
|
|
1222 |
statistic_increment(killed_threads, &LOCK_status); |
|
1223 |
thread_scheduler.end_thread(thd,0); /* purecov: inspected */ |
|
1224 |
}
|
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
1225 |
return;; /* purecov: deadcode */ |
1
by brian
clean slate |
1226 |
}
|
1227 |
||
1228 |
||
1229 |
/*
|
|
1230 |
Unlink thd from global list of available connections and free thd
|
|
1231 |
||
1232 |
SYNOPSIS
|
|
1233 |
unlink_thd()
|
|
1234 |
thd Thread handler
|
|
1235 |
||
1236 |
NOTES
|
|
1237 |
LOCK_thread_count is locked and left locked
|
|
1238 |
*/
|
|
1239 |
||
1240 |
void unlink_thd(THD *thd) |
|
1241 |
{
|
|
1242 |
thd->cleanup(); |
|
1243 |
||
1244 |
pthread_mutex_lock(&LOCK_connection_count); |
|
1245 |
--connection_count; |
|
1246 |
pthread_mutex_unlock(&LOCK_connection_count); |
|
1247 |
||
1248 |
(void) pthread_mutex_lock(&LOCK_thread_count); |
|
1249 |
thread_count--; |
|
1250 |
delete thd; |
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
1251 |
return;; |
1
by brian
clean slate |
1252 |
}
|
1253 |
||
1254 |
||
1255 |
/*
|
|
1256 |
Store thread in cache for reuse by new connections
|
|
1257 |
||
1258 |
SYNOPSIS
|
|
1259 |
cache_thread()
|
|
1260 |
||
1261 |
NOTES
|
|
1262 |
LOCK_thread_count has to be locked
|
|
1263 |
||
1264 |
RETURN
|
|
1265 |
0 Thread was not put in cache
|
|
1266 |
1 Thread is to be reused by new connection.
|
|
1267 |
(ie, caller should return, not abort with pthread_exit())
|
|
1268 |
*/
|
|
1269 |
||
1270 |
||
1271 |
static bool cache_thread() |
|
1272 |
{
|
|
1273 |
safe_mutex_assert_owner(&LOCK_thread_count); |
|
1274 |
if (cached_thread_count < thread_cache_size && |
|
1275 |
! abort_loop && !kill_cached_threads) |
|
1276 |
{
|
|
1277 |
/* Don't kill the thread, just put it in cache for reuse */
|
|
1278 |
cached_thread_count++; |
|
1279 |
while (!abort_loop && ! wake_thread && ! kill_cached_threads) |
|
1280 |
(void) pthread_cond_wait(&COND_thread_cache, &LOCK_thread_count); |
|
1281 |
cached_thread_count--; |
|
1282 |
if (kill_cached_threads) |
|
1283 |
pthread_cond_signal(&COND_flush_thread_cache); |
|
1284 |
if (wake_thread) |
|
1285 |
{
|
|
1286 |
THD *thd; |
|
1287 |
wake_thread--; |
|
1288 |
thd= thread_cache.get(); |
|
1289 |
thd->thread_stack= (char*) &thd; // For store_globals |
|
1290 |
(void) thd->store_globals(); |
|
1291 |
/*
|
|
1292 |
THD::mysys_var::abort is associated with physical thread rather
|
|
1293 |
than with THD object. So we need to reset this flag before using
|
|
1294 |
this thread for handling of new THD object/connection.
|
|
1295 |
*/
|
|
1296 |
thd->mysys_var->abort= 0; |
|
1297 |
thd->thr_create_utime= my_micro_time(); |
|
1298 |
threads.append(thd); |
|
1299 |
return(1); |
|
1300 |
}
|
|
1301 |
}
|
|
1302 |
return(0); |
|
1303 |
}
|
|
1304 |
||
1305 |
||
1306 |
/*
|
|
1307 |
End thread for the current connection
|
|
1308 |
||
1309 |
SYNOPSIS
|
|
1310 |
one_thread_per_connection_end()
|
|
1311 |
thd Thread handler
|
|
1312 |
put_in_cache Store thread in cache, if there is room in it
|
|
1313 |
Normally this is true in all cases except when we got
|
|
1314 |
out of resources initializing the current thread
|
|
1315 |
||
1316 |
NOTES
|
|
1317 |
If thread is cached, we will wait until thread is scheduled to be
|
|
1318 |
reused and then we will return.
|
|
1319 |
If thread is not cached, we end the thread.
|
|
1320 |
||
1321 |
RETURN
|
|
1322 |
0 Signal to handle_one_connection to reuse connection
|
|
1323 |
*/
|
|
1324 |
||
1325 |
bool one_thread_per_connection_end(THD *thd, bool put_in_cache) |
|
1326 |
{
|
|
1327 |
unlink_thd(thd); |
|
1328 |
if (put_in_cache) |
|
1329 |
put_in_cache= cache_thread(); |
|
1330 |
pthread_mutex_unlock(&LOCK_thread_count); |
|
1331 |
if (put_in_cache) |
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
1332 |
return(0); // Thread is reused |
1
by brian
clean slate |
1333 |
|
1334 |
/* It's safe to broadcast outside a lock (COND... is not deleted here) */
|
|
1335 |
my_thread_end(); |
|
1336 |
(void) pthread_cond_broadcast(&COND_thread_count); |
|
1337 |
||
1338 |
pthread_exit(0); |
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
1339 |
return(0); // Impossible |
1
by brian
clean slate |
1340 |
}
|
1341 |
||
1342 |
||
1343 |
void flush_thread_cache() |
|
1344 |
{
|
|
1345 |
(void) pthread_mutex_lock(&LOCK_thread_count); |
|
1346 |
kill_cached_threads++; |
|
1347 |
while (cached_thread_count) |
|
1348 |
{
|
|
1349 |
pthread_cond_broadcast(&COND_thread_cache); |
|
1350 |
pthread_cond_wait(&COND_flush_thread_cache,&LOCK_thread_count); |
|
1351 |
}
|
|
1352 |
kill_cached_threads--; |
|
1353 |
(void) pthread_mutex_unlock(&LOCK_thread_count); |
|
1354 |
}
|
|
1355 |
||
1356 |
||
1357 |
#ifdef THREAD_SPECIFIC_SIGPIPE
|
|
1358 |
/**
|
|
1359 |
Aborts a thread nicely. Comes here on SIGPIPE.
|
|
1360 |
||
1361 |
@todo
|
|
1362 |
One should have to fix that thr_alarm know about this thread too.
|
|
1363 |
*/
|
|
1364 |
extern "C" sig_handler abort_thread(int sig __attribute__((unused))) |
|
1365 |
{
|
|
1366 |
THD *thd=current_thd; |
|
1367 |
if (thd) |
|
1368 |
thd->killed= THD::KILL_CONNECTION; |
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
1369 |
return;; |
1
by brian
clean slate |
1370 |
}
|
1371 |
#endif
|
|
1372 |
||
1373 |
#if BACKTRACE_DEMANGLE
|
|
1374 |
#include <cxxabi.h> |
|
1375 |
extern "C" char *my_demangle(const char *mangled_name, int *status) |
|
1376 |
{
|
|
1377 |
return abi::__cxa_demangle(mangled_name, NULL, NULL, status); |
|
1378 |
}
|
|
1379 |
#endif
|
|
1380 |
||
1381 |
||
1382 |
extern "C" sig_handler handle_segfault(int sig) |
|
1383 |
{
|
|
1384 |
time_t curr_time; |
|
1385 |
struct tm tm; |
|
1386 |
THD *thd=current_thd; |
|
1387 |
||
1388 |
/*
|
|
1389 |
Strictly speaking, one needs a mutex here
|
|
1390 |
but since we have got SIGSEGV already, things are a mess
|
|
1391 |
so not having the mutex is not as bad as possibly using a buggy
|
|
1392 |
mutex - so we keep things simple
|
|
1393 |
*/
|
|
1394 |
if (segfaulted) |
|
1395 |
{
|
|
1396 |
fprintf(stderr, "Fatal " SIGNAL_FMT " while backtracing\n", sig); |
|
1397 |
exit(1); |
|
1398 |
}
|
|
1399 |
||
1400 |
segfaulted = 1; |
|
1401 |
||
1402 |
curr_time= my_time(0); |
|
1403 |
localtime_r(&curr_time, &tm); |
|
1404 |
||
1405 |
fprintf(stderr,"\ |
|
1406 |
%02d%02d%02d %2d:%02d:%02d - mysqld got " SIGNAL_FMT " ;\n\ |
|
1407 |
This could be because you hit a bug. It is also possible that this binary\n\ |
|
1408 |
or one of the libraries it was linked against is corrupt, improperly built,\n\ |
|
1409 |
or misconfigured. This error can also be caused by malfunctioning hardware.\n", |
|
1410 |
tm.tm_year % 100, tm.tm_mon+1, tm.tm_mday, |
|
1411 |
tm.tm_hour, tm.tm_min, tm.tm_sec, |
|
1412 |
sig); |
|
1413 |
fprintf(stderr, "\ |
|
1414 |
We will try our best to scrape up some info that will hopefully help diagnose\n\ |
|
1415 |
the problem, but since we have already crashed, something is definitely wrong\n\ |
|
1416 |
and this may fail.\n\n"); |
|
1417 |
fprintf(stderr, "key_buffer_size=%lu\n", |
|
1418 |
(ulong) dflt_key_cache->key_cache_mem_size); |
|
1419 |
fprintf(stderr, "read_buffer_size=%ld\n", (long) global_system_variables.read_buff_size); |
|
1420 |
fprintf(stderr, "max_used_connections=%lu\n", max_used_connections); |
|
1421 |
fprintf(stderr, "max_threads=%u\n", thread_scheduler.max_threads); |
|
1422 |
fprintf(stderr, "thread_count=%u\n", thread_count); |
|
1423 |
fprintf(stderr, "connection_count=%u\n", connection_count); |
|
1424 |
fprintf(stderr, "It is possible that mysqld could use up to \n\ |
|
1425 |
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = %lu K\n\ |
|
1426 |
bytes of memory\n", ((ulong) dflt_key_cache->key_cache_mem_size + |
|
1427 |
(global_system_variables.read_buff_size + |
|
1428 |
global_system_variables.sortbuff_size) * |
|
1429 |
thread_scheduler.max_threads + |
|
1430 |
max_connections * sizeof(THD)) / 1024); |
|
1431 |
fprintf(stderr, "Hope that's ok; if not, decrease some variables in the equation.\n\n"); |
|
1432 |
||
1433 |
#ifdef HAVE_STACKTRACE
|
|
1434 |
if (!(test_flags & TEST_NO_STACKTRACE)) |
|
1435 |
{
|
|
1436 |
fprintf(stderr,"thd: 0x%lx\n",(long) thd); |
|
1437 |
fprintf(stderr,"\ |
|
1438 |
Attempting backtrace. You can use the following information to find out\n\ |
|
1439 |
where mysqld died. If you see no messages after this, something went\n\ |
|
1440 |
terribly wrong...\n"); |
|
1441 |
print_stacktrace(thd ? (uchar*) thd->thread_stack : (uchar*) 0, |
|
1442 |
my_thread_stack_size); |
|
1443 |
}
|
|
1444 |
if (thd) |
|
1445 |
{
|
|
1446 |
const char *kreason= "UNKNOWN"; |
|
1447 |
switch (thd->killed) { |
|
1448 |
case THD::NOT_KILLED: |
|
1449 |
kreason= "NOT_KILLED"; |
|
1450 |
break; |
|
1451 |
case THD::KILL_BAD_DATA: |
|
1452 |
kreason= "KILL_BAD_DATA"; |
|
1453 |
break; |
|
1454 |
case THD::KILL_CONNECTION: |
|
1455 |
kreason= "KILL_CONNECTION"; |
|
1456 |
break; |
|
1457 |
case THD::KILL_QUERY: |
|
1458 |
kreason= "KILL_QUERY"; |
|
1459 |
break; |
|
1460 |
case THD::KILLED_NO_VALUE: |
|
1461 |
kreason= "KILLED_NO_VALUE"; |
|
1462 |
break; |
|
1463 |
}
|
|
1464 |
fprintf(stderr, "Trying to get some variables.\n\ |
|
1465 |
Some pointers may be invalid and cause the dump to abort...\n"); |
|
1466 |
safe_print_str("thd->query", thd->query, 1024); |
|
1467 |
fprintf(stderr, "thd->thread_id=%lu\n", (ulong) thd->thread_id); |
|
1468 |
fprintf(stderr, "thd->killed=%s\n", kreason); |
|
1469 |
}
|
|
1470 |
fprintf(stderr, "\ |
|
1471 |
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains\n\ |
|
1472 |
information that should help you find out what is causing the crash.\n"); |
|
1473 |
fflush(stderr); |
|
1474 |
#endif /* HAVE_STACKTRACE */ |
|
1475 |
||
1476 |
#ifdef HAVE_INITGROUPS
|
|
1477 |
if (calling_initgroups) |
|
1478 |
fprintf(stderr, "\n\ |
|
1479 |
This crash occured while the server was calling initgroups(). This is\n\ |
|
1480 |
often due to the use of a mysqld that is statically linked against glibc\n\ |
|
1481 |
and configured to use LDAP in /etc/nsswitch.conf. You will need to either\n\ |
|
1482 |
upgrade to a version of glibc that does not have this problem (2.3.4 or\n\ |
|
1483 |
later when used with nscd), disable LDAP in your nsswitch.conf, or use a\n\ |
|
1484 |
mysqld that is not statically linked.\n"); |
|
1485 |
#endif
|
|
1486 |
||
1487 |
if (thd_lib_detected == THD_LIB_LT && !getenv("LD_ASSUME_KERNEL")) |
|
1488 |
fprintf(stderr,"\n\ |
|
1489 |
You are running a statically-linked LinuxThreads binary on an NPTL system.\n\ |
|
1490 |
This can result in crashes on some distributions due to LT/NPTL conflicts.\n\ |
|
1491 |
You should either build a dynamically-linked binary, or force LinuxThreads\n\ |
|
1492 |
to be used with the LD_ASSUME_KERNEL environment variable. Please consult\n\ |
|
1493 |
the documentation for your distribution on how to do that.\n"); |
|
1494 |
||
1495 |
if (locked_in_memory) |
|
1496 |
{
|
|
1497 |
fprintf(stderr, "\n\ |
|
1498 |
The \"--memlock\" argument, which was enabled, uses system calls that are\n\ |
|
1499 |
unreliable and unstable on some operating systems and operating-system\n\ |
|
1500 |
versions (notably, some versions of Linux). This crash could be due to use\n\ |
|
1501 |
of those buggy OS calls. You should consider whether you really need the\n\ |
|
1502 |
\"--memlock\" parameter and/or consult the OS distributer about \"mlockall\"\n\ |
|
1503 |
bugs.\n"); |
|
1504 |
}
|
|
1505 |
||
1506 |
#ifdef HAVE_WRITE_CORE
|
|
1507 |
if (test_flags & TEST_CORE_ON_SIGNAL) |
|
1508 |
{
|
|
1509 |
fprintf(stderr, "Writing a core file\n"); |
|
1510 |
fflush(stderr); |
|
1511 |
write_core(sig); |
|
1512 |
}
|
|
1513 |
#endif
|
|
1514 |
||
1515 |
exit(1); |
|
1516 |
}
|
|
1517 |
||
1518 |
#ifndef SA_RESETHAND
|
|
1519 |
#define SA_RESETHAND 0
|
|
1520 |
#endif
|
|
1521 |
#ifndef SA_NODEFER
|
|
1522 |
#define SA_NODEFER 0
|
|
1523 |
#endif
|
|
1524 |
||
1525 |
static void init_signals(void) |
|
1526 |
{
|
|
1527 |
sigset_t set; |
|
1528 |
struct sigaction sa; |
|
1529 |
||
1530 |
my_sigset(THR_SERVER_ALARM,print_signal_warning); // Should never be called! |
|
1531 |
||
1532 |
if (!(test_flags & TEST_NO_STACKTRACE) || (test_flags & TEST_CORE_ON_SIGNAL)) |
|
1533 |
{
|
|
1534 |
sa.sa_flags = SA_RESETHAND | SA_NODEFER; |
|
1535 |
sigemptyset(&sa.sa_mask); |
|
1536 |
sigprocmask(SIG_SETMASK,&sa.sa_mask,NULL); |
|
1537 |
||
1538 |
init_stacktrace(); |
|
1539 |
sa.sa_handler=handle_segfault; |
|
1540 |
sigaction(SIGSEGV, &sa, NULL); |
|
1541 |
sigaction(SIGABRT, &sa, NULL); |
|
1542 |
#ifdef SIGBUS
|
|
1543 |
sigaction(SIGBUS, &sa, NULL); |
|
1544 |
#endif
|
|
1545 |
sigaction(SIGILL, &sa, NULL); |
|
1546 |
sigaction(SIGFPE, &sa, NULL); |
|
1547 |
}
|
|
1548 |
||
1549 |
#ifdef HAVE_GETRLIMIT
|
|
1550 |
if (test_flags & TEST_CORE_ON_SIGNAL) |
|
1551 |
{
|
|
1552 |
/* Change limits so that we will get a core file */
|
|
1553 |
STRUCT_RLIMIT rl; |
|
1554 |
rl.rlim_cur = rl.rlim_max = RLIM_INFINITY; |
|
1555 |
if (setrlimit(RLIMIT_CORE, &rl) && global_system_variables.log_warnings) |
|
1556 |
sql_print_warning("setrlimit could not change the size of core files to 'infinity'; We may not be able to generate a core file on signals"); |
|
1557 |
}
|
|
1558 |
#endif
|
|
1559 |
(void) sigemptyset(&set); |
|
1560 |
my_sigset(SIGPIPE,SIG_IGN); |
|
1561 |
sigaddset(&set,SIGPIPE); |
|
1562 |
#ifndef IGNORE_SIGHUP_SIGQUIT
|
|
1563 |
sigaddset(&set,SIGQUIT); |
|
1564 |
sigaddset(&set,SIGHUP); |
|
1565 |
#endif
|
|
1566 |
sigaddset(&set,SIGTERM); |
|
1567 |
||
1568 |
/* Fix signals if blocked by parents (can happen on Mac OS X) */
|
|
1569 |
sigemptyset(&sa.sa_mask); |
|
1570 |
sa.sa_flags = 0; |
|
1571 |
sa.sa_handler = print_signal_warning; |
|
1572 |
sigaction(SIGTERM, &sa, (struct sigaction*) 0); |
|
1573 |
sa.sa_flags = 0; |
|
1574 |
sa.sa_handler = print_signal_warning; |
|
1575 |
sigaction(SIGHUP, &sa, (struct sigaction*) 0); |
|
1576 |
#ifdef SIGTSTP
|
|
1577 |
sigaddset(&set,SIGTSTP); |
|
1578 |
#endif
|
|
1579 |
if (thd_lib_detected != THD_LIB_LT) |
|
1580 |
sigaddset(&set,THR_SERVER_ALARM); |
|
1581 |
if (test_flags & TEST_SIGINT) |
|
1582 |
{
|
|
1583 |
my_sigset(thr_kill_signal, end_thread_signal); |
|
1584 |
// May be SIGINT
|
|
1585 |
sigdelset(&set, thr_kill_signal); |
|
1586 |
}
|
|
1587 |
else
|
|
1588 |
sigaddset(&set,SIGINT); |
|
1589 |
sigprocmask(SIG_SETMASK,&set,NULL); |
|
1590 |
pthread_sigmask(SIG_SETMASK,&set,NULL); |
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
1591 |
return;; |
1
by brian
clean slate |
1592 |
}
|
1593 |
||
1594 |
||
1595 |
static void start_signal_handler(void) |
|
1596 |
{
|
|
1597 |
int error; |
|
1598 |
pthread_attr_t thr_attr; |
|
1599 |
||
1600 |
(void) pthread_attr_init(&thr_attr); |
|
6
by Brian Aker
Second pass on pthread cleanup |
1601 |
pthread_attr_setscope(&thr_attr, PTHREAD_SCOPE_SYSTEM); |
1602 |
(void) pthread_attr_setdetachstate(&thr_attr, PTHREAD_CREATE_DETACHED); |
|
1
by brian
clean slate |
1603 |
if (!(opt_specialflag & SPECIAL_NO_PRIOR)) |
6
by Brian Aker
Second pass on pthread cleanup |
1604 |
{
|
1605 |
struct sched_param tmp_sched_param; |
|
1606 |
||
1607 |
memset(&tmp_sched_param, 0, sizeof(tmp_sched_param)); |
|
1608 |
tmp_sched_param.sched_priority= INTERRUPT_PRIOR; |
|
1609 |
(void)pthread_attr_setschedparam(&thr_attr, &tmp_sched_param); |
|
1610 |
}
|
|
1
by brian
clean slate |
1611 |
#if defined(__ia64__) || defined(__ia64)
|
1612 |
/*
|
|
1613 |
Peculiar things with ia64 platforms - it seems we only have half the
|
|
1614 |
stack size in reality, so we have to double it here
|
|
1615 |
*/
|
|
1616 |
pthread_attr_setstacksize(&thr_attr,my_thread_stack_size*2); |
|
1617 |
#else
|
|
1618 |
pthread_attr_setstacksize(&thr_attr,my_thread_stack_size); |
|
1619 |
||
1620 |
(void) pthread_mutex_lock(&LOCK_thread_count); |
|
1621 |
if ((error=pthread_create(&signal_thread,&thr_attr,signal_hand,0))) |
|
1622 |
{
|
|
1623 |
sql_print_error("Can't create interrupt-thread (error %d, errno: %d)", |
|
1624 |
error,errno); |
|
1625 |
exit(1); |
|
1626 |
}
|
|
1627 |
(void) pthread_cond_wait(&COND_thread_count,&LOCK_thread_count); |
|
1628 |
pthread_mutex_unlock(&LOCK_thread_count); |
|
1629 |
||
1630 |
(void) pthread_attr_destroy(&thr_attr); |
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
1631 |
return;; |
1
by brian
clean slate |
1632 |
}
|
1633 |
||
1634 |
||
1635 |
/** This threads handles all signals and alarms. */
|
|
1636 |
/* ARGSUSED */
|
|
1637 |
pthread_handler_t signal_hand(void *arg __attribute__((unused))) |
|
1638 |
{
|
|
1639 |
sigset_t set; |
|
1640 |
int sig; |
|
1641 |
my_thread_init(); // Init new thread |
|
1642 |
signal_thread_in_use= 1; |
|
1643 |
||
1644 |
/*
|
|
1645 |
Setup alarm handler
|
|
1646 |
This should actually be '+ max_number_of_slaves' instead of +10,
|
|
1647 |
but the +10 should be quite safe.
|
|
1648 |
*/
|
|
1649 |
init_thr_alarm(thread_scheduler.max_threads + 10); |
|
1650 |
if (thd_lib_detected != THD_LIB_LT && (test_flags & TEST_SIGINT)) |
|
1651 |
{
|
|
1652 |
(void) sigemptyset(&set); // Setup up SIGINT for debug |
|
1653 |
(void) sigaddset(&set,SIGINT); // For debugging |
|
1654 |
(void) pthread_sigmask(SIG_UNBLOCK,&set,NULL); |
|
1655 |
}
|
|
1656 |
(void) sigemptyset(&set); // Setup up SIGINT for debug |
|
1657 |
#ifdef USE_ONE_SIGNAL_HAND
|
|
1658 |
(void) sigaddset(&set,THR_SERVER_ALARM); // For alarms |
|
1659 |
#endif
|
|
1660 |
#ifndef IGNORE_SIGHUP_SIGQUIT
|
|
1661 |
(void) sigaddset(&set,SIGQUIT); |
|
1662 |
(void) sigaddset(&set,SIGHUP); |
|
1663 |
#endif
|
|
1664 |
(void) sigaddset(&set,SIGTERM); |
|
1665 |
(void) sigaddset(&set,SIGTSTP); |
|
1666 |
||
1667 |
/* Save pid to this process (or thread on Linux) */
|
|
1668 |
if (!opt_bootstrap) |
|
1669 |
create_pid_file(); |
|
1670 |
||
1671 |
#ifdef HAVE_STACK_TRACE_ON_SEGV
|
|
1672 |
if (opt_do_pstack) |
|
1673 |
{
|
|
1674 |
sprintf(pstack_file_name,"mysqld-%lu-%%d-%%d.backtrace", (ulong)getpid()); |
|
1675 |
pstack_install_segv_action(pstack_file_name); |
|
1676 |
}
|
|
1677 |
#endif /* HAVE_STACK_TRACE_ON_SEGV */ |
|
1678 |
||
1679 |
/*
|
|
1680 |
signal to start_signal_handler that we are ready
|
|
1681 |
This works by waiting for start_signal_handler to free mutex,
|
|
1682 |
after which we signal it that we are ready.
|
|
1683 |
At this pointer there is no other threads running, so there
|
|
1684 |
should not be any other pthread_cond_signal() calls.
|
|
1685 |
*/
|
|
1686 |
(void) pthread_mutex_lock(&LOCK_thread_count); |
|
1687 |
(void) pthread_mutex_unlock(&LOCK_thread_count); |
|
1688 |
(void) pthread_cond_broadcast(&COND_thread_count); |
|
1689 |
||
1690 |
(void) pthread_sigmask(SIG_BLOCK,&set,NULL); |
|
1691 |
for (;;) |
|
1692 |
{
|
|
1693 |
int error; // Used when debugging |
|
1694 |
if (shutdown_in_progress && !abort_loop) |
|
1695 |
{
|
|
1696 |
sig= SIGTERM; |
|
1697 |
error=0; |
|
1698 |
}
|
|
1699 |
else
|
|
1700 |
while ((error=my_sigwait(&set,&sig)) == EINTR) ; |
|
1701 |
if (cleanup_done) |
|
1702 |
{
|
|
1703 |
my_thread_end(); |
|
1704 |
signal_thread_in_use= 0; |
|
1705 |
pthread_exit(0); // Safety |
|
1706 |
}
|
|
1707 |
switch (sig) { |
|
1708 |
case SIGTERM: |
|
1709 |
case SIGQUIT: |
|
1710 |
case SIGKILL: |
|
1711 |
#ifdef EXTRA_DEBUG
|
|
1712 |
sql_print_information("Got signal %d to shutdown mysqld",sig); |
|
1713 |
#endif
|
|
1714 |
/* switch to the old log message processing */
|
|
1715 |
logger.set_handlers(LOG_FILE, opt_slow_log ? LOG_FILE:LOG_NONE, |
|
1716 |
opt_log ? LOG_FILE:LOG_NONE); |
|
1717 |
if (!abort_loop) |
|
1718 |
{
|
|
1719 |
abort_loop=1; // mark abort for threads |
|
1720 |
#ifdef USE_ONE_SIGNAL_HAND
|
|
1721 |
pthread_t tmp; |
|
1722 |
if (!(opt_specialflag & SPECIAL_NO_PRIOR)) |
|
6
by Brian Aker
Second pass on pthread cleanup |
1723 |
{
|
1724 |
struct sched_param tmp_sched_param; |
|
1725 |
||
1726 |
memset(&tmp_sched_param, 0, sizeof(tmp_sched_param)); |
|
1727 |
tmp_sched_param.sched_priority= INTERRUPT_PRIOR; |
|
1728 |
(void)pthread_attr_setschedparam(&connection_attrib, &tmp_sched_param); |
|
1729 |
}
|
|
1
by brian
clean slate |
1730 |
if (pthread_create(&tmp,&connection_attrib, kill_server_thread, |
1731 |
(void*) &sig)) |
|
1732 |
sql_print_error("Can't create thread to kill server"); |
|
1733 |
#else
|
|
1734 |
kill_server((void*) sig); // MIT THREAD has a alarm thread |
|
1735 |
#endif
|
|
1736 |
}
|
|
1737 |
break; |
|
1738 |
case SIGHUP: |
|
1739 |
if (!abort_loop) |
|
1740 |
{
|
|
1741 |
bool not_used; |
|
1742 |
reload_cache((THD*) 0, |
|
1743 |
(REFRESH_LOG | REFRESH_TABLES | REFRESH_FAST | |
|
1744 |
REFRESH_GRANT | |
|
1745 |
REFRESH_THREADS | REFRESH_HOSTS), |
|
1746 |
(TABLE_LIST*) 0, ¬_used); // Flush logs |
|
1747 |
}
|
|
1748 |
/* reenable logs after the options were reloaded */
|
|
1749 |
if (log_output_options & LOG_NONE) |
|
1750 |
{
|
|
1751 |
logger.set_handlers(LOG_FILE, |
|
1752 |
opt_slow_log ? LOG_TABLE : LOG_NONE, |
|
1753 |
opt_log ? LOG_TABLE : LOG_NONE); |
|
1754 |
}
|
|
1755 |
else
|
|
1756 |
{
|
|
1757 |
logger.set_handlers(LOG_FILE, |
|
1758 |
opt_slow_log ? log_output_options : LOG_NONE, |
|
1759 |
opt_log ? log_output_options : LOG_NONE); |
|
1760 |
}
|
|
1761 |
break; |
|
1762 |
#ifdef USE_ONE_SIGNAL_HAND
|
|
1763 |
case THR_SERVER_ALARM: |
|
1764 |
process_alarm(sig); // Trigger alarms. |
|
1765 |
break; |
|
1766 |
#endif
|
|
1767 |
default: |
|
1768 |
#ifdef EXTRA_DEBUG
|
|
1769 |
sql_print_warning("Got signal: %d error: %d",sig,error); /* purecov: tested */ |
|
1770 |
#endif
|
|
1771 |
break; /* purecov: tested */ |
|
1772 |
}
|
|
1773 |
}
|
|
1774 |
return(0); /* purecov: deadcode */ |
|
1775 |
}
|
|
1776 |
||
77.1.45
by Monty Taylor
Warning fixes. |
1777 |
static void check_data_home(const char *path __attribute__((__unused__))) |
1
by brian
clean slate |
1778 |
{}
|
1779 |
||
1780 |
#endif /* __WIN__*/ |
|
1781 |
||
1782 |
||
1783 |
/**
|
|
1784 |
All global error messages are sent here where the first one is stored
|
|
1785 |
for the client.
|
|
1786 |
*/
|
|
1787 |
/* ARGSUSED */
|
|
1788 |
extern "C" void my_message_sql(uint error, const char *str, myf MyFlags); |
|
1789 |
||
1790 |
void my_message_sql(uint error, const char *str, myf MyFlags) |
|
1791 |
{
|
|
1792 |
THD *thd; |
|
1793 |
/*
|
|
1794 |
Put here following assertion when situation with EE_* error codes
|
|
1795 |
will be fixed
|
|
1796 |
*/
|
|
1797 |
if ((thd= current_thd)) |
|
1798 |
{
|
|
1799 |
if (MyFlags & ME_FATALERROR) |
|
1800 |
thd->is_fatal_error= 1; |
|
1801 |
||
1802 |
#ifdef BUG_36098_FIXED
|
|
1803 |
mysql_audit_general(thd,MYSQL_AUDIT_GENERAL_ERROR,error,my_time(0), |
|
1804 |
0,0,str,str ? strlen(str) : 0, |
|
1805 |
thd->query,thd->query_length, |
|
1806 |
thd->variables.character_set_client, |
|
1807 |
thd->row_count); |
|
1808 |
#endif
|
|
1809 |
||
1810 |
||
1811 |
/*
|
|
1812 |
TODO: There are two exceptions mechanism (THD and sp_rcontext),
|
|
1813 |
this could be improved by having a common stack of handlers.
|
|
1814 |
*/
|
|
1815 |
if (thd->handle_error(error, str, |
|
1816 |
MYSQL_ERROR::WARN_LEVEL_ERROR)) |
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
1817 |
return;; |
1
by brian
clean slate |
1818 |
|
1819 |
thd->is_slave_error= 1; // needed to catch query errors during replication |
|
1820 |
||
1821 |
/*
|
|
1822 |
thd->lex->current_select == 0 if lex structure is not inited
|
|
1823 |
(not query command (COM_QUERY))
|
|
1824 |
*/
|
|
51.1.78
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
1825 |
if (! (thd->lex->current_select && |
1826 |
thd->lex->current_select->no_error && !thd->is_fatal_error)) |
|
1
by brian
clean slate |
1827 |
{
|
1828 |
if (! thd->main_da.is_error()) // Return only first message |
|
1829 |
{
|
|
1830 |
if (error == 0) |
|
1831 |
error= ER_UNKNOWN_ERROR; |
|
1832 |
if (str == NULL) |
|
1833 |
str= ER(error); |
|
1834 |
thd->main_da.set_error_status(thd, error, str); |
|
1835 |
}
|
|
1836 |
}
|
|
1837 |
||
1838 |
if (!thd->no_warnings_for_error && !thd->is_fatal_error) |
|
1839 |
{
|
|
1840 |
/*
|
|
1841 |
Suppress infinite recursion if there a memory allocation error
|
|
1842 |
inside push_warning.
|
|
1843 |
*/
|
|
163
by Brian Aker
Merge Monty's code. |
1844 |
thd->no_warnings_for_error= true; |
1
by brian
clean slate |
1845 |
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, error, str); |
163
by Brian Aker
Merge Monty's code. |
1846 |
thd->no_warnings_for_error= false; |
1
by brian
clean slate |
1847 |
}
|
1848 |
}
|
|
1849 |
if (!thd || MyFlags & ME_NOREFRESH) |
|
1850 |
sql_print_error("%s: %s",my_progname,str); /* purecov: inspected */ |
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
1851 |
return;; |
1
by brian
clean slate |
1852 |
}
|
1853 |
||
1854 |
||
1855 |
extern "C" void *my_str_malloc_mysqld(size_t size); |
|
1856 |
extern "C" void my_str_free_mysqld(void *ptr); |
|
1857 |
||
1858 |
void *my_str_malloc_mysqld(size_t size) |
|
1859 |
{
|
|
1860 |
return my_malloc(size, MYF(MY_FAE)); |
|
1861 |
}
|
|
1862 |
||
1863 |
||
1864 |
void my_str_free_mysqld(void *ptr) |
|
1865 |
{
|
|
1866 |
my_free((uchar*)ptr, MYF(MY_FAE)); |
|
1867 |
}
|
|
1868 |
||
1869 |
||
1870 |
static const char *load_default_groups[]= { |
|
1871 |
"mysqld","server", MYSQL_BASE_VERSION, 0, 0}; |
|
1872 |
||
1873 |
||
1874 |
/**
|
|
1875 |
Initialize one of the global date/time format variables.
|
|
1876 |
||
1877 |
@param format_type What kind of format should be supported
|
|
1878 |
@param var_ptr Pointer to variable that should be updated
|
|
1879 |
||
1880 |
@note
|
|
1881 |
The default value is taken from either opt_date_time_formats[] or
|
|
1882 |
the ISO format (ANSI SQL)
|
|
1883 |
||
1884 |
@retval
|
|
1885 |
0 ok
|
|
1886 |
@retval
|
|
1887 |
1 error
|
|
1888 |
*/
|
|
1889 |
||
1890 |
static bool init_global_datetime_format(timestamp_type format_type, |
|
1891 |
DATE_TIME_FORMAT **var_ptr) |
|
1892 |
{
|
|
1893 |
/* Get command line option */
|
|
1894 |
const char *str= opt_date_time_formats[format_type]; |
|
1895 |
||
1896 |
if (!str) // No specified format |
|
1897 |
{
|
|
1898 |
str= get_date_time_format_str(&known_date_time_formats[ISO_FORMAT], |
|
1899 |
format_type); |
|
1900 |
/*
|
|
1901 |
Set the "command line" option to point to the generated string so
|
|
1902 |
that we can set global formats back to default
|
|
1903 |
*/
|
|
1904 |
opt_date_time_formats[format_type]= str; |
|
1905 |
}
|
|
1906 |
if (!(*var_ptr= date_time_format_make(format_type, str, strlen(str)))) |
|
1907 |
{
|
|
1908 |
fprintf(stderr, "Wrong date/time format specifier: %s\n", str); |
|
1909 |
return 1; |
|
1910 |
}
|
|
1911 |
return 0; |
|
1912 |
}
|
|
1913 |
||
1914 |
SHOW_VAR com_status_vars[]= { |
|
1915 |
{"admin_commands", (char*) offsetof(STATUS_VAR, com_other), SHOW_LONG_STATUS}, |
|
1916 |
{"assign_to_keycache", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ASSIGN_TO_KEYCACHE]), SHOW_LONG_STATUS}, |
|
1917 |
{"alter_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_DB]), SHOW_LONG_STATUS}, |
|
1918 |
{"alter_db_upgrade", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_DB_UPGRADE]), SHOW_LONG_STATUS}, |
|
1919 |
{"alter_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_TABLE]), SHOW_LONG_STATUS}, |
|
1920 |
{"analyze", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ANALYZE]), SHOW_LONG_STATUS}, |
|
1921 |
{"begin", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_BEGIN]), SHOW_LONG_STATUS}, |
|
1922 |
{"binlog", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_BINLOG_BASE64_EVENT]), SHOW_LONG_STATUS}, |
|
1923 |
{"change_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CHANGE_DB]), SHOW_LONG_STATUS}, |
|
1924 |
{"change_master", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CHANGE_MASTER]), SHOW_LONG_STATUS}, |
|
1925 |
{"check", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CHECK]), SHOW_LONG_STATUS}, |
|
1926 |
{"checksum", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CHECKSUM]), SHOW_LONG_STATUS}, |
|
1927 |
{"commit", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_COMMIT]), SHOW_LONG_STATUS}, |
|
1928 |
{"create_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_DB]), SHOW_LONG_STATUS}, |
|
1929 |
{"create_index", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_INDEX]), SHOW_LONG_STATUS}, |
|
1930 |
{"create_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_TABLE]), SHOW_LONG_STATUS}, |
|
1931 |
{"delete", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DELETE]), SHOW_LONG_STATUS}, |
|
1932 |
{"delete_multi", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DELETE_MULTI]), SHOW_LONG_STATUS}, |
|
1933 |
{"drop_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_DB]), SHOW_LONG_STATUS}, |
|
1934 |
{"drop_index", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_INDEX]), SHOW_LONG_STATUS}, |
|
1935 |
{"drop_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_TABLE]), SHOW_LONG_STATUS}, |
|
1936 |
{"empty_query", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_EMPTY_QUERY]), SHOW_LONG_STATUS}, |
|
1937 |
{"flush", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_FLUSH]), SHOW_LONG_STATUS}, |
|
1938 |
{"insert", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_INSERT]), SHOW_LONG_STATUS}, |
|
1939 |
{"insert_select", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_INSERT_SELECT]), SHOW_LONG_STATUS}, |
|
1940 |
{"kill", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_KILL]), SHOW_LONG_STATUS}, |
|
1941 |
{"load", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_LOAD]), SHOW_LONG_STATUS}, |
|
1942 |
{"lock_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_LOCK_TABLES]), SHOW_LONG_STATUS}, |
|
1943 |
{"optimize", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_OPTIMIZE]), SHOW_LONG_STATUS}, |
|
1944 |
{"purge", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PURGE]), SHOW_LONG_STATUS}, |
|
1945 |
{"purge_before_date", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PURGE_BEFORE]), SHOW_LONG_STATUS}, |
|
1946 |
{"release_savepoint", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RELEASE_SAVEPOINT]), SHOW_LONG_STATUS}, |
|
1947 |
{"rename_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RENAME_TABLE]), SHOW_LONG_STATUS}, |
|
1948 |
{"repair", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REPAIR]), SHOW_LONG_STATUS}, |
|
1949 |
{"replace", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REPLACE]), SHOW_LONG_STATUS}, |
|
1950 |
{"replace_select", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REPLACE_SELECT]), SHOW_LONG_STATUS}, |
|
1951 |
{"reset", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RESET]), SHOW_LONG_STATUS}, |
|
1952 |
{"rollback", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ROLLBACK]), SHOW_LONG_STATUS}, |
|
1953 |
{"rollback_to_savepoint",(char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ROLLBACK_TO_SAVEPOINT]), SHOW_LONG_STATUS}, |
|
1954 |
{"savepoint", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SAVEPOINT]), SHOW_LONG_STATUS}, |
|
1955 |
{"select", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SELECT]), SHOW_LONG_STATUS}, |
|
1956 |
{"set_option", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SET_OPTION]), SHOW_LONG_STATUS}, |
|
1957 |
{"show_binlog_events", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOG_EVENTS]), SHOW_LONG_STATUS}, |
|
1958 |
{"show_binlogs", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOGS]), SHOW_LONG_STATUS}, |
|
1959 |
{"show_charsets", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CHARSETS]), SHOW_LONG_STATUS}, |
|
1960 |
{"show_collations", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_COLLATIONS]), SHOW_LONG_STATUS}, |
|
1961 |
{"show_create_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE_DB]), SHOW_LONG_STATUS}, |
|
1962 |
{"show_create_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE]), SHOW_LONG_STATUS}, |
|
1963 |
{"show_databases", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_DATABASES]), SHOW_LONG_STATUS}, |
|
1964 |
{"show_engine_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_ENGINE_STATUS]), SHOW_LONG_STATUS}, |
|
1965 |
{"show_errors", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_ERRORS]), SHOW_LONG_STATUS}, |
|
1966 |
{"show_fields", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_FIELDS]), SHOW_LONG_STATUS}, |
|
1967 |
{"show_keys", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_KEYS]), SHOW_LONG_STATUS}, |
|
1968 |
{"show_master_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_MASTER_STAT]), SHOW_LONG_STATUS}, |
|
1969 |
{"show_open_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_OPEN_TABLES]), SHOW_LONG_STATUS}, |
|
1970 |
{"show_plugins", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PLUGINS]), SHOW_LONG_STATUS}, |
|
1971 |
{"show_processlist", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PROCESSLIST]), SHOW_LONG_STATUS}, |
|
1972 |
{"show_slave_hosts", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_HOSTS]), SHOW_LONG_STATUS}, |
|
1973 |
{"show_slave_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_STAT]), SHOW_LONG_STATUS}, |
|
1974 |
{"show_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS]), SHOW_LONG_STATUS}, |
|
1975 |
{"show_table_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_TABLE_STATUS]), SHOW_LONG_STATUS}, |
|
1976 |
{"show_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_TABLES]), SHOW_LONG_STATUS}, |
|
1977 |
{"show_variables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_VARIABLES]), SHOW_LONG_STATUS}, |
|
1978 |
{"show_warnings", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_WARNS]), SHOW_LONG_STATUS}, |
|
1979 |
{"slave_start", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_START]), SHOW_LONG_STATUS}, |
|
1980 |
{"slave_stop", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_STOP]), SHOW_LONG_STATUS}, |
|
1981 |
{"truncate", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_TRUNCATE]), SHOW_LONG_STATUS}, |
|
1982 |
{"unlock_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UNLOCK_TABLES]), SHOW_LONG_STATUS}, |
|
1983 |
{"update", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UPDATE]), SHOW_LONG_STATUS}, |
|
1984 |
{"update_multi", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UPDATE_MULTI]), SHOW_LONG_STATUS}, |
|
1985 |
{NullS, NullS, SHOW_LONG} |
|
1986 |
};
|
|
1987 |
||
1988 |
static int init_common_variables(const char *conf_file_name, int argc, |
|
1989 |
char **argv, const char **groups) |
|
1990 |
{
|
|
1991 |
char buff[FN_REFLEN], *s; |
|
1992 |
umask(((~my_umask) & 0666)); |
|
1993 |
my_decimal_set_zero(&decimal_zero); // set decimal_zero constant; |
|
1994 |
tzset(); // Set tzname |
|
1995 |
||
1996 |
max_system_variables.pseudo_thread_id= (ulong)~0; |
|
1997 |
server_start_time= flush_status_time= my_time(0); |
|
1998 |
rpl_filter= new Rpl_filter; |
|
1999 |
binlog_filter= new Rpl_filter; |
|
2000 |
if (!rpl_filter || !binlog_filter) |
|
2001 |
{
|
|
2002 |
sql_perror("Could not allocate replication and binlog filters"); |
|
2003 |
exit(1); |
|
2004 |
}
|
|
2005 |
||
2006 |
if (init_thread_environment()) |
|
2007 |
return 1; |
|
2008 |
mysql_init_variables(); |
|
2009 |
||
2010 |
#ifdef HAVE_TZNAME
|
|
2011 |
{
|
|
2012 |
struct tm tm_tmp; |
|
2013 |
localtime_r(&server_start_time,&tm_tmp); |
|
2014 |
strmake(system_time_zone, tzname[tm_tmp.tm_isdst != 0 ? 1 : 0], |
|
2015 |
sizeof(system_time_zone)-1); |
|
2016 |
||
2017 |
}
|
|
2018 |
#endif
|
|
2019 |
/*
|
|
2020 |
We set SYSTEM time zone as reasonable default and
|
|
2021 |
also for failure of my_tz_init() and bootstrap mode.
|
|
2022 |
If user explicitly set time zone with --default-time-zone
|
|
2023 |
option we will change this value in my_tz_init().
|
|
2024 |
*/
|
|
2025 |
global_system_variables.time_zone= my_tz_SYSTEM; |
|
2026 |
||
2027 |
/*
|
|
2028 |
Init mutexes for the global MYSQL_BIN_LOG objects.
|
|
2029 |
As safe_mutex depends on what MY_INIT() does, we can't init the mutexes of
|
|
2030 |
global MYSQL_BIN_LOGs in their constructors, because then they would be
|
|
2031 |
inited before MY_INIT(). So we do it here.
|
|
2032 |
*/
|
|
2033 |
mysql_bin_log.init_pthread_objects(); |
|
2034 |
||
2035 |
if (gethostname(glob_hostname,sizeof(glob_hostname)) < 0) |
|
2036 |
{
|
|
2037 |
strmake(glob_hostname, STRING_WITH_LEN("localhost")); |
|
2038 |
sql_print_warning("gethostname failed, using '%s' as hostname", |
|
2039 |
glob_hostname); |
|
2040 |
strmake(pidfile_name, STRING_WITH_LEN("mysql")); |
|
2041 |
}
|
|
2042 |
else
|
|
2043 |
strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5); |
|
2044 |
strmov(fn_ext(pidfile_name),".pid"); // Add proper extension |
|
2045 |
||
2046 |
/*
|
|
2047 |
Add server status variables to the dynamic list of
|
|
2048 |
status variables that is shown by SHOW STATUS.
|
|
2049 |
Later, in plugin_init, and mysql_install_plugin
|
|
2050 |
new entries could be added to that list.
|
|
2051 |
*/
|
|
2052 |
if (add_status_vars(status_vars)) |
|
2053 |
return 1; // an error was already reported |
|
2054 |
||
2055 |
load_defaults(conf_file_name, groups, &argc, &argv); |
|
2056 |
defaults_argv=argv; |
|
2057 |
defaults_argc=argc; |
|
2058 |
get_options(&defaults_argc, defaults_argv); |
|
2059 |
set_server_version(); |
|
2060 |
||
2061 |
||
2062 |
/* connections and databases needs lots of files */
|
|
2063 |
{
|
|
2064 |
uint files, wanted_files, max_open_files; |
|
2065 |
||
2066 |
/* MyISAM requires two file handles per table. */
|
|
2067 |
wanted_files= 10+max_connections+table_cache_size*2; |
|
2068 |
/*
|
|
2069 |
We are trying to allocate no less than max_connections*5 file
|
|
2070 |
handles (i.e. we are trying to set the limit so that they will
|
|
2071 |
be available). In addition, we allocate no less than how much
|
|
2072 |
was already allocated. However below we report a warning and
|
|
2073 |
recompute values only if we got less file handles than were
|
|
2074 |
explicitly requested. No warning and re-computation occur if we
|
|
2075 |
can't get max_connections*5 but still got no less than was
|
|
2076 |
requested (value of wanted_files).
|
|
2077 |
*/
|
|
2078 |
max_open_files= max(max(wanted_files, max_connections*5), |
|
2079 |
open_files_limit); |
|
2080 |
files= my_set_max_open_files(max_open_files); |
|
2081 |
||
2082 |
if (files < wanted_files) |
|
2083 |
{
|
|
2084 |
if (!open_files_limit) |
|
2085 |
{
|
|
2086 |
/*
|
|
2087 |
If we have requested too much file handles than we bring
|
|
2088 |
max_connections in supported bounds.
|
|
2089 |
*/
|
|
2090 |
max_connections= (ulong) min(files-10-TABLE_OPEN_CACHE_MIN*2, |
|
2091 |
max_connections); |
|
2092 |
/*
|
|
2093 |
Decrease table_cache_size according to max_connections, but
|
|
2094 |
not below TABLE_OPEN_CACHE_MIN. Outer min() ensures that we
|
|
2095 |
never increase table_cache_size automatically (that could
|
|
2096 |
happen if max_connections is decreased above).
|
|
2097 |
*/
|
|
2098 |
table_cache_size= (ulong) min(max((files-10-max_connections)/2, |
|
2099 |
TABLE_OPEN_CACHE_MIN), |
|
2100 |
table_cache_size); |
|
2101 |
if (global_system_variables.log_warnings) |
|
2102 |
sql_print_warning("Changed limits: max_open_files: %u max_connections: %ld table_cache: %ld", |
|
2103 |
files, max_connections, table_cache_size); |
|
2104 |
}
|
|
2105 |
else if (global_system_variables.log_warnings) |
|
2106 |
sql_print_warning("Could not increase number of max_open_files to more than %u (request: %u)", files, wanted_files); |
|
2107 |
}
|
|
2108 |
open_files_limit= files; |
|
2109 |
}
|
|
2110 |
unireg_init(opt_specialflag); /* Set up extern variabels */ |
|
2111 |
if (init_errmessage()) /* Read error messages from file */ |
|
2112 |
return 1; |
|
2113 |
init_client_errs(); |
|
2114 |
lex_init(); |
|
2115 |
if (item_create_init()) |
|
2116 |
return 1; |
|
2117 |
item_init(); |
|
2118 |
if (set_var_init()) |
|
2119 |
return 1; |
|
2120 |
if (init_replication_sys_vars()) |
|
2121 |
return 1; |
|
2122 |
mysys_uses_curses=0; |
|
2123 |
/*
|
|
2124 |
Process a comma-separated character set list and choose
|
|
2125 |
the first available character set. This is mostly for
|
|
2126 |
test purposes, to be able to start "mysqld" even if
|
|
2127 |
the requested character set is not available (see bug#18743).
|
|
2128 |
*/
|
|
2129 |
for (;;) |
|
2130 |
{
|
|
2131 |
char *next_character_set_name= strchr(default_character_set_name, ','); |
|
2132 |
if (next_character_set_name) |
|
2133 |
*next_character_set_name++= '\0'; |
|
2134 |
if (!(default_charset_info= |
|
2135 |
get_charset_by_csname(default_character_set_name, |
|
2136 |
MY_CS_PRIMARY, MYF(MY_WME)))) |
|
2137 |
{
|
|
2138 |
if (next_character_set_name) |
|
2139 |
{
|
|
2140 |
default_character_set_name= next_character_set_name; |
|
2141 |
default_collation_name= 0; // Ignore collation |
|
2142 |
}
|
|
2143 |
else
|
|
2144 |
return 1; // Eof of the list |
|
2145 |
}
|
|
2146 |
else
|
|
2147 |
break; |
|
2148 |
}
|
|
2149 |
||
2150 |
if (default_collation_name) |
|
2151 |
{
|
|
2152 |
CHARSET_INFO *default_collation; |
|
2153 |
default_collation= get_charset_by_name(default_collation_name, MYF(0)); |
|
2154 |
if (!default_collation) |
|
2155 |
{
|
|
2156 |
sql_print_error(ER(ER_UNKNOWN_COLLATION), default_collation_name); |
|
2157 |
return 1; |
|
2158 |
}
|
|
2159 |
if (!my_charset_same(default_charset_info, default_collation)) |
|
2160 |
{
|
|
2161 |
sql_print_error(ER(ER_COLLATION_CHARSET_MISMATCH), |
|
2162 |
default_collation_name, |
|
2163 |
default_charset_info->csname); |
|
2164 |
return 1; |
|
2165 |
}
|
|
2166 |
default_charset_info= default_collation; |
|
2167 |
}
|
|
2168 |
/* Set collactions that depends on the default collation */
|
|
2169 |
global_system_variables.collation_server= default_charset_info; |
|
2170 |
global_system_variables.collation_database= default_charset_info; |
|
2171 |
global_system_variables.collation_connection= default_charset_info; |
|
2172 |
global_system_variables.character_set_results= default_charset_info; |
|
2173 |
global_system_variables.character_set_client= default_charset_info; |
|
2174 |
||
2175 |
global_system_variables.optimizer_use_mrr= 1; |
|
2176 |
global_system_variables.optimizer_switch= 0; |
|
2177 |
||
2178 |
if (!(character_set_filesystem= |
|
2179 |
get_charset_by_csname(character_set_filesystem_name, |
|
2180 |
MY_CS_PRIMARY, MYF(MY_WME)))) |
|
2181 |
return 1; |
|
2182 |
global_system_variables.character_set_filesystem= character_set_filesystem; |
|
2183 |
||
2184 |
if (!(my_default_lc_time_names= |
|
2185 |
my_locale_by_name(lc_time_names_name))) |
|
2186 |
{
|
|
2187 |
sql_print_error("Unknown locale: '%s'", lc_time_names_name); |
|
2188 |
return 1; |
|
2189 |
}
|
|
2190 |
global_system_variables.lc_time_names= my_default_lc_time_names; |
|
2191 |
||
2192 |
sys_init_connect.value_length= 0; |
|
2193 |
if ((sys_init_connect.value= opt_init_connect)) |
|
2194 |
sys_init_connect.value_length= strlen(opt_init_connect); |
|
2195 |
else
|
|
2196 |
sys_init_connect.value=my_strdup("",MYF(0)); |
|
2197 |
||
2198 |
sys_init_slave.value_length= 0; |
|
2199 |
if ((sys_init_slave.value= opt_init_slave)) |
|
2200 |
sys_init_slave.value_length= strlen(opt_init_slave); |
|
2201 |
else
|
|
2202 |
sys_init_slave.value=my_strdup("",MYF(0)); |
|
2203 |
||
2204 |
/* check log options and issue warnings if needed */
|
|
2205 |
if (opt_log && opt_logname && !(log_output_options & LOG_FILE) && |
|
2206 |
!(log_output_options & LOG_NONE)) |
|
2207 |
sql_print_warning("Although a path was specified for the " |
|
2208 |
"--log option, log tables are used. "
|
|
2209 |
"To enable logging to files use the --log-output option."); |
|
2210 |
||
2211 |
if (opt_slow_log && opt_slow_logname && !(log_output_options & LOG_FILE) |
|
2212 |
&& !(log_output_options & LOG_NONE)) |
|
2213 |
sql_print_warning("Although a path was specified for the " |
|
2214 |
"--log-slow-queries option, log tables are used. "
|
|
2215 |
"To enable logging to files use the --log-output=file option."); |
|
2216 |
||
2217 |
s= opt_logname ? opt_logname : make_default_log_name(buff, ".log"); |
|
2218 |
sys_var_general_log_path.value= my_strdup(s, MYF(0)); |
|
2219 |
sys_var_general_log_path.value_length= strlen(s); |
|
2220 |
||
2221 |
s= opt_slow_logname ? opt_slow_logname : make_default_log_name(buff, "-slow.log"); |
|
2222 |
sys_var_slow_log_path.value= my_strdup(s, MYF(0)); |
|
2223 |
sys_var_slow_log_path.value_length= strlen(s); |
|
2224 |
||
2225 |
if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1)) |
|
2226 |
return 1; |
|
2227 |
if (my_database_names_init()) |
|
2228 |
return 1; |
|
2229 |
||
2230 |
/*
|
|
2231 |
Ensure that lower_case_table_names is set on system where we have case
|
|
2232 |
insensitive names. If this is not done the users MyISAM tables will
|
|
2233 |
get corrupted if accesses with names of different case.
|
|
2234 |
*/
|
|
2235 |
lower_case_file_system= test_if_case_insensitive(mysql_real_data_home); |
|
2236 |
if (!lower_case_table_names && lower_case_file_system == 1) |
|
2237 |
{
|
|
2238 |
if (lower_case_table_names_used) |
|
2239 |
{
|
|
2240 |
if (global_system_variables.log_warnings) |
|
2241 |
sql_print_warning("\ |
|
2242 |
You have forced lower_case_table_names to 0 through a command-line \
|
|
2243 |
option, even though your file system '%s' is case insensitive. This means \
|
|
2244 |
that you can corrupt a MyISAM table by accessing it with different cases. \
|
|
2245 |
You should consider changing lower_case_table_names to 1 or 2", |
|
2246 |
mysql_real_data_home); |
|
2247 |
}
|
|
2248 |
else
|
|
2249 |
{
|
|
2250 |
if (global_system_variables.log_warnings) |
|
2251 |
sql_print_warning("Setting lower_case_table_names=2 because file system for %s is case insensitive", mysql_real_data_home); |
|
2252 |
lower_case_table_names= 2; |
|
2253 |
}
|
|
2254 |
}
|
|
2255 |
else if (lower_case_table_names == 2 && |
|
2256 |
!(lower_case_file_system= |
|
2257 |
(test_if_case_insensitive(mysql_real_data_home) == 1))) |
|
2258 |
{
|
|
2259 |
if (global_system_variables.log_warnings) |
|
2260 |
sql_print_warning("lower_case_table_names was set to 2, even though your " |
|
2261 |
"the file system '%s' is case sensitive. Now setting "
|
|
2262 |
"lower_case_table_names to 0 to avoid future problems.", |
|
2263 |
mysql_real_data_home); |
|
2264 |
lower_case_table_names= 0; |
|
2265 |
}
|
|
2266 |
else
|
|
2267 |
{
|
|
2268 |
lower_case_file_system= |
|
2269 |
(test_if_case_insensitive(mysql_real_data_home) == 1); |
|
2270 |
}
|
|
2271 |
||
2272 |
/* Reset table_alias_charset, now that lower_case_table_names is set. */
|
|
2273 |
table_alias_charset= (lower_case_table_names ? |
|
2274 |
files_charset_info : |
|
2275 |
&my_charset_bin); |
|
2276 |
||
2277 |
return 0; |
|
2278 |
}
|
|
2279 |
||
2280 |
||
2281 |
static int init_thread_environment() |
|
2282 |
{
|
|
2283 |
(void) pthread_mutex_init(&LOCK_mysql_create_db,MY_MUTEX_INIT_SLOW); |
|
2284 |
(void) pthread_mutex_init(&LOCK_lock_db,MY_MUTEX_INIT_SLOW); |
|
2285 |
(void) pthread_mutex_init(&LOCK_open, NULL); |
|
2286 |
(void) pthread_mutex_init(&LOCK_thread_count,MY_MUTEX_INIT_FAST); |
|
2287 |
(void) pthread_mutex_init(&LOCK_mapped_file,MY_MUTEX_INIT_SLOW); |
|
2288 |
(void) pthread_mutex_init(&LOCK_status,MY_MUTEX_INIT_FAST); |
|
2289 |
(void) pthread_mutex_init(&LOCK_error_log,MY_MUTEX_INIT_FAST); |
|
2290 |
(void) pthread_mutex_init(&LOCK_crypt,MY_MUTEX_INIT_FAST); |
|
2291 |
(void) pthread_mutex_init(&LOCK_user_conn, MY_MUTEX_INIT_FAST); |
|
2292 |
(void) pthread_mutex_init(&LOCK_active_mi, MY_MUTEX_INIT_FAST); |
|
2293 |
(void) pthread_mutex_init(&LOCK_global_system_variables, MY_MUTEX_INIT_FAST); |
|
2294 |
(void) my_rwlock_init(&LOCK_system_variables_hash, NULL); |
|
2295 |
(void) pthread_mutex_init(&LOCK_global_read_lock, MY_MUTEX_INIT_FAST); |
|
2296 |
(void) pthread_mutex_init(&LOCK_uuid_generator, MY_MUTEX_INIT_FAST); |
|
2297 |
(void) pthread_mutex_init(&LOCK_connection_count, MY_MUTEX_INIT_FAST); |
|
2298 |
(void) my_rwlock_init(&LOCK_sys_init_connect, NULL); |
|
2299 |
(void) my_rwlock_init(&LOCK_sys_init_slave, NULL); |
|
2300 |
(void) pthread_cond_init(&COND_thread_count,NULL); |
|
2301 |
(void) pthread_cond_init(&COND_refresh,NULL); |
|
2302 |
(void) pthread_cond_init(&COND_global_read_lock,NULL); |
|
2303 |
(void) pthread_cond_init(&COND_thread_cache,NULL); |
|
2304 |
(void) pthread_cond_init(&COND_flush_thread_cache,NULL); |
|
2305 |
(void) pthread_mutex_init(&LOCK_rpl_status, MY_MUTEX_INIT_FAST); |
|
2306 |
(void) pthread_cond_init(&COND_rpl_status, NULL); |
|
2307 |
||
2308 |
/* Parameter for threads created for connections */
|
|
2309 |
(void) pthread_attr_init(&connection_attrib); |
|
2310 |
(void) pthread_attr_setdetachstate(&connection_attrib, |
|
2311 |
PTHREAD_CREATE_DETACHED); |
|
2312 |
pthread_attr_setscope(&connection_attrib, PTHREAD_SCOPE_SYSTEM); |
|
2313 |
if (!(opt_specialflag & SPECIAL_NO_PRIOR)) |
|
6
by Brian Aker
Second pass on pthread cleanup |
2314 |
{
|
2315 |
struct sched_param tmp_sched_param; |
|
2316 |
||
2317 |
memset(&tmp_sched_param, 0, sizeof(tmp_sched_param)); |
|
2318 |
tmp_sched_param.sched_priority= WAIT_PRIOR; |
|
2319 |
(void)pthread_attr_setschedparam(&connection_attrib, &tmp_sched_param); |
|
2320 |
}
|
|
1
by brian
clean slate |
2321 |
|
2322 |
if (pthread_key_create(&THR_THD,NULL) || |
|
2323 |
pthread_key_create(&THR_MALLOC,NULL)) |
|
2324 |
{
|
|
2325 |
sql_print_error("Can't create thread-keys"); |
|
2326 |
return 1; |
|
2327 |
}
|
|
2328 |
return 0; |
|
2329 |
}
|
|
2330 |
||
2331 |
||
2332 |
static int init_server_components() |
|
2333 |
{
|
|
2334 |
/*
|
|
2335 |
We need to call each of these following functions to ensure that
|
|
2336 |
all things are initialized so that unireg_abort() doesn't fail
|
|
2337 |
*/
|
|
2338 |
if (table_cache_init() | table_def_init()) |
|
2339 |
unireg_abort(1); |
|
2340 |
||
2341 |
randominit(&sql_rand,(ulong) server_start_time,(ulong) server_start_time/2); |
|
2342 |
setup_fpu(); |
|
2343 |
init_thr_lock(); |
|
2344 |
init_slave_list(); |
|
2345 |
||
2346 |
/* Setup logs */
|
|
2347 |
||
2348 |
/*
|
|
2349 |
Enable old-fashioned error log, except when the user has requested
|
|
2350 |
help information. Since the implementation of plugin server
|
|
2351 |
variables the help output is now written much later.
|
|
2352 |
*/
|
|
2353 |
if (opt_error_log && !opt_help) |
|
2354 |
{
|
|
2355 |
if (!log_error_file_ptr[0]) |
|
2356 |
fn_format(log_error_file, pidfile_name, mysql_data_home, ".err", |
|
2357 |
MY_REPLACE_EXT); /* replace '.<domain>' by '.err', bug#4997 */ |
|
2358 |
else
|
|
2359 |
fn_format(log_error_file, log_error_file_ptr, mysql_data_home, ".err", |
|
2360 |
MY_UNPACK_FILENAME | MY_SAFE_PATH); |
|
2361 |
if (!log_error_file[0]) |
|
2362 |
opt_error_log= 1; // Too long file name |
|
2363 |
else
|
|
2364 |
{
|
|
2365 |
if (freopen(log_error_file, "a+", stdout)) |
|
2366 |
freopen(log_error_file, "a+", stderr); |
|
2367 |
}
|
|
2368 |
}
|
|
2369 |
||
2370 |
if (xid_cache_init()) |
|
2371 |
{
|
|
2372 |
sql_print_error("Out of memory"); |
|
2373 |
unireg_abort(1); |
|
2374 |
}
|
|
2375 |
||
2376 |
if (!opt_bin_log) |
|
2377 |
if (opt_binlog_format_id != BINLOG_FORMAT_UNSPEC) |
|
92
by Brian Aker
Removed opt_update_log |
2378 |
{
|
2379 |
sql_print_error("You need to use --log-bin to make " |
|
2380 |
"--binlog-format work."); |
|
2381 |
unireg_abort(1); |
|
2382 |
}
|
|
1
by brian
clean slate |
2383 |
else
|
92
by Brian Aker
Removed opt_update_log |
2384 |
{
|
1
by brian
clean slate |
2385 |
global_system_variables.binlog_format= BINLOG_FORMAT_MIXED; |
2386 |
}
|
|
2387 |
else
|
|
2388 |
if (opt_binlog_format_id == BINLOG_FORMAT_UNSPEC) |
|
2389 |
global_system_variables.binlog_format= BINLOG_FORMAT_MIXED; |
|
2390 |
else
|
|
2391 |
{
|
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
2392 |
assert(global_system_variables.binlog_format != BINLOG_FORMAT_UNSPEC); |
2393 |
}
|
|
1
by brian
clean slate |
2394 |
|
2395 |
/* Check that we have not let the format to unspecified at this point */
|
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
2396 |
assert((uint)global_system_variables.binlog_format <= |
1
by brian
clean slate |
2397 |
array_elements(binlog_format_names)-1); |
2398 |
||
2399 |
if (opt_log_slave_updates && replicate_same_server_id) |
|
2400 |
{
|
|
2401 |
sql_print_error("\ |
|
2402 |
using --replicate-same-server-id in conjunction with \
|
|
2403 |
--log-slave-updates is impossible, it would lead to infinite loops in this \
|
|
2404 |
server."); |
|
2405 |
unireg_abort(1); |
|
2406 |
}
|
|
2407 |
||
2408 |
if (opt_bin_log) |
|
2409 |
{
|
|
2410 |
char buf[FN_REFLEN]; |
|
2411 |
const char *ln; |
|
2412 |
ln= mysql_bin_log.generate_name(opt_bin_logname, "-bin", 1, buf); |
|
2413 |
if (!opt_bin_logname && !opt_binlog_index_name) |
|
2414 |
{
|
|
2415 |
/*
|
|
2416 |
User didn't give us info to name the binlog index file.
|
|
2417 |
Picking `hostname`-bin.index like did in 4.x, causes replication to
|
|
2418 |
fail if the hostname is changed later. So, we would like to instead
|
|
2419 |
require a name. But as we don't want to break many existing setups, we
|
|
2420 |
only give warning, not error.
|
|
2421 |
*/
|
|
2422 |
sql_print_warning("No argument was provided to --log-bin, and " |
|
2423 |
"--log-bin-index was not used; so replication "
|
|
2424 |
"may break when this MySQL server acts as a "
|
|
2425 |
"master and has his hostname changed!! Please "
|
|
2426 |
"use '--log-bin=%s' to avoid this problem.", ln); |
|
2427 |
}
|
|
2428 |
if (ln == buf) |
|
2429 |
{
|
|
2430 |
my_free(opt_bin_logname, MYF(MY_ALLOW_ZERO_PTR)); |
|
2431 |
opt_bin_logname=my_strdup(buf, MYF(0)); |
|
2432 |
}
|
|
2433 |
if (mysql_bin_log.open_index_file(opt_binlog_index_name, ln)) |
|
2434 |
{
|
|
2435 |
unireg_abort(1); |
|
2436 |
}
|
|
2437 |
||
2438 |
/*
|
|
2439 |
Used to specify which type of lock we need to use for queries of type
|
|
2440 |
INSERT ... SELECT. This will change when we have row level logging.
|
|
2441 |
*/
|
|
2442 |
using_update_log=1; |
|
2443 |
}
|
|
2444 |
||
2445 |
/* call ha_init_key_cache() on all key caches to init them */
|
|
2446 |
process_key_caches(&ha_init_key_cache); |
|
2447 |
||
2448 |
/* Allow storage engine to give real error messages */
|
|
2449 |
if (ha_init_errors()) |
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
2450 |
return(1); |
1
by brian
clean slate |
2451 |
|
2452 |
if (plugin_init(&defaults_argc, defaults_argv, |
|
2453 |
(opt_noacl ? PLUGIN_INIT_SKIP_PLUGIN_TABLE : 0) | |
|
2454 |
(opt_help ? PLUGIN_INIT_SKIP_INITIALIZATION : 0))) |
|
2455 |
{
|
|
2456 |
sql_print_error("Failed to initialize plugins."); |
|
2457 |
unireg_abort(1); |
|
2458 |
}
|
|
2459 |
||
2460 |
if (opt_help) |
|
2461 |
unireg_abort(0); |
|
2462 |
||
2463 |
/* we do want to exit if there are any other unknown options */
|
|
2464 |
if (defaults_argc > 1) |
|
2465 |
{
|
|
2466 |
int ho_error; |
|
2467 |
char **tmp_argv= defaults_argv; |
|
2468 |
struct my_option no_opts[]= |
|
2469 |
{
|
|
2470 |
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} |
|
2471 |
};
|
|
2472 |
/*
|
|
2473 |
We need to eat any 'loose' arguments first before we conclude
|
|
2474 |
that there are unprocessed options.
|
|
2475 |
But we need to preserve defaults_argv pointer intact for
|
|
2476 |
free_defaults() to work. Thus we use a copy here.
|
|
2477 |
*/
|
|
2478 |
my_getopt_skip_unknown= 0; |
|
2479 |
||
2480 |
if ((ho_error= handle_options(&defaults_argc, &tmp_argv, no_opts, |
|
2481 |
mysqld_get_one_option))) |
|
2482 |
unireg_abort(ho_error); |
|
2483 |
||
2484 |
if (defaults_argc) |
|
2485 |
{
|
|
2486 |
fprintf(stderr, "%s: Too many arguments (first extra is '%s').\n" |
|
2487 |
"Use --verbose --help to get a list of available options\n", |
|
2488 |
my_progname, *tmp_argv); |
|
2489 |
unireg_abort(1); |
|
2490 |
}
|
|
2491 |
}
|
|
2492 |
||
2493 |
/* if the errmsg.sys is not loaded, terminate to maintain behaviour */
|
|
2494 |
if (!errmesg[0][0]) |
|
2495 |
unireg_abort(1); |
|
2496 |
||
2497 |
/* We have to initialize the storage engines before CSV logging */
|
|
2498 |
if (ha_init()) |
|
2499 |
{
|
|
2500 |
sql_print_error("Can't init databases"); |
|
2501 |
unireg_abort(1); |
|
2502 |
}
|
|
2503 |
||
2504 |
logger.set_handlers(LOG_FILE, opt_slow_log ? LOG_FILE:LOG_NONE, |
|
2505 |
opt_log ? LOG_FILE:LOG_NONE); |
|
2506 |
||
2507 |
/*
|
|
2508 |
Check that the default storage engine is actually available.
|
|
2509 |
*/
|
|
2510 |
if (default_storage_engine_str) |
|
2511 |
{
|
|
2512 |
LEX_STRING name= { default_storage_engine_str, |
|
2513 |
strlen(default_storage_engine_str) }; |
|
2514 |
plugin_ref plugin; |
|
2515 |
handlerton *hton; |
|
2516 |
||
2517 |
if ((plugin= ha_resolve_by_name(0, &name))) |
|
2518 |
hton= plugin_data(plugin, handlerton*); |
|
2519 |
else
|
|
2520 |
{
|
|
2521 |
sql_print_error("Unknown/unsupported table type: %s", |
|
2522 |
default_storage_engine_str); |
|
2523 |
unireg_abort(1); |
|
2524 |
}
|
|
2525 |
if (!ha_storage_engine_is_enabled(hton)) |
|
2526 |
{
|
|
2527 |
if (!opt_bootstrap) |
|
2528 |
{
|
|
2529 |
sql_print_error("Default storage engine (%s) is not available", |
|
2530 |
default_storage_engine_str); |
|
2531 |
unireg_abort(1); |
|
2532 |
}
|
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
2533 |
assert(global_system_variables.table_plugin); |
1
by brian
clean slate |
2534 |
}
|
2535 |
else
|
|
2536 |
{
|
|
2537 |
/*
|
|
2538 |
Need to unlock as global_system_variables.table_plugin
|
|
2539 |
was acquired during plugin_init()
|
|
2540 |
*/
|
|
2541 |
plugin_unlock(0, global_system_variables.table_plugin); |
|
2542 |
global_system_variables.table_plugin= plugin; |
|
2543 |
}
|
|
2544 |
}
|
|
2545 |
||
2546 |
tc_log= (total_ha_2pc > 1 ? (opt_bin_log ? |
|
2547 |
(TC_LOG *) &mysql_bin_log : |
|
2548 |
(TC_LOG *) &tc_log_mmap) : |
|
2549 |
(TC_LOG *) &tc_log_dummy); |
|
2550 |
||
2551 |
if (tc_log->open(opt_bin_log ? opt_bin_logname : opt_tc_log_file)) |
|
2552 |
{
|
|
2553 |
sql_print_error("Can't init tc log"); |
|
2554 |
unireg_abort(1); |
|
2555 |
}
|
|
2556 |
||
2557 |
if (ha_recover(0)) |
|
2558 |
{
|
|
2559 |
unireg_abort(1); |
|
2560 |
}
|
|
2561 |
||
2562 |
if (opt_bin_log && mysql_bin_log.open(opt_bin_logname, LOG_BIN, 0, |
|
2563 |
WRITE_CACHE, 0, max_binlog_size, 0)) |
|
2564 |
unireg_abort(1); |
|
2565 |
||
2566 |
if (opt_bin_log && expire_logs_days) |
|
2567 |
{
|
|
2568 |
time_t purge_time= server_start_time - expire_logs_days*24*60*60; |
|
2569 |
if (purge_time >= 0) |
|
2570 |
mysql_bin_log.purge_logs_before_date(purge_time); |
|
2571 |
}
|
|
2572 |
||
2573 |
if (opt_myisam_log) |
|
2574 |
(void) mi_log(1); |
|
2575 |
||
2576 |
#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT)
|
|
2577 |
if (locked_in_memory && !getuid()) |
|
2578 |
{
|
|
2579 |
if (setreuid((uid_t)-1, 0) == -1) |
|
2580 |
{ // this should never happen |
|
2581 |
sql_perror("setreuid"); |
|
2582 |
unireg_abort(1); |
|
2583 |
}
|
|
2584 |
if (mlockall(MCL_CURRENT)) |
|
2585 |
{
|
|
2586 |
if (global_system_variables.log_warnings) |
|
2587 |
sql_print_warning("Failed to lock memory. Errno: %d\n",errno); |
|
2588 |
locked_in_memory= 0; |
|
2589 |
}
|
|
2590 |
if (user_info) |
|
2591 |
set_user(mysqld_user, user_info); |
|
2592 |
}
|
|
2593 |
else
|
|
2594 |
#endif
|
|
2595 |
locked_in_memory=0; |
|
2596 |
||
2597 |
init_update_queries(); |
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
2598 |
return(0); |
1
by brian
clean slate |
2599 |
}
|
2600 |
||
2601 |
||
2602 |
int main(int argc, char **argv) |
|
2603 |
{
|
|
2604 |
MY_INIT(argv[0]); // init my_sys library & pthreads |
|
2605 |
/* nothing should come before this line ^^^ */
|
|
2606 |
||
2607 |
/* Set signal used to kill MySQL */
|
|
2608 |
#if defined(SIGUSR2)
|
|
2609 |
thr_kill_signal= thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2; |
|
2610 |
#else
|
|
2611 |
thr_kill_signal= SIGINT; |
|
2612 |
#endif
|
|
2613 |
||
2614 |
/*
|
|
2615 |
Perform basic logger initialization logger. Should be called after
|
|
2616 |
MY_INIT, as it initializes mutexes. Log tables are inited later.
|
|
2617 |
*/
|
|
2618 |
logger.init_base(); |
|
2619 |
||
2620 |
#ifdef _CUSTOMSTARTUPCONFIG_
|
|
2621 |
if (_cust_check_startup()) |
|
2622 |
{
|
|
2623 |
/ * _cust_check_startup will report startup failure error * / |
|
2624 |
exit(1); |
|
2625 |
}
|
|
2626 |
#endif
|
|
2627 |
||
2628 |
if (init_common_variables(MYSQL_CONFIG_NAME, |
|
2629 |
argc, argv, load_default_groups)) |
|
2630 |
unireg_abort(1); // Will do exit |
|
2631 |
||
2632 |
init_signals(); |
|
5
by Brian Aker
Removed my_pthread_setprio() |
2633 |
|
1
by brian
clean slate |
2634 |
pthread_attr_setstacksize(&connection_attrib,my_thread_stack_size); |
161
by Brian Aker
I had removed most of the pthread_setschedparam() calls a bit ago. This |
2635 |
|
1
by brian
clean slate |
2636 |
#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE
|
2637 |
{
|
|
2638 |
/* Retrieve used stack size; Needed for checking stack overflows */
|
|
2639 |
size_t stack_size= 0; |
|
2640 |
pthread_attr_getstacksize(&connection_attrib, &stack_size); |
|
2641 |
/* We must check if stack_size = 0 as Solaris 2.9 can return 0 here */
|
|
2642 |
if (stack_size && stack_size < my_thread_stack_size) |
|
2643 |
{
|
|
2644 |
if (global_system_variables.log_warnings) |
|
2645 |
sql_print_warning("Asked for %lu thread stack, but got %ld", |
|
2646 |
my_thread_stack_size, (long) stack_size); |
|
2647 |
my_thread_stack_size= stack_size; |
|
2648 |
}
|
|
2649 |
}
|
|
2650 |
#endif
|
|
2651 |
||
2652 |
select_thread=pthread_self(); |
|
2653 |
select_thread_in_use=1; |
|
2654 |
||
2655 |
/*
|
|
2656 |
We have enough space for fiddling with the argv, continue
|
|
2657 |
*/
|
|
2658 |
check_data_home(mysql_real_data_home); |
|
2659 |
if (my_setwd(mysql_real_data_home,MYF(MY_WME)) && !opt_help) |
|
2660 |
unireg_abort(1); /* purecov: inspected */ |
|
2661 |
mysql_data_home= mysql_data_home_buff; |
|
2662 |
mysql_data_home[0]=FN_CURLIB; // all paths are relative from here |
|
2663 |
mysql_data_home[1]=0; |
|
2664 |
mysql_data_home_len= 2; |
|
2665 |
||
2666 |
if ((user_info= check_user(mysqld_user))) |
|
2667 |
{
|
|
2668 |
#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT)
|
|
2669 |
if (locked_in_memory) // getuid() == 0 here |
|
2670 |
set_effective_user(user_info); |
|
2671 |
else
|
|
2672 |
#endif
|
|
2673 |
set_user(mysqld_user, user_info); |
|
2674 |
}
|
|
2675 |
||
2676 |
if (opt_bin_log && !server_id) |
|
2677 |
{
|
|
2678 |
server_id= 1; |
|
2679 |
#ifdef EXTRA_DEBUG
|
|
2680 |
sql_print_warning("You have enabled the binary log, but you haven't set " |
|
2681 |
"server-id to a non-zero value: we force server id to 1; "
|
|
2682 |
"updates will be logged to the binary log, but "
|
|
2683 |
"connections from slaves will not be accepted."); |
|
2684 |
#endif
|
|
2685 |
}
|
|
2686 |
||
2687 |
if (init_server_components()) |
|
2688 |
unireg_abort(1); |
|
2689 |
||
2690 |
network_init(); |
|
2691 |
||
2692 |
/*
|
|
2693 |
Initialize my_str_malloc() and my_str_free()
|
|
2694 |
*/
|
|
2695 |
my_str_malloc= &my_str_malloc_mysqld; |
|
2696 |
my_str_free= &my_str_free_mysqld; |
|
2697 |
||
2698 |
/*
|
|
2699 |
init signals & alarm
|
|
2700 |
After this we can't quit by a simple unireg_abort
|
|
2701 |
*/
|
|
2702 |
error_handler_hook= my_message_sql; |
|
2703 |
start_signal_handler(); // Creates pidfile |
|
2704 |
||
2705 |
if (mysql_rm_tmp_tables() || my_tz_init((THD *)0, default_tz_name, opt_bootstrap)) |
|
2706 |
{
|
|
2707 |
abort_loop=1; |
|
2708 |
select_thread_in_use=0; |
|
2709 |
(void) pthread_kill(signal_thread, MYSQL_KILL_SIGNAL); |
|
2710 |
||
2711 |
if (!opt_bootstrap) |
|
2712 |
(void) my_delete(pidfile_name,MYF(MY_WME)); // Not needed anymore |
|
2713 |
||
2714 |
exit(1); |
|
2715 |
}
|
|
2716 |
||
2717 |
init_status_vars(); |
|
2718 |
if (opt_bootstrap) /* If running with bootstrap, do not start replication. */ |
|
2719 |
opt_skip_slave_start= 1; |
|
2720 |
/*
|
|
2721 |
init_slave() must be called after the thread keys are created.
|
|
2722 |
Some parts of the code (e.g. SHOW STATUS LIKE 'slave_running' and other
|
|
2723 |
places) assume that active_mi != 0, so let's fail if it's 0 (out of
|
|
2724 |
memory); a message has already been printed.
|
|
2725 |
*/
|
|
2726 |
if (init_slave() && !active_mi) |
|
2727 |
{
|
|
2728 |
unireg_abort(1); |
|
2729 |
}
|
|
2730 |
||
2731 |
sql_print_information(ER(ER_STARTUP),my_progname,server_version, |
|
11
by Brian Aker
Removing old UNIX socket bits |
2732 |
"", mysqld_port, MYSQL_COMPILATION_COMMENT); |
2733 |
||
2734 |
||
2735 |
handle_connections_sockets(); |
|
1
by brian
clean slate |
2736 |
|
2737 |
/* (void) pthread_attr_destroy(&connection_attrib); */
|
|
2738 |
||
2739 |
||
2740 |
#ifdef EXTRA_DEBUG2
|
|
2741 |
sql_print_error("Before Lock_thread_count"); |
|
2742 |
#endif
|
|
2743 |
(void) pthread_mutex_lock(&LOCK_thread_count); |
|
2744 |
select_thread_in_use=0; // For close_connections |
|
2745 |
(void) pthread_mutex_unlock(&LOCK_thread_count); |
|
2746 |
(void) pthread_cond_broadcast(&COND_thread_count); |
|
2747 |
#ifdef EXTRA_DEBUG2
|
|
2748 |
sql_print_error("After lock_thread_count"); |
|
2749 |
#endif
|
|
2750 |
||
2751 |
/* Wait until cleanup is done */
|
|
2752 |
(void) pthread_mutex_lock(&LOCK_thread_count); |
|
2753 |
while (!ready_to_exit) |
|
2754 |
pthread_cond_wait(&COND_thread_count,&LOCK_thread_count); |
|
2755 |
(void) pthread_mutex_unlock(&LOCK_thread_count); |
|
2756 |
||
2757 |
clean_up(1); |
|
2758 |
mysqld_exit(0); |
|
2759 |
}
|
|
2760 |
||
2761 |
||
2762 |
/**
|
|
2763 |
Create new thread to handle incoming connection.
|
|
2764 |
||
2765 |
This function will create new thread to handle the incoming
|
|
2766 |
connection. If there are idle cached threads one will be used.
|
|
2767 |
'thd' will be pushed into 'threads'.
|
|
2768 |
||
2769 |
In single-threaded mode (\#define ONE_THREAD) connection will be
|
|
2770 |
handled inside this function.
|
|
2771 |
||
2772 |
@param[in,out] thd Thread handle of future thread.
|
|
2773 |
*/
|
|
2774 |
||
2775 |
static void create_new_thread(THD *thd) |
|
2776 |
{
|
|
2777 |
||
2778 |
/*
|
|
2779 |
Don't allow too many connections. We roughly check here that we allow
|
|
2780 |
only (max_connections + 1) connections.
|
|
2781 |
*/
|
|
2782 |
||
2783 |
pthread_mutex_lock(&LOCK_connection_count); |
|
2784 |
||
2785 |
if (connection_count >= max_connections + 1 || abort_loop) |
|
2786 |
{
|
|
2787 |
pthread_mutex_unlock(&LOCK_connection_count); |
|
2788 |
||
2789 |
close_connection(thd, ER_CON_COUNT_ERROR, 1); |
|
2790 |
delete thd; |
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
2791 |
return;; |
1
by brian
clean slate |
2792 |
}
|
2793 |
||
2794 |
++connection_count; |
|
2795 |
||
2796 |
if (connection_count > max_used_connections) |
|
2797 |
max_used_connections= connection_count; |
|
2798 |
||
2799 |
pthread_mutex_unlock(&LOCK_connection_count); |
|
2800 |
||
2801 |
/* Start a new thread to handle connection. */
|
|
2802 |
||
2803 |
pthread_mutex_lock(&LOCK_thread_count); |
|
2804 |
||
2805 |
/*
|
|
2806 |
The initialization of thread_id is done in create_embedded_thd() for
|
|
2807 |
the embedded library.
|
|
2808 |
TODO: refactor this to avoid code duplication there
|
|
2809 |
*/
|
|
2810 |
thd->thread_id= thd->variables.pseudo_thread_id= thread_id++; |
|
2811 |
||
2812 |
thread_count++; |
|
2813 |
||
2814 |
thread_scheduler.add_connection(thd); |
|
2815 |
||
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
2816 |
return;; |
1
by brian
clean slate |
2817 |
}
|
2818 |
||
2819 |
||
2820 |
#ifdef SIGNALS_DONT_BREAK_READ
|
|
2821 |
inline void kill_broken_server() |
|
2822 |
{
|
|
2823 |
/* hack to get around signals ignored in syscalls for problem OS's */
|
|
2824 |
if ((!opt_disable_networking && ip_sock == INVALID_SOCKET)) |
|
2825 |
{
|
|
2826 |
select_thread_in_use = 0; |
|
2827 |
/* The following call will never return */
|
|
2828 |
kill_server((void*) MYSQL_KILL_SIGNAL); |
|
2829 |
}
|
|
2830 |
}
|
|
2831 |
#define MAYBE_BROKEN_SYSCALL kill_broken_server();
|
|
2832 |
#else
|
|
2833 |
#define MAYBE_BROKEN_SYSCALL
|
|
2834 |
#endif
|
|
2835 |
||
2836 |
/* Handle new connections and spawn new process to handle them */
|
|
2837 |
||
11
by Brian Aker
Removing old UNIX socket bits |
2838 |
void handle_connections_sockets() |
1
by brian
clean slate |
2839 |
{
|
2840 |
my_socket sock,new_sock; |
|
2841 |
uint error_count=0; |
|
11
by Brian Aker
Removing old UNIX socket bits |
2842 |
uint max_used_connection= (uint)ip_sock+1; |
1
by brian
clean slate |
2843 |
fd_set readFDs,clientFDs; |
2844 |
THD *thd; |
|
2845 |
struct sockaddr_storage cAddr; |
|
2846 |
int ip_flags=0, flags; |
|
2847 |
st_vio *vio_tmp; |
|
2848 |
||
2849 |
FD_ZERO(&clientFDs); |
|
2850 |
if (ip_sock != INVALID_SOCKET) |
|
2851 |
{
|
|
2852 |
FD_SET(ip_sock,&clientFDs); |
|
2853 |
ip_flags = fcntl(ip_sock, F_GETFL, 0); |
|
2854 |
}
|
|
2855 |
MAYBE_BROKEN_SYSCALL; |
|
2856 |
while (!abort_loop) |
|
2857 |
{
|
|
2858 |
readFDs=clientFDs; |
|
2859 |
if (select((int) max_used_connection,&readFDs,0,0,0) < 0) |
|
2860 |
{
|
|
2861 |
if (socket_errno != SOCKET_EINTR) |
|
2862 |
{
|
|
2863 |
if (!select_errors++ && !abort_loop) /* purecov: inspected */ |
|
2864 |
sql_print_error("mysqld: Got error %d from select",socket_errno); /* purecov: inspected */ |
|
2865 |
}
|
|
2866 |
MAYBE_BROKEN_SYSCALL
|
|
2867 |
continue; |
|
2868 |
}
|
|
2869 |
if (abort_loop) |
|
2870 |
{
|
|
2871 |
MAYBE_BROKEN_SYSCALL; |
|
2872 |
break; |
|
2873 |
}
|
|
2874 |
||
2875 |
/* Is this a new connection request ? */
|
|
2876 |
{
|
|
2877 |
sock = ip_sock; |
|
2878 |
flags= ip_flags; |
|
2879 |
}
|
|
2880 |
||
2881 |
#if !defined(NO_FCNTL_NONBLOCK)
|
|
2882 |
if (!(test_flags & TEST_BLOCKING)) |
|
2883 |
{
|
|
2884 |
#if defined(O_NONBLOCK)
|
|
2885 |
fcntl(sock, F_SETFL, flags | O_NONBLOCK); |
|
2886 |
#elif defined(O_NDELAY)
|
|
2887 |
fcntl(sock, F_SETFL, flags | O_NDELAY); |
|
2888 |
#endif
|
|
2889 |
}
|
|
2890 |
#endif /* NO_FCNTL_NONBLOCK */ |
|
2891 |
for (uint retry=0; retry < MAX_ACCEPT_RETRY; retry++) |
|
2892 |
{
|
|
2893 |
size_socket length= sizeof(struct sockaddr_storage); |
|
2894 |
new_sock= accept(sock, (struct sockaddr *)(&cAddr), |
|
2895 |
&length); |
|
2896 |
if (new_sock != INVALID_SOCKET || |
|
2897 |
(socket_errno != SOCKET_EINTR && socket_errno != SOCKET_EAGAIN)) |
|
2898 |
break; |
|
2899 |
MAYBE_BROKEN_SYSCALL; |
|
2900 |
#if !defined(NO_FCNTL_NONBLOCK)
|
|
2901 |
if (!(test_flags & TEST_BLOCKING)) |
|
2902 |
{
|
|
2903 |
if (retry == MAX_ACCEPT_RETRY - 1) |
|
2904 |
fcntl(sock, F_SETFL, flags); // Try without O_NONBLOCK |
|
2905 |
}
|
|
2906 |
#endif
|
|
2907 |
}
|
|
2908 |
#if !defined(NO_FCNTL_NONBLOCK)
|
|
2909 |
if (!(test_flags & TEST_BLOCKING)) |
|
2910 |
fcntl(sock, F_SETFL, flags); |
|
2911 |
#endif
|
|
2912 |
if (new_sock == INVALID_SOCKET) |
|
2913 |
{
|
|
2914 |
if ((error_count++ & 255) == 0) // This can happen often |
|
2915 |
sql_perror("Error in accept"); |
|
2916 |
MAYBE_BROKEN_SYSCALL; |
|
2917 |
if (socket_errno == SOCKET_ENFILE || socket_errno == SOCKET_EMFILE) |
|
2918 |
sleep(1); // Give other threads some time |
|
2919 |
continue; |
|
2920 |
}
|
|
2921 |
||
2922 |
{
|
|
2923 |
size_socket dummyLen; |
|
2924 |
struct sockaddr_storage dummy; |
|
2925 |
dummyLen = sizeof(dummy); |
|
2926 |
if ( getsockname(new_sock,(struct sockaddr *)&dummy, |
|
2927 |
(socklen_t *)&dummyLen) < 0 ) |
|
2928 |
{
|
|
2929 |
sql_perror("Error on new connection socket"); |
|
2930 |
(void) shutdown(new_sock, SHUT_RDWR); |
|
2931 |
(void) closesocket(new_sock); |
|
2932 |
continue; |
|
2933 |
}
|
|
2934 |
}
|
|
2935 |
||
2936 |
/*
|
|
2937 |
** Don't allow too many connections
|
|
2938 |
*/
|
|
2939 |
||
2940 |
if (!(thd= new THD)) |
|
2941 |
{
|
|
2942 |
(void) shutdown(new_sock, SHUT_RDWR); |
|
2943 |
VOID(closesocket(new_sock)); |
|
2944 |
continue; |
|
2945 |
}
|
|
11
by Brian Aker
Removing old UNIX socket bits |
2946 |
if (!(vio_tmp=vio_new(new_sock, VIO_TYPE_TCPIP, sock == 0)) || |
1
by brian
clean slate |
2947 |
my_net_init(&thd->net,vio_tmp)) |
2948 |
{
|
|
2949 |
/*
|
|
2950 |
Only delete the temporary vio if we didn't already attach it to the
|
|
2951 |
NET object. The destructor in THD will delete any initialized net
|
|
2952 |
structure.
|
|
2953 |
*/
|
|
2954 |
if (vio_tmp && thd->net.vio != vio_tmp) |
|
2955 |
vio_delete(vio_tmp); |
|
2956 |
else
|
|
2957 |
{
|
|
2958 |
(void) shutdown(new_sock, SHUT_RDWR); |
|
2959 |
(void) closesocket(new_sock); |
|
2960 |
}
|
|
2961 |
delete thd; |
|
2962 |
continue; |
|
2963 |
}
|
|
2964 |
||
2965 |
create_new_thread(thd); |
|
2966 |
}
|
|
2967 |
}
|
|
2968 |
||
2969 |
||
2970 |
/****************************************************************************
|
|
2971 |
Handle start options
|
|
2972 |
******************************************************************************/
|
|
2973 |
||
2974 |
enum options_mysqld |
|
2975 |
{
|
|
2976 |
OPT_ISAM_LOG=256, OPT_SKIP_NEW, |
|
77.1.96
by Monty Taylor
Removed skip-external-locking. |
2977 |
OPT_SKIP_GRANT, |
1
by brian
clean slate |
2978 |
OPT_ENABLE_LOCK, OPT_USE_LOCKING, |
2979 |
OPT_SOCKET, OPT_UPDATE_LOG, |
|
2980 |
OPT_BIN_LOG, |
|
2981 |
OPT_BIN_LOG_INDEX, |
|
2982 |
OPT_BIND_ADDRESS, OPT_PID_FILE, |
|
2983 |
OPT_SKIP_PRIOR, OPT_BIG_TABLES, |
|
12.1.3
by Brian Aker
Removal of dead code/remove non-used Falcon tests. |
2984 |
OPT_STANDALONE, |
1
by brian
clean slate |
2985 |
OPT_CONSOLE, OPT_LOW_PRIORITY_UPDATES, |
2986 |
OPT_SHORT_LOG_FORMAT, |
|
2987 |
OPT_FLUSH, OPT_SAFE, |
|
2988 |
OPT_BOOTSTRAP, OPT_SKIP_SHOW_DB, |
|
2989 |
OPT_STORAGE_ENGINE, OPT_INIT_FILE, |
|
2990 |
OPT_DELAY_KEY_WRITE_ALL, OPT_SLOW_QUERY_LOG, |
|
2991 |
OPT_DELAY_KEY_WRITE, OPT_CHARSETS_DIR, |
|
2992 |
OPT_MASTER_INFO_FILE, |
|
2993 |
OPT_MASTER_RETRY_COUNT, OPT_LOG_TC, OPT_LOG_TC_SIZE, |
|
2994 |
OPT_SQL_BIN_UPDATE_SAME, OPT_REPLICATE_DO_DB, |
|
2995 |
OPT_REPLICATE_IGNORE_DB, OPT_LOG_SLAVE_UPDATES, |
|
2996 |
OPT_BINLOG_DO_DB, OPT_BINLOG_IGNORE_DB, |
|
2997 |
OPT_BINLOG_FORMAT, |
|
2998 |
OPT_BINLOG_ROWS_EVENT_MAX_SIZE, |
|
2999 |
OPT_WANT_CORE, |
|
3000 |
OPT_MEMLOCK, OPT_MYISAM_RECOVER, |
|
3001 |
OPT_REPLICATE_REWRITE_DB, OPT_SERVER_ID, |
|
3002 |
OPT_SKIP_SLAVE_START, |
|
3003 |
OPT_REPLICATE_DO_TABLE, |
|
3004 |
OPT_REPLICATE_IGNORE_TABLE, OPT_REPLICATE_WILD_DO_TABLE, |
|
3005 |
OPT_REPLICATE_WILD_IGNORE_TABLE, OPT_REPLICATE_SAME_SERVER_ID, |
|
3006 |
OPT_DISCONNECT_SLAVE_EVENT_COUNT, OPT_TC_HEURISTIC_RECOVER, |
|
3007 |
OPT_ABORT_SLAVE_EVENT_COUNT, |
|
3008 |
OPT_LOG_BIN_TRUST_FUNCTION_CREATORS, |
|
3009 |
OPT_ENGINE_CONDITION_PUSHDOWN, |
|
3010 |
OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_COMPLETION_TYPE, |
|
3011 |
OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS, |
|
3012 |
OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL, |
|
3013 |
OPT_SAFE_USER_CREATE, |
|
3014 |
OPT_DO_PSTACK, OPT_REPORT_HOST, |
|
3015 |
OPT_REPORT_USER, OPT_REPORT_PASSWORD, OPT_REPORT_PORT, |
|
3016 |
OPT_SHOW_SLAVE_AUTH_INFO, |
|
3017 |
OPT_SLAVE_LOAD_TMPDIR, OPT_NO_MIX_TYPE, |
|
3018 |
OPT_RPL_RECOVERY_RANK, |
|
3019 |
OPT_RELAY_LOG, OPT_RELAY_LOG_INDEX, OPT_RELAY_LOG_INFO_FILE, |
|
3020 |
OPT_SLAVE_SKIP_ERRORS, OPT_SLAVE_ALLOW_BATCHING, OPT_DES_KEY_FILE, OPT_LOCAL_INFILE, |
|
3021 |
OPT_SSL_SSL, OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, |
|
3022 |
OPT_SSL_CAPATH, OPT_SSL_CIPHER, |
|
3023 |
OPT_BACK_LOG, OPT_BINLOG_CACHE_SIZE, |
|
3024 |
OPT_CONNECT_TIMEOUT, |
|
160.1.2
by mark
remove FTPARSER and last remains of full text search |
3025 |
OPT_FLUSH_TIME, |
1
by brian
clean slate |
3026 |
OPT_INTERACTIVE_TIMEOUT, OPT_JOIN_BUFF_SIZE, |
3027 |
OPT_KEY_BUFFER_SIZE, OPT_KEY_CACHE_BLOCK_SIZE, |
|
3028 |
OPT_KEY_CACHE_DIVISION_LIMIT, OPT_KEY_CACHE_AGE_THRESHOLD, |
|
3029 |
OPT_LONG_QUERY_TIME, |
|
3030 |
OPT_LOWER_CASE_TABLE_NAMES, OPT_MAX_ALLOWED_PACKET, |
|
3031 |
OPT_MAX_BINLOG_CACHE_SIZE, OPT_MAX_BINLOG_SIZE, |
|
3032 |
OPT_MAX_CONNECTIONS, OPT_MAX_CONNECT_ERRORS, |
|
3033 |
OPT_MAX_HEP_TABLE_SIZE, |
|
3034 |
OPT_MAX_JOIN_SIZE, OPT_MAX_PREPARED_STMT_COUNT, |
|
3035 |
OPT_MAX_RELAY_LOG_SIZE, OPT_MAX_SORT_LENGTH, |
|
3036 |
OPT_MAX_SEEKS_FOR_KEY, OPT_MAX_TMP_TABLES, OPT_MAX_USER_CONNECTIONS, |
|
3037 |
OPT_MAX_LENGTH_FOR_SORT_DATA, |
|
3038 |
OPT_MAX_WRITE_LOCK_COUNT, OPT_BULK_INSERT_BUFFER_SIZE, |
|
3039 |
OPT_MAX_ERROR_COUNT, OPT_MULTI_RANGE_COUNT, OPT_MYISAM_DATA_POINTER_SIZE, |
|
3040 |
OPT_MYISAM_BLOCK_SIZE, OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE, |
|
3041 |
OPT_MYISAM_MAX_SORT_FILE_SIZE, OPT_MYISAM_SORT_BUFFER_SIZE, |
|
3042 |
OPT_MYISAM_USE_MMAP, OPT_MYISAM_REPAIR_THREADS, |
|
3043 |
OPT_MYISAM_STATS_METHOD, |
|
3044 |
OPT_NET_BUFFER_LENGTH, OPT_NET_RETRY_COUNT, |
|
3045 |
OPT_NET_READ_TIMEOUT, OPT_NET_WRITE_TIMEOUT, |
|
3046 |
OPT_OPEN_FILES_LIMIT, |
|
3047 |
OPT_PRELOAD_BUFFER_SIZE, |
|
3048 |
OPT_QUERY_CACHE_LIMIT, OPT_QUERY_CACHE_MIN_RES_UNIT, OPT_QUERY_CACHE_SIZE, |
|
3049 |
OPT_QUERY_CACHE_TYPE, OPT_QUERY_CACHE_WLOCK_INVALIDATE, OPT_RECORD_BUFFER, |
|
3050 |
OPT_RECORD_RND_BUFFER, OPT_DIV_PRECINCREMENT, OPT_RELAY_LOG_SPACE_LIMIT, |
|
3051 |
OPT_RELAY_LOG_PURGE, |
|
3052 |
OPT_SLAVE_NET_TIMEOUT, OPT_SLAVE_COMPRESSED_PROTOCOL, OPT_SLOW_LAUNCH_TIME, |
|
3053 |
OPT_SLAVE_TRANS_RETRIES, OPT_READONLY, OPT_DEBUGGING, |
|
3054 |
OPT_SORT_BUFFER, OPT_TABLE_OPEN_CACHE, OPT_TABLE_DEF_CACHE, |
|
3055 |
OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE, |
|
3056 |
OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK, |
|
3057 |
OPT_WAIT_TIMEOUT, |
|
3058 |
OPT_ERROR_LOG_FILE, |
|
3059 |
OPT_DEFAULT_WEEK_FORMAT, |
|
80.2.1
by mark
remove handling of suspicious UDFs |
3060 |
OPT_RANGE_ALLOC_BLOCK_SIZE, |
1
by brian
clean slate |
3061 |
OPT_QUERY_ALLOC_BLOCK_SIZE, OPT_QUERY_PREALLOC_SIZE, |
3062 |
OPT_TRANS_ALLOC_BLOCK_SIZE, OPT_TRANS_PREALLOC_SIZE, |
|
3063 |
OPT_SYNC_FRM, OPT_SYNC_BINLOG, |
|
3064 |
OPT_SYNC_REPLICATION, |
|
3065 |
OPT_SYNC_REPLICATION_SLAVE_ID, |
|
3066 |
OPT_SYNC_REPLICATION_TIMEOUT, |
|
3067 |
OPT_ENABLE_SHARED_MEMORY, |
|
3068 |
OPT_SHARED_MEMORY_BASE_NAME, |
|
3069 |
OPT_OLD_ALTER_TABLE, |
|
3070 |
OPT_EXPIRE_LOGS_DAYS, |
|
3071 |
OPT_GROUP_CONCAT_MAX_LEN, |
|
3072 |
OPT_DEFAULT_COLLATION, |
|
3073 |
OPT_CHARACTER_SET_CLIENT_HANDSHAKE, |
|
3074 |
OPT_CHARACTER_SET_FILESYSTEM, |
|
3075 |
OPT_LC_TIME_NAMES, |
|
3076 |
OPT_INIT_CONNECT, |
|
3077 |
OPT_INIT_SLAVE, |
|
3078 |
OPT_SECURE_AUTH, |
|
3079 |
OPT_DATE_FORMAT, |
|
3080 |
OPT_TIME_FORMAT, |
|
3081 |
OPT_DATETIME_FORMAT, |
|
3082 |
OPT_LOG_QUERIES_NOT_USING_INDEXES, |
|
3083 |
OPT_DEFAULT_TIME_ZONE, |
|
3084 |
OPT_SYSDATE_IS_NOW, |
|
3085 |
OPT_OPTIMIZER_SEARCH_DEPTH, |
|
3086 |
OPT_OPTIMIZER_PRUNE_LEVEL, |
|
3087 |
OPT_UPDATABLE_VIEWS_WITH_LIMIT, |
|
3088 |
OPT_AUTO_INCREMENT, OPT_AUTO_INCREMENT_OFFSET, |
|
3089 |
OPT_ENABLE_LARGE_PAGES, |
|
3090 |
OPT_TIMED_MUTEXES, |
|
3091 |
OPT_OLD_STYLE_USER_LIMITS, |
|
3092 |
OPT_LOG_SLOW_ADMIN_STATEMENTS, |
|
3093 |
OPT_TABLE_LOCK_WAIT_TIMEOUT, |
|
3094 |
OPT_PLUGIN_LOAD, |
|
3095 |
OPT_PLUGIN_DIR, |
|
3096 |
OPT_LOG_OUTPUT, |
|
3097 |
OPT_PORT_OPEN_TIMEOUT, |
|
3098 |
OPT_PROFILING, |
|
3099 |
OPT_KEEP_FILES_ON_CREATE, |
|
3100 |
OPT_GENERAL_LOG, |
|
3101 |
OPT_SLOW_LOG, |
|
3102 |
OPT_THREAD_HANDLING, |
|
3103 |
OPT_INNODB_ROLLBACK_ON_TIMEOUT, |
|
3104 |
OPT_SECURE_FILE_PRIV, |
|
3105 |
OPT_MIN_EXAMINED_ROW_LIMIT, |
|
3106 |
OPT_LOG_SLOW_SLAVE_STATEMENTS, |
|
3107 |
OPT_OLD_MODE, |
|
3108 |
OPT_POOL_OF_THREADS, |
|
3109 |
OPT_SLAVE_EXEC_MODE
|
|
3110 |
};
|
|
3111 |
||
3112 |
||
3113 |
#define LONG_TIMEOUT ((ulong) 3600L*24L*365L)
|
|
3114 |
||
3115 |
struct my_option my_long_options[] = |
|
3116 |
{
|
|
3117 |
{"help", '?', "Display this help and exit.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3118 |
(char**) &opt_help, (char**) &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, |
1
by brian
clean slate |
3119 |
0, 0}, |
3120 |
{"abort-slave-event-count", OPT_ABORT_SLAVE_EVENT_COUNT, |
|
3121 |
"Option used by mysql-test for debugging and testing of replication.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3122 |
(char**) &abort_slave_event_count, (char**) &abort_slave_event_count, |
1
by brian
clean slate |
3123 |
0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3124 |
{"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax. This mode will also set transaction isolation level 'serializable'.", 0, 0, 0, |
|
3125 |
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, |
|
3126 |
{"auto-increment-increment", OPT_AUTO_INCREMENT, |
|
3127 |
"Auto-increment columns are incremented by this", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3128 |
(char**) &global_system_variables.auto_increment_increment, |
3129 |
(char**) &max_system_variables.auto_increment_increment, 0, GET_ULONG, |
|
1
by brian
clean slate |
3130 |
OPT_ARG, 1, 1, 65535, 0, 1, 0 }, |
3131 |
{"auto-increment-offset", OPT_AUTO_INCREMENT_OFFSET, |
|
3132 |
"Offset added to Auto-increment columns. Used when auto-increment-increment != 1", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3133 |
(char**) &global_system_variables.auto_increment_offset, |
3134 |
(char**) &max_system_variables.auto_increment_offset, 0, GET_ULONG, OPT_ARG, |
|
1
by brian
clean slate |
3135 |
1, 1, 65535, 0, 1, 0 }, |
3136 |
{"basedir", 'b', |
|
3137 |
"Path to installation directory. All paths are usually resolved relative to this.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3138 |
(char**) &mysql_home_ptr, (char**) &mysql_home_ptr, 0, GET_STR, REQUIRED_ARG, |
1
by brian
clean slate |
3139 |
0, 0, 0, 0, 0, 0}, |
3140 |
{"big-tables", OPT_BIG_TABLES, |
|
3141 |
"Allow big result sets by saving all temporary sets on file (Solves most 'table full' errors).", |
|
3142 |
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, |
|
3143 |
{"bind-address", OPT_BIND_ADDRESS, "IP address to bind to.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3144 |
(char**) &my_bind_addr_str, (char**) &my_bind_addr_str, 0, GET_STR, |
1
by brian
clean slate |
3145 |
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3146 |
{"binlog_format", OPT_BINLOG_FORMAT, |
|
3147 |
"Does not have any effect without '--log-bin'. "
|
|
3148 |
"Tell the master the form of binary logging to use: either 'row' for "
|
|
3149 |
"row-based binary logging, or 'statement' for statement-based binary "
|
|
3150 |
"logging, or 'mixed'. 'mixed' is statement-based binary logging except "
|
|
3151 |
"for those statements where only row-based is correct: those which "
|
|
3152 |
"involve user-defined functions (i.e. UDFs) or the UUID() function; for "
|
|
3153 |
"those, row-based binary logging is automatically used. "
|
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3154 |
,(char**) &opt_binlog_format, (char**) &opt_binlog_format, |
1
by brian
clean slate |
3155 |
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3156 |
{"binlog-do-db", OPT_BINLOG_DO_DB, |
|
3157 |
"Tells the master it should log updates for the specified database, and exclude all others not explicitly mentioned.", |
|
3158 |
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
|
3159 |
{"binlog-ignore-db", OPT_BINLOG_IGNORE_DB, |
|
3160 |
"Tells the master that updates to the given database should not be logged tothe binary log.", |
|
3161 |
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
|
3162 |
{"binlog-row-event-max-size", OPT_BINLOG_ROWS_EVENT_MAX_SIZE, |
|
3163 |
"The maximum size of a row-based binary log event in bytes. Rows will be "
|
|
3164 |
"grouped into events smaller than this size if possible. "
|
|
3165 |
"The value has to be a multiple of 256.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3166 |
(char**) &opt_binlog_rows_event_max_size, |
3167 |
(char**) &opt_binlog_rows_event_max_size, 0, |
|
1
by brian
clean slate |
3168 |
GET_ULONG, REQUIRED_ARG, |
3169 |
/* def_value */ 1024, /* min_value */ 256, /* max_value */ ULONG_MAX, |
|
3170 |
/* sub_size */ 0, /* block_size */ 256, |
|
3171 |
/* app_type */ 0 |
|
3172 |
},
|
|
3173 |
#ifndef DISABLE_GRANT_OPTIONS
|
|
3174 |
{"bootstrap", OPT_BOOTSTRAP, "Used by mysql installation scripts.", 0, 0, 0, |
|
3175 |
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, |
|
3176 |
#endif
|
|
3177 |
{"character-set-client-handshake", OPT_CHARACTER_SET_CLIENT_HANDSHAKE, |
|
3178 |
"Don't ignore client side character set value sent during handshake.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3179 |
(char**) &opt_character_set_client_handshake, |
3180 |
(char**) &opt_character_set_client_handshake, |
|
1
by brian
clean slate |
3181 |
0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, |
3182 |
{"character-set-filesystem", OPT_CHARACTER_SET_FILESYSTEM, |
|
3183 |
"Set the filesystem character set.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3184 |
(char**) &character_set_filesystem_name, |
3185 |
(char**) &character_set_filesystem_name, |
|
1
by brian
clean slate |
3186 |
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, |
3187 |
{"character-set-server", 'C', "Set the default character set.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3188 |
(char**) &default_character_set_name, (char**) &default_character_set_name, |
1
by brian
clean slate |
3189 |
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, |
3190 |
{"character-sets-dir", OPT_CHARSETS_DIR, |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3191 |
"Directory where character sets are.", (char**) &charsets_dir, |
3192 |
(char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
|
1
by brian
clean slate |
3193 |
{"chroot", 'r', "Chroot mysqld daemon during startup.", |
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3194 |
(char**) &mysqld_chroot, (char**) &mysqld_chroot, 0, GET_STR, REQUIRED_ARG, |
1
by brian
clean slate |
3195 |
0, 0, 0, 0, 0, 0}, |
3196 |
{"collation-server", OPT_DEFAULT_COLLATION, "Set the default collation.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3197 |
(char**) &default_collation_name, (char**) &default_collation_name, |
1
by brian
clean slate |
3198 |
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, |
3199 |
{"completion-type", OPT_COMPLETION_TYPE, "Default completion type.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3200 |
(char**) &global_system_variables.completion_type, |
3201 |
(char**) &max_system_variables.completion_type, 0, GET_ULONG, |
|
1
by brian
clean slate |
3202 |
REQUIRED_ARG, 0, 0, 2, 0, 1, 0}, |
3203 |
{"console", OPT_CONSOLE, "Write error output on screen; Don't remove the console window on windows.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3204 |
(char**) &opt_console, (char**) &opt_console, 0, GET_BOOL, NO_ARG, 0, 0, 0, |
1
by brian
clean slate |
3205 |
0, 0, 0}, |
3206 |
{"core-file", OPT_WANT_CORE, "Write core on errors.", 0, 0, 0, GET_NO_ARG, |
|
3207 |
NO_ARG, 0, 0, 0, 0, 0, 0}, |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3208 |
{"datadir", 'h', "Path to the database root.", (char**) &mysql_data_home, |
3209 |
(char**) &mysql_data_home, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
|
1
by brian
clean slate |
3210 |
{"default-character-set", 'C', "Set the default character set (deprecated option, use --character-set-server instead).", |
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3211 |
(char**) &default_character_set_name, (char**) &default_character_set_name, |
1
by brian
clean slate |
3212 |
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, |
3213 |
{"default-collation", OPT_DEFAULT_COLLATION, "Set the default collation (deprecated option, use --collation-server instead).", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3214 |
(char**) &default_collation_name, (char**) &default_collation_name, |
1
by brian
clean slate |
3215 |
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, |
3216 |
{"default-storage-engine", OPT_STORAGE_ENGINE, |
|
3217 |
"Set the default storage engine (table type) for tables.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3218 |
(char**)&default_storage_engine_str, (char**)&default_storage_engine_str, |
1
by brian
clean slate |
3219 |
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3220 |
{"default-table-type", OPT_STORAGE_ENGINE, |
|
3221 |
"(deprecated) Use --default-storage-engine.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3222 |
(char**)&default_storage_engine_str, (char**)&default_storage_engine_str, |
1
by brian
clean slate |
3223 |
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3224 |
{"default-time-zone", OPT_DEFAULT_TIME_ZONE, "Set the default time zone.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3225 |
(char**) &default_tz_name, (char**) &default_tz_name, |
1
by brian
clean slate |
3226 |
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, |
3227 |
{"delay-key-write", OPT_DELAY_KEY_WRITE, "Type of DELAY_KEY_WRITE.", |
|
3228 |
0,0,0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, |
|
3229 |
{"delay-key-write-for-all-tables", OPT_DELAY_KEY_WRITE_ALL, |
|
3230 |
"Don't flush key buffers between writes for any MyISAM table (Deprecated option, use --delay-key-write=all instead).", |
|
3231 |
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, |
|
3232 |
{"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT, |
|
3233 |
"Option used by mysql-test for debugging and testing of replication.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3234 |
(char**) &disconnect_slave_event_count, |
3235 |
(char**) &disconnect_slave_event_count, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, |
|
1
by brian
clean slate |
3236 |
0, 0, 0}, |
3237 |
#ifdef HAVE_STACK_TRACE_ON_SEGV
|
|
3238 |
{"enable-pstack", OPT_DO_PSTACK, "Print a symbolic stack trace on failure.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3239 |
(char**) &opt_do_pstack, (char**) &opt_do_pstack, 0, GET_BOOL, NO_ARG, 0, 0, |
1
by brian
clean slate |
3240 |
0, 0, 0, 0}, |
3241 |
#endif /* HAVE_STACK_TRACE_ON_SEGV */ |
|
3242 |
{"engine-condition-pushdown", |
|
3243 |
OPT_ENGINE_CONDITION_PUSHDOWN, |
|
3244 |
"Push supported query conditions to the storage engine.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3245 |
(char**) &global_system_variables.engine_condition_pushdown, |
3246 |
(char**) &global_system_variables.engine_condition_pushdown, |
|
1
by brian
clean slate |
3247 |
0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, |
3248 |
/* See how it's handled in get_one_option() */
|
|
3249 |
{"exit-info", 'T', "Used for debugging; Use at your own risk!", 0, 0, 0, |
|
3250 |
GET_LONG, OPT_ARG, 0, 0, 0, 0, 0, 0}, |
|
3251 |
{"flush", OPT_FLUSH, "Flush tables to disk between SQL commands.", 0, 0, 0, |
|
3252 |
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, |
|
3253 |
/* We must always support the next option to make scripts like mysqltest
|
|
3254 |
easier to do */
|
|
3255 |
{"gdb", OPT_DEBUGGING, |
|
3256 |
"Set up signals usable for debugging", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3257 |
(char**) &opt_debugging, (char**) &opt_debugging, |
1
by brian
clean slate |
3258 |
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, |
3259 |
{"general-log", OPT_GENERAL_LOG, |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3260 |
"Enable|disable general log", (char**) &opt_log, |
3261 |
(char**) &opt_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, |
|
1
by brian
clean slate |
3262 |
{"init-connect", OPT_INIT_CONNECT, "Command(s) that are executed for each new connection", |
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3263 |
(char**) &opt_init_connect, (char**) &opt_init_connect, 0, GET_STR_ALLOC, |
1
by brian
clean slate |
3264 |
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3265 |
{"init-file", OPT_INIT_FILE, "Read SQL commands from this file at startup.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3266 |
(char**) &opt_init_file, (char**) &opt_init_file, 0, GET_STR, REQUIRED_ARG, |
1
by brian
clean slate |
3267 |
0, 0, 0, 0, 0, 0}, |
3268 |
{"init-slave", OPT_INIT_SLAVE, "Command(s) that are executed when a slave connects to this master", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3269 |
(char**) &opt_init_slave, (char**) &opt_init_slave, 0, GET_STR_ALLOC, |
1
by brian
clean slate |
3270 |
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3271 |
{"language", 'L', |
|
3272 |
"Client error messages in given language. May be given as a full path.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3273 |
(char**) &language_ptr, (char**) &language_ptr, 0, GET_STR, REQUIRED_ARG, |
1
by brian
clean slate |
3274 |
0, 0, 0, 0, 0, 0}, |
3275 |
{"lc-time-names", OPT_LC_TIME_NAMES, |
|
3276 |
"Set the language used for the month names and the days of the week.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3277 |
(char**) &lc_time_names_name, |
3278 |
(char**) &lc_time_names_name, |
|
1
by brian
clean slate |
3279 |
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, |
3280 |
{"local-infile", OPT_LOCAL_INFILE, |
|
3281 |
"Enable/disable LOAD DATA LOCAL INFILE (takes values 1|0).", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3282 |
(char**) &opt_local_infile, |
3283 |
(char**) &opt_local_infile, 0, GET_BOOL, OPT_ARG, |
|
1
by brian
clean slate |
3284 |
1, 0, 0, 0, 0, 0}, |
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3285 |
{"log", 'l', "Log connections and queries to file.", (char**) &opt_logname, |
3286 |
(char**) &opt_logname, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, |
|
1
by brian
clean slate |
3287 |
{"log-bin", OPT_BIN_LOG, |
3288 |
"Log update queries in binary format. Optional (but strongly recommended "
|
|
3289 |
"to avoid replication problems if server's hostname changes) argument "
|
|
3290 |
"should be the chosen location for the binary log files.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3291 |
(char**) &opt_bin_logname, (char**) &opt_bin_logname, 0, GET_STR_ALLOC, |
1
by brian
clean slate |
3292 |
OPT_ARG, 0, 0, 0, 0, 0, 0}, |
3293 |
{"log-bin-index", OPT_BIN_LOG_INDEX, |
|
3294 |
"File that holds the names for last binary log files.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3295 |
(char**) &opt_binlog_index_name, (char**) &opt_binlog_index_name, 0, GET_STR, |
1
by brian
clean slate |
3296 |
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3297 |
/*
|
|
3298 |
This option starts with "log-bin" to emphasize that it is specific of
|
|
3299 |
binary logging.
|
|
3300 |
*/
|
|
3301 |
{"log-bin-trust-function-creators", OPT_LOG_BIN_TRUST_FUNCTION_CREATORS, |
|
3302 |
"If equal to 0 (the default), then when --log-bin is used, creation of "
|
|
3303 |
"a stored function (or trigger) is allowed only to users having the SUPER privilege "
|
|
3304 |
"and only if this stored function (trigger) may not break binary logging."
|
|
3305 |
"Note that if ALL connections to this server ALWAYS use row-based binary "
|
|
3306 |
"logging, the security issues do not exist and the binary logging cannot "
|
|
3307 |
"break, so you can safely set this to 1."
|
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3308 |
,(char**) &trust_function_creators, (char**) &trust_function_creators, 0, |
1
by brian
clean slate |
3309 |
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, |
3310 |
{"log-error", OPT_ERROR_LOG_FILE, "Error log file.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3311 |
(char**) &log_error_file_ptr, (char**) &log_error_file_ptr, 0, GET_STR, |
1
by brian
clean slate |
3312 |
OPT_ARG, 0, 0, 0, 0, 0, 0}, |
3313 |
{"log-isam", OPT_ISAM_LOG, "Log all MyISAM changes to file.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3314 |
(char**) &myisam_log_filename, (char**) &myisam_log_filename, 0, GET_STR, |
1
by brian
clean slate |
3315 |
OPT_ARG, 0, 0, 0, 0, 0, 0}, |
3316 |
{"log-long-format", '0', |
|
3317 |
"Log some extra information to update log. Please note that this option is deprecated; see --log-short-format option.", |
|
3318 |
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, |
|
3319 |
#ifdef WITH_CSV_STORAGE_ENGINE
|
|
3320 |
{"log-output", OPT_LOG_OUTPUT, |
|
3321 |
"Syntax: log-output[=value[,value...]], where \"value\" could be TABLE, " |
|
3322 |
"FILE or NONE.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3323 |
(char**) &log_output_str, (char**) &log_output_str, 0, |
1
by brian
clean slate |
3324 |
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, |
3325 |
#endif
|
|
3326 |
{"log-queries-not-using-indexes", OPT_LOG_QUERIES_NOT_USING_INDEXES, |
|
3327 |
"Log queries that are executed without benefit of any index to the slow log if it is open.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3328 |
(char**) &opt_log_queries_not_using_indexes, (char**) &opt_log_queries_not_using_indexes, |
1
by brian
clean slate |
3329 |
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, |
3330 |
{"log-short-format", OPT_SHORT_LOG_FORMAT, |
|
3331 |
"Don't log extra information to update and slow-query logs.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3332 |
(char**) &opt_short_log_format, (char**) &opt_short_log_format, |
1
by brian
clean slate |
3333 |
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, |
3334 |
{"log-slave-updates", OPT_LOG_SLAVE_UPDATES, |
|
3335 |
"Tells the slave to log the updates from the slave thread to the binary log. You will need to turn it on if you plan to daisy-chain the slaves.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3336 |
(char**) &opt_log_slave_updates, (char**) &opt_log_slave_updates, 0, GET_BOOL, |
1
by brian
clean slate |
3337 |
NO_ARG, 0, 0, 0, 0, 0, 0}, |
3338 |
{"log-slow-admin-statements", OPT_LOG_SLOW_ADMIN_STATEMENTS, |
|
3339 |
"Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements to the slow log if it is open.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3340 |
(char**) &opt_log_slow_admin_statements, |
3341 |
(char**) &opt_log_slow_admin_statements, |
|
1
by brian
clean slate |
3342 |
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, |
3343 |
{"log-slow-slave-statements", OPT_LOG_SLOW_SLAVE_STATEMENTS, |
|
3344 |
"Log slow statements executed by slave thread to the slow log if it is open.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3345 |
(char**) &opt_log_slow_slave_statements, |
3346 |
(char**) &opt_log_slow_slave_statements, |
|
1
by brian
clean slate |
3347 |
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, |
3348 |
{"log-slow-queries", OPT_SLOW_QUERY_LOG, |
|
3349 |
"Log slow queries to a table or log file. Defaults logging to table mysql.slow_log or hostname-slow.log if --log-output=file is used. Must be enabled to activate other slow log options.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3350 |
(char**) &opt_slow_logname, (char**) &opt_slow_logname, 0, GET_STR, OPT_ARG, |
1
by brian
clean slate |
3351 |
0, 0, 0, 0, 0, 0}, |
3352 |
{"log-tc", OPT_LOG_TC, |
|
3353 |
"Path to transaction coordinator log (used for transactions that affect "
|
|
3354 |
"more than one storage engine, when binary log is disabled)", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3355 |
(char**) &opt_tc_log_file, (char**) &opt_tc_log_file, 0, GET_STR, |
1
by brian
clean slate |
3356 |
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3357 |
#ifdef HAVE_MMAP
|
|
3358 |
{"log-tc-size", OPT_LOG_TC_SIZE, "Size of transaction coordinator log.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3359 |
(char**) &opt_tc_log_size, (char**) &opt_tc_log_size, 0, GET_ULONG, |
1
by brian
clean slate |
3360 |
REQUIRED_ARG, TC_LOG_MIN_SIZE, TC_LOG_MIN_SIZE, ULONG_MAX, 0, |
3361 |
TC_LOG_PAGE_SIZE, 0}, |
|
3362 |
#endif
|
|
3363 |
{"log-warnings", 'W', "Log some not critical warnings to the log file.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3364 |
(char**) &global_system_variables.log_warnings, |
3365 |
(char**) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0, |
|
1
by brian
clean slate |
3366 |
0, 0, 0}, |
3367 |
{"low-priority-updates", OPT_LOW_PRIORITY_UPDATES, |
|
3368 |
"INSERT/DELETE/UPDATE has lower priority than selects.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3369 |
(char**) &global_system_variables.low_priority_updates, |
3370 |
(char**) &max_system_variables.low_priority_updates, |
|
1
by brian
clean slate |
3371 |
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, |
3372 |
{"master-info-file", OPT_MASTER_INFO_FILE, |
|
3373 |
"The location and name of the file that remembers the master and where the I/O replication \
|
|
3374 |
thread is in the master's binlogs.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3375 |
(char**) &master_info_file, (char**) &master_info_file, 0, GET_STR, |
1
by brian
clean slate |
3376 |
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3377 |
{"master-retry-count", OPT_MASTER_RETRY_COUNT, |
|
3378 |
"The number of tries the slave will make to connect to the master before giving up.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3379 |
(char**) &master_retry_count, (char**) &master_retry_count, 0, GET_ULONG, |
1
by brian
clean slate |
3380 |
REQUIRED_ARG, 3600*24, 0, 0, 0, 0, 0}, |
3381 |
{"max-binlog-dump-events", OPT_MAX_BINLOG_DUMP_EVENTS, |
|
3382 |
"Option used by mysql-test for debugging and testing of replication.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3383 |
(char**) &max_binlog_dump_events, (char**) &max_binlog_dump_events, 0, |
1
by brian
clean slate |
3384 |
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3385 |
{"memlock", OPT_MEMLOCK, "Lock mysqld in memory.", (char**) &locked_in_memory, |
3386 |
(char**) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, |
|
1
by brian
clean slate |
3387 |
{"myisam-recover", OPT_MYISAM_RECOVER, |
3388 |
"Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3389 |
(char**) &myisam_recover_options_str, (char**) &myisam_recover_options_str, 0, |
1
by brian
clean slate |
3390 |
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, |
3391 |
{"new", 'n', "Use very new possible 'unsafe' functions.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3392 |
(char**) &global_system_variables.new_mode, |
3393 |
(char**) &max_system_variables.new_mode, |
|
1
by brian
clean slate |
3394 |
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, |
3395 |
{"old-alter-table", OPT_OLD_ALTER_TABLE, |
|
3396 |
"Use old, non-optimized alter table.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3397 |
(char**) &global_system_variables.old_alter_table, |
3398 |
(char**) &max_system_variables.old_alter_table, 0, GET_BOOL, NO_ARG, |
|
1
by brian
clean slate |
3399 |
0, 0, 0, 0, 0, 0}, |
3400 |
{"old-style-user-limits", OPT_OLD_STYLE_USER_LIMITS, |
|
3401 |
"Enable old-style user limits (before 5.0.3 user resources were counted per each user+host vs. per account)", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3402 |
(char**) &opt_old_style_user_limits, (char**) &opt_old_style_user_limits, |
1
by brian
clean slate |
3403 |
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, |
3404 |
{"pid-file", OPT_PID_FILE, "Pid file used by safe_mysqld.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3405 |
(char**) &pidfile_name_ptr, (char**) &pidfile_name_ptr, 0, GET_STR, |
1
by brian
clean slate |
3406 |
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3407 |
{"port", 'P', "Port number to use for connection or 0 for default to, in " |
|
3408 |
"order of preference, my.cnf, $MYSQL_TCP_PORT, "
|
|
3409 |
#if MYSQL_PORT_DEFAULT == 0
|
|
3410 |
"/etc/services, "
|
|
3411 |
#endif
|
|
3412 |
"built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3413 |
(char**) &mysqld_port, |
3414 |
(char**) &mysqld_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
|
1
by brian
clean slate |
3415 |
{"port-open-timeout", OPT_PORT_OPEN_TIMEOUT, |
3416 |
"Maximum time in seconds to wait for the port to become free. "
|
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3417 |
"(Default: no wait)", (char**) &mysqld_port_timeout, |
3418 |
(char**) &mysqld_port_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
|
1
by brian
clean slate |
3419 |
{"relay-log", OPT_RELAY_LOG, |
3420 |
"The location and name to use for relay logs.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3421 |
(char**) &opt_relay_logname, (char**) &opt_relay_logname, 0, |
1
by brian
clean slate |
3422 |
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3423 |
{"relay-log-index", OPT_RELAY_LOG_INDEX, |
|
3424 |
"The location and name to use for the file that keeps a list of the last \
|
|
3425 |
relay logs.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3426 |
(char**) &opt_relaylog_index_name, (char**) &opt_relaylog_index_name, 0, |
1
by brian
clean slate |
3427 |
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3428 |
{"relay-log-info-file", OPT_RELAY_LOG_INFO_FILE, |
|
3429 |
"The location and name of the file that remembers where the SQL replication \
|
|
3430 |
thread is in the relay logs.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3431 |
(char**) &relay_log_info_file, (char**) &relay_log_info_file, 0, GET_STR, |
1
by brian
clean slate |
3432 |
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3433 |
{"replicate-do-db", OPT_REPLICATE_DO_DB, |
|
3434 |
"Tells the slave thread to restrict replication to the specified database. To specify more than one database, use the directive multiple times, once for each database. Note that this will only work if you do not use cross-database queries such as UPDATE some_db.some_table SET foo='bar' while having selected a different or no database. If you need cross database updates to work, make sure you have 3.23.28 or later, and use replicate-wild-do-table=db_name.%.", |
|
3435 |
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
|
3436 |
{"replicate-do-table", OPT_REPLICATE_DO_TABLE, |
|
3437 |
"Tells the slave thread to restrict replication to the specified table. To specify more than one table, use the directive multiple times, once for each table. This will work for cross-database updates, in contrast to replicate-do-db.", |
|
3438 |
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
|
3439 |
{"replicate-ignore-db", OPT_REPLICATE_IGNORE_DB, |
|
3440 |
"Tells the slave thread to not replicate to the specified database. To specify more than one database to ignore, use the directive multiple times, once for each database. This option will not work if you use cross database updates. If you need cross database updates to work, make sure you have 3.23.28 or later, and use replicate-wild-ignore-table=db_name.%. ", |
|
3441 |
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
|
3442 |
{"replicate-ignore-table", OPT_REPLICATE_IGNORE_TABLE, |
|
3443 |
"Tells the slave thread to not replicate to the specified table. To specify more than one table to ignore, use the directive multiple times, once for each table. This will work for cross-datbase updates, in contrast to replicate-ignore-db.", |
|
3444 |
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
|
3445 |
{"replicate-rewrite-db", OPT_REPLICATE_REWRITE_DB, |
|
3446 |
"Updates to a database with a different name than the original. Example: replicate-rewrite-db=master_db_name->slave_db_name.", |
|
3447 |
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
|
3448 |
{"replicate-same-server-id", OPT_REPLICATE_SAME_SERVER_ID, |
|
3449 |
"In replication, if set to 1, do not skip events having our server id. \
|
|
3450 |
Default value is 0 (to break infinite loops in circular replication). \
|
|
3451 |
Can't be set to 1 if --log-slave-updates is used.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3452 |
(char**) &replicate_same_server_id, |
3453 |
(char**) &replicate_same_server_id, |
|
1
by brian
clean slate |
3454 |
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, |
3455 |
{"replicate-wild-do-table", OPT_REPLICATE_WILD_DO_TABLE, |
|
3456 |
"Tells the slave thread to restrict replication to the tables that match the specified wildcard pattern. To specify more than one table, use the directive multiple times, once for each table. This will work for cross-database updates. Example: replicate-wild-do-table=foo%.bar% will replicate only updates to tables in all databases that start with foo and whose table names start with bar.", |
|
3457 |
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
|
3458 |
{"replicate-wild-ignore-table", OPT_REPLICATE_WILD_IGNORE_TABLE, |
|
3459 |
"Tells the slave thread to not replicate to the tables that match the given wildcard pattern. To specify more than one table to ignore, use the directive multiple times, once for each table. This will work for cross-database updates. Example: replicate-wild-ignore-table=foo%.bar% will not do updates to tables in databases that start with foo and whose table names start with bar.", |
|
3460 |
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
|
3461 |
// In replication, we may need to tell the other servers how to connect
|
|
3462 |
{"report-host", OPT_REPORT_HOST, |
|
3463 |
"Hostname or IP of the slave to be reported to to the master during slave registration. Will appear in the output of SHOW SLAVE HOSTS. Leave unset if you do not want the slave to register itself with the master. Note that it is not sufficient for the master to simply read the IP of the slave off the socket once the slave connects. Due to NAT and other routing issues, that IP may not be valid for connecting to the slave from the master or other hosts.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3464 |
(char**) &report_host, (char**) &report_host, 0, GET_STR, REQUIRED_ARG, 0, 0, |
1
by brian
clean slate |
3465 |
0, 0, 0, 0}, |
3466 |
{"report-password", OPT_REPORT_PASSWORD, "Undocumented.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3467 |
(char**) &report_password, (char**) &report_password, 0, GET_STR, |
1
by brian
clean slate |
3468 |
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3469 |
{"report-port", OPT_REPORT_PORT, |
|
3470 |
"Port for connecting to slave reported to the master during slave registration. Set it only if the slave is listening on a non-default port or if you have a special tunnel from the master or other clients to the slave. If not sure, leave this option unset.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3471 |
(char**) &report_port, (char**) &report_port, 0, GET_UINT, REQUIRED_ARG, |
1
by brian
clean slate |
3472 |
MYSQL_PORT, 0, 0, 0, 0, 0}, |
3473 |
{"safe-mode", OPT_SAFE, "Skip some optimize stages (for testing).", |
|
3474 |
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, |
|
3475 |
{"secure-file-priv", OPT_SECURE_FILE_PRIV, |
|
3476 |
"Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files within specified directory", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3477 |
(char**) &opt_secure_file_priv, (char**) &opt_secure_file_priv, 0, |
1
by brian
clean slate |
3478 |
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3479 |
{"server-id", OPT_SERVER_ID, |
|
3480 |
"Uniquely identifies the server instance in the community of replication partners.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3481 |
(char**) &server_id, (char**) &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0, |
1
by brian
clean slate |
3482 |
0, 0, 0}, |
3483 |
{"set-variable", 'O', |
|
3484 |
"Change the value of a variable. Please note that this option is deprecated;you can set variables directly with --variable-name=value.", |
|
3485 |
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
|
3486 |
{"skip-new", OPT_SKIP_NEW, "Don't use new, possible wrong routines.", |
|
3487 |
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, |
|
3488 |
{"skip-slave-start", OPT_SKIP_SLAVE_START, |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3489 |
"If set, slave is not autostarted.", (char**) &opt_skip_slave_start, |
3490 |
(char**) &opt_skip_slave_start, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, |
|
1
by brian
clean slate |
3491 |
{"skip-stack-trace", OPT_SKIP_STACK_TRACE, |
3492 |
"Don't print a stack trace on failure.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, |
|
3493 |
0, 0, 0, 0}, |
|
3494 |
{"skip-symlink", OPT_SKIP_SYMLINKS, "Don't allow symlinking of tables. Deprecated option. Use --skip-symbolic-links instead.", |
|
3495 |
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, |
|
3496 |
{"skip-thread-priority", OPT_SKIP_PRIOR, |
|
3497 |
"Don't give threads different priorities.", 0, 0, 0, GET_NO_ARG, NO_ARG, |
|
3498 |
DEFAULT_SKIP_THREAD_PRIORITY, 0, 0, 0, 0, 0}, |
|
3499 |
{"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR, |
|
3500 |
"The location where the slave should put its temporary files when \
|
|
3501 |
replicating a LOAD DATA INFILE command.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3502 |
(char**) &slave_load_tmpdir, (char**) &slave_load_tmpdir, 0, GET_STR_ALLOC, |
1
by brian
clean slate |
3503 |
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3504 |
{"slave-skip-errors", OPT_SLAVE_SKIP_ERRORS, |
|
3505 |
"Tells the slave thread to continue replication when a query event returns an error from the provided list.", |
|
3506 |
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
|
3507 |
{"slave-exec-mode", OPT_SLAVE_EXEC_MODE, |
|
3508 |
"Modes for how replication events should be executed. Legal values are STRICT (default) and IDEMPOTENT. In IDEMPOTENT mode, replication will not stop for operations that are idempotent. In STRICT mode, replication will stop on any unexpected difference between the master and the slave.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3509 |
(char**) &slave_exec_mode_str, (char**) &slave_exec_mode_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
1
by brian
clean slate |
3510 |
{"slow-query-log", OPT_SLOW_LOG, |
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3511 |
"Enable|disable slow query log", (char**) &opt_slow_log, |
3512 |
(char**) &opt_slow_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, |
|
1
by brian
clean slate |
3513 |
{"sql-bin-update-same", OPT_SQL_BIN_UPDATE_SAME, |
3514 |
"The update log is deprecated since version 5.0, is replaced by the binary \
|
|
3515 |
log and this option does nothing anymore.", |
|
3516 |
0, 0, 0, GET_DISABLED, NO_ARG, 0, 0, 0, 0, 0, 0}, |
|
3517 |
{"symbolic-links", 's', "Enable symbolic link support.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3518 |
(char**) &my_use_symdir, (char**) &my_use_symdir, 0, GET_BOOL, NO_ARG, |
1
by brian
clean slate |
3519 |
/*
|
3520 |
The system call realpath() produces warnings under valgrind and
|
|
3521 |
purify. These are not suppressed: instead we disable symlinks
|
|
3522 |
option if compiled with valgrind support.
|
|
3523 |
*/
|
|
3524 |
IF_PURIFY(0,1), 0, 0, 0, 0, 0}, |
|
3525 |
{"sysdate-is-now", OPT_SYSDATE_IS_NOW, |
|
3526 |
"Non-default option to alias SYSDATE() to NOW() to make it safe-replicable. Since 5.0, SYSDATE() returns a `dynamic' value different for different invocations, even within the same statement.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3527 |
(char**) &global_system_variables.sysdate_is_now, |
1
by brian
clean slate |
3528 |
0, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0}, |
3529 |
{"tc-heuristic-recover", OPT_TC_HEURISTIC_RECOVER, |
|
3530 |
"Decision to use in heuristic recover process. Possible values are COMMIT or ROLLBACK.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3531 |
(char**) &opt_tc_heuristic_recover, (char**) &opt_tc_heuristic_recover, |
1
by brian
clean slate |
3532 |
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3533 |
{"temp-pool", OPT_TEMP_POOL, |
|
3534 |
"Using this option will cause most temporary files created to use a small set of names, rather than a unique name for each new file.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3535 |
(char**) &use_temp_pool, (char**) &use_temp_pool, 0, GET_BOOL, NO_ARG, 1, |
1
by brian
clean slate |
3536 |
0, 0, 0, 0, 0}, |
3537 |
{"timed_mutexes", OPT_TIMED_MUTEXES, |
|
3538 |
"Specify whether to time mutexes (only InnoDB mutexes are currently supported)", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3539 |
(char**) &timed_mutexes, (char**) &timed_mutexes, 0, GET_BOOL, NO_ARG, 0, |
1
by brian
clean slate |
3540 |
0, 0, 0, 0, 0}, |
3541 |
{"tmpdir", 't', |
|
3542 |
"Path for temporary files. Several paths may be specified, separated by a "
|
|
3543 |
"colon (:)"
|
|
3544 |
", in this case they are used in a round-robin fashion.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3545 |
(char**) &opt_mysql_tmpdir, |
3546 |
(char**) &opt_mysql_tmpdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
|
1
by brian
clean slate |
3547 |
{"transaction-isolation", OPT_TX_ISOLATION, |
3548 |
"Default transaction isolation level.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, |
|
3549 |
0, 0, 0, 0, 0}, |
|
3550 |
{"use-symbolic-links", 's', "Enable symbolic link support. Deprecated option; use --symbolic-links instead.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3551 |
(char**) &my_use_symdir, (char**) &my_use_symdir, 0, GET_BOOL, NO_ARG, |
1
by brian
clean slate |
3552 |
IF_PURIFY(0,1), 0, 0, 0, 0, 0}, |
3553 |
{"user", 'u', "Run mysqld daemon as user.", 0, 0, 0, GET_STR, REQUIRED_ARG, |
|
3554 |
0, 0, 0, 0, 0, 0}, |
|
3555 |
{"verbose", 'v', "Used with --help option for detailed help", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3556 |
(char**) &opt_verbose, (char**) &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, |
1
by brian
clean slate |
3557 |
0, 0}, |
3558 |
{"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG, |
|
3559 |
NO_ARG, 0, 0, 0, 0, 0, 0}, |
|
3560 |
{"warnings", 'W', "Deprecated; use --log-warnings instead.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3561 |
(char**) &global_system_variables.log_warnings, |
3562 |
(char**) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, |
|
1
by brian
clean slate |
3563 |
1, 0, ULONG_MAX, 0, 0, 0}, |
3564 |
{ "back_log", OPT_BACK_LOG, |
|
3565 |
"The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3566 |
(char**) &back_log, (char**) &back_log, 0, GET_ULONG, |
1
by brian
clean slate |
3567 |
REQUIRED_ARG, 50, 1, 65535, 0, 1, 0 }, |
3568 |
{"binlog_cache_size", OPT_BINLOG_CACHE_SIZE, |
|
3569 |
"The size of the cache to hold the SQL statements for the binary log during a transaction. If you often use big, multi-statement transactions you can increase this to get more performance.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3570 |
(char**) &binlog_cache_size, (char**) &binlog_cache_size, 0, GET_ULONG, |
1
by brian
clean slate |
3571 |
REQUIRED_ARG, 32*1024L, IO_SIZE, ULONG_MAX, 0, IO_SIZE, 0}, |
3572 |
{"bulk_insert_buffer_size", OPT_BULK_INSERT_BUFFER_SIZE, |
|
3573 |
"Size of tree cache used in bulk insert optimisation. Note that this is a limit per thread!", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3574 |
(char**) &global_system_variables.bulk_insert_buff_size, |
3575 |
(char**) &max_system_variables.bulk_insert_buff_size, |
|
1
by brian
clean slate |
3576 |
0, GET_ULONG, REQUIRED_ARG, 8192*1024, 0, ULONG_MAX, 0, 1, 0}, |
3577 |
{"connect_timeout", OPT_CONNECT_TIMEOUT, |
|
3578 |
"The number of seconds the mysqld server is waiting for a connect packet before responding with 'Bad handshake'.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3579 |
(char**) &connect_timeout, (char**) &connect_timeout, |
1
by brian
clean slate |
3580 |
0, GET_ULONG, REQUIRED_ARG, CONNECT_TIMEOUT, 2, LONG_TIMEOUT, 0, 1, 0 }, |
3581 |
{ "date_format", OPT_DATE_FORMAT, |
|
3582 |
"The DATE format (For future).", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3583 |
(char**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATE], |
3584 |
(char**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATE], |
|
1
by brian
clean slate |
3585 |
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3586 |
{ "datetime_format", OPT_DATETIME_FORMAT, |
|
3587 |
"The DATETIME/TIMESTAMP format (for future).", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3588 |
(char**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATETIME], |
3589 |
(char**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATETIME], |
|
1
by brian
clean slate |
3590 |
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3591 |
{ "default_week_format", OPT_DEFAULT_WEEK_FORMAT, |
|
3592 |
"The default week format used by WEEK() functions.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3593 |
(char**) &global_system_variables.default_week_format, |
3594 |
(char**) &max_system_variables.default_week_format, |
|
1
by brian
clean slate |
3595 |
0, GET_ULONG, REQUIRED_ARG, 0, 0, 7L, 0, 1, 0}, |
3596 |
{"div_precision_increment", OPT_DIV_PRECINCREMENT, |
|
3597 |
"Precision of the result of '/' operator will be increased on that value.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3598 |
(char**) &global_system_variables.div_precincrement, |
3599 |
(char**) &max_system_variables.div_precincrement, 0, GET_ULONG, |
|
1
by brian
clean slate |
3600 |
REQUIRED_ARG, 4, 0, DECIMAL_MAX_SCALE, 0, 0, 0}, |
3601 |
{"expire_logs_days", OPT_EXPIRE_LOGS_DAYS, |
|
3602 |
"If non-zero, binary logs will be purged after expire_logs_days "
|
|
3603 |
"days; possible purges happen at startup and at binary log rotation.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3604 |
(char**) &expire_logs_days, |
3605 |
(char**) &expire_logs_days, 0, GET_ULONG, |
|
1
by brian
clean slate |
3606 |
REQUIRED_ARG, 0, 0, 99, 0, 1, 0}, |
3607 |
{ "group_concat_max_len", OPT_GROUP_CONCAT_MAX_LEN, |
|
3608 |
"The maximum length of the result of function group_concat.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3609 |
(char**) &global_system_variables.group_concat_max_len, |
3610 |
(char**) &max_system_variables.group_concat_max_len, 0, GET_ULONG, |
|
1
by brian
clean slate |
3611 |
REQUIRED_ARG, 1024, 4, ULONG_MAX, 0, 1, 0}, |
3612 |
{"interactive_timeout", OPT_INTERACTIVE_TIMEOUT, |
|
3613 |
"The number of seconds the server waits for activity on an interactive connection before closing it.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3614 |
(char**) &global_system_variables.net_interactive_timeout, |
3615 |
(char**) &max_system_variables.net_interactive_timeout, 0, |
|
1
by brian
clean slate |
3616 |
GET_ULONG, REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, |
3617 |
{"join_buffer_size", OPT_JOIN_BUFF_SIZE, |
|
3618 |
"The size of the buffer that is used for full joins.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3619 |
(char**) &global_system_variables.join_buff_size, |
3620 |
(char**) &max_system_variables.join_buff_size, 0, GET_ULONG, |
|
1
by brian
clean slate |
3621 |
REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ULONG_MAX, |
3622 |
MALLOC_OVERHEAD, IO_SIZE, 0}, |
|
3623 |
{"keep_files_on_create", OPT_KEEP_FILES_ON_CREATE, |
|
3624 |
"Don't overwrite stale .MYD and .MYI even if no directory is specified.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3625 |
(char**) &global_system_variables.keep_files_on_create, |
3626 |
(char**) &max_system_variables.keep_files_on_create, |
|
1
by brian
clean slate |
3627 |
0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, |
3628 |
{"key_buffer_size", OPT_KEY_BUFFER_SIZE, |
|
3629 |
"The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford; 64M on a 256M machine that mainly runs MySQL is quite common.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3630 |
(char**) &dflt_key_cache_var.param_buff_size, |
3631 |
(char**) 0, |
|
1
by brian
clean slate |
3632 |
0, (GET_ULL | GET_ASK_ADDR), |
3633 |
REQUIRED_ARG, KEY_CACHE_SIZE, MALLOC_OVERHEAD, SIZE_T_MAX, MALLOC_OVERHEAD, |
|
3634 |
IO_SIZE, 0}, |
|
3635 |
{"key_cache_age_threshold", OPT_KEY_CACHE_AGE_THRESHOLD, |
|
3636 |
"This characterizes the number of hits a hot block has to be untouched until it is considered aged enough to be downgraded to a warm block. This specifies the percentage ratio of that number of hits to the total number of blocks in key cache", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3637 |
(char**) &dflt_key_cache_var.param_age_threshold, |
3638 |
(char**) 0, |
|
1
by brian
clean slate |
3639 |
0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG, |
3640 |
300, 100, ULONG_MAX, 0, 100, 0}, |
|
3641 |
{"key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE, |
|
3642 |
"The default size of key cache blocks", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3643 |
(char**) &dflt_key_cache_var.param_block_size, |
3644 |
(char**) 0, |
|
1
by brian
clean slate |
3645 |
0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG, |
3646 |
KEY_CACHE_BLOCK_SIZE, 512, 1024 * 16, 0, 512, 0}, |
|
3647 |
{"key_cache_division_limit", OPT_KEY_CACHE_DIVISION_LIMIT, |
|
3648 |
"The minimum percentage of warm blocks in key cache", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3649 |
(char**) &dflt_key_cache_var.param_division_limit, |
3650 |
(char**) 0, |
|
1
by brian
clean slate |
3651 |
0, (GET_ULONG | GET_ASK_ADDR) , REQUIRED_ARG, 100, |
3652 |
1, 100, 0, 1, 0}, |
|
3653 |
{"long_query_time", OPT_LONG_QUERY_TIME, |
|
3654 |
"Log all queries that have taken more than long_query_time seconds to execute to file. "
|
|
3655 |
"The argument will be treated as a decimal value with microsecond precission.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3656 |
(char**) &long_query_time, (char**) &long_query_time, 0, GET_DOUBLE, |
1
by brian
clean slate |
3657 |
REQUIRED_ARG, 10, 0, LONG_TIMEOUT, 0, 0, 0}, |
3658 |
{"lower_case_table_names", OPT_LOWER_CASE_TABLE_NAMES, |
|
3659 |
"If set to 1 table names are stored in lowercase on disk and table names will be case-insensitive. Should be set to 2 if you are using a case insensitive file system", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3660 |
(char**) &lower_case_table_names, |
3661 |
(char**) &lower_case_table_names, 0, GET_UINT, OPT_ARG, |
|
1
by brian
clean slate |
3662 |
#ifdef FN_NO_CASE_SENCE
|
3663 |
1
|
|
3664 |
#else
|
|
3665 |
0
|
|
3666 |
#endif
|
|
3667 |
, 0, 2, 0, 1, 0}, |
|
3668 |
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, |
|
3669 |
"Max packetlength to send/receive from to server.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3670 |
(char**) &global_system_variables.max_allowed_packet, |
3671 |
(char**) &max_system_variables.max_allowed_packet, 0, GET_ULONG, |
|
1
by brian
clean slate |
3672 |
REQUIRED_ARG, 1024*1024L, 1024, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0}, |
3673 |
{"max_binlog_cache_size", OPT_MAX_BINLOG_CACHE_SIZE, |
|
3674 |
"Can be used to restrict the total size used to cache a multi-transaction query.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3675 |
(char**) &max_binlog_cache_size, (char**) &max_binlog_cache_size, 0, |
1
by brian
clean slate |
3676 |
GET_ULONG, REQUIRED_ARG, ULONG_MAX, IO_SIZE, ULONG_MAX, 0, IO_SIZE, 0}, |
3677 |
{"max_binlog_size", OPT_MAX_BINLOG_SIZE, |
|
3678 |
"Binary log will be rotated automatically when the size exceeds this \
|
|
3679 |
value. Will also apply to relay logs if max_relay_log_size is 0. \
|
|
3680 |
The minimum value for this variable is 4096.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3681 |
(char**) &max_binlog_size, (char**) &max_binlog_size, 0, GET_ULONG, |
1
by brian
clean slate |
3682 |
REQUIRED_ARG, 1024*1024L*1024L, IO_SIZE, 1024*1024L*1024L, 0, IO_SIZE, 0}, |
3683 |
{"max_connect_errors", OPT_MAX_CONNECT_ERRORS, |
|
3684 |
"If there is more than this number of interrupted connections from a host this host will be blocked from further connections.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3685 |
(char**) &max_connect_errors, (char**) &max_connect_errors, 0, GET_ULONG, |
1
by brian
clean slate |
3686 |
REQUIRED_ARG, MAX_CONNECT_ERRORS, 1, ULONG_MAX, 0, 1, 0}, |
3687 |
// Default max_connections of 151 is larger than Apache's default max
|
|
3688 |
// children, to avoid "too many connections" error in a common setup
|
|
3689 |
{"max_connections", OPT_MAX_CONNECTIONS, |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3690 |
"The number of simultaneous clients allowed.", (char**) &max_connections, |
3691 |
(char**) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 151, 1, 100000, 0, 1, |
|
1
by brian
clean slate |
3692 |
0}, |
3693 |
{"max_error_count", OPT_MAX_ERROR_COUNT, |
|
3694 |
"Max number of errors/warnings to store for a statement.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3695 |
(char**) &global_system_variables.max_error_count, |
3696 |
(char**) &max_system_variables.max_error_count, |
|
1
by brian
clean slate |
3697 |
0, GET_ULONG, REQUIRED_ARG, DEFAULT_ERROR_COUNT, 0, 65535, 0, 1, 0}, |
3698 |
{"max_heap_table_size", OPT_MAX_HEP_TABLE_SIZE, |
|
3699 |
"Don't allow creation of heap tables bigger than this.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3700 |
(char**) &global_system_variables.max_heap_table_size, |
3701 |
(char**) &max_system_variables.max_heap_table_size, 0, GET_ULL, |
|
1
by brian
clean slate |
3702 |
REQUIRED_ARG, 16*1024*1024L, 16384, MAX_MEM_TABLE_SIZE, |
3703 |
MALLOC_OVERHEAD, 1024, 0}, |
|
3704 |
{"max_join_size", OPT_MAX_JOIN_SIZE, |
|
3705 |
"Joins that are probably going to read more than max_join_size records return an error.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3706 |
(char**) &global_system_variables.max_join_size, |
3707 |
(char**) &max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG, |
|
1
by brian
clean slate |
3708 |
~0L, 1, ~0L, 0, 1, 0}, |
3709 |
{"max_length_for_sort_data", OPT_MAX_LENGTH_FOR_SORT_DATA, |
|
3710 |
"Max number of bytes in sorted records.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3711 |
(char**) &global_system_variables.max_length_for_sort_data, |
3712 |
(char**) &max_system_variables.max_length_for_sort_data, 0, GET_ULONG, |
|
1
by brian
clean slate |
3713 |
REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0}, |
3714 |
{"max_relay_log_size", OPT_MAX_RELAY_LOG_SIZE, |
|
3715 |
"If non-zero: relay log will be rotated automatically when the size exceeds this value; if zero (the default): when the size exceeds max_binlog_size. 0 excepted, the minimum value for this variable is 4096.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3716 |
(char**) &max_relay_log_size, (char**) &max_relay_log_size, 0, GET_ULONG, |
1
by brian
clean slate |
3717 |
REQUIRED_ARG, 0L, 0L, 1024*1024L*1024L, 0, IO_SIZE, 0}, |
3718 |
{ "max_seeks_for_key", OPT_MAX_SEEKS_FOR_KEY, |
|
3719 |
"Limit assumed max number of seeks when looking up rows based on a key", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3720 |
(char**) &global_system_variables.max_seeks_for_key, |
3721 |
(char**) &max_system_variables.max_seeks_for_key, 0, GET_ULONG, |
|
1
by brian
clean slate |
3722 |
REQUIRED_ARG, ULONG_MAX, 1, ULONG_MAX, 0, 1, 0 }, |
3723 |
{"max_sort_length", OPT_MAX_SORT_LENGTH, |
|
3724 |
"The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored).", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3725 |
(char**) &global_system_variables.max_sort_length, |
3726 |
(char**) &max_system_variables.max_sort_length, 0, GET_ULONG, |
|
1
by brian
clean slate |
3727 |
REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0}, |
3728 |
{"max_tmp_tables", OPT_MAX_TMP_TABLES, |
|
3729 |
"Maximum number of temporary tables a client can keep open at a time.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3730 |
(char**) &global_system_variables.max_tmp_tables, |
3731 |
(char**) &max_system_variables.max_tmp_tables, 0, GET_ULONG, |
|
1
by brian
clean slate |
3732 |
REQUIRED_ARG, 32, 1, ULONG_MAX, 0, 1, 0}, |
3733 |
{"max_write_lock_count", OPT_MAX_WRITE_LOCK_COUNT, |
|
3734 |
"After this many write locks, allow some read locks to run in between.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3735 |
(char**) &max_write_lock_count, (char**) &max_write_lock_count, 0, GET_ULONG, |
1
by brian
clean slate |
3736 |
REQUIRED_ARG, ULONG_MAX, 1, ULONG_MAX, 0, 1, 0}, |
3737 |
{"min_examined_row_limit", OPT_MIN_EXAMINED_ROW_LIMIT, |
|
3738 |
"Don't log queries which examine less than min_examined_row_limit rows to file.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3739 |
(char**) &global_system_variables.min_examined_row_limit, |
3740 |
(char**) &max_system_variables.min_examined_row_limit, 0, GET_ULONG, |
|
1
by brian
clean slate |
3741 |
REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1L, 0}, |
3742 |
{"myisam_block_size", OPT_MYISAM_BLOCK_SIZE, |
|
3743 |
"Block size to be used for MyISAM index pages.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3744 |
(char**) &opt_myisam_block_size, |
3745 |
(char**) &opt_myisam_block_size, 0, GET_ULONG, REQUIRED_ARG, |
|
1
by brian
clean slate |
3746 |
MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH, MI_MAX_KEY_BLOCK_LENGTH, |
3747 |
0, MI_MIN_KEY_BLOCK_LENGTH, 0}, |
|
3748 |
{"myisam_data_pointer_size", OPT_MYISAM_DATA_POINTER_SIZE, |
|
3749 |
"Default pointer size to be used for MyISAM tables.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3750 |
(char**) &myisam_data_pointer_size, |
3751 |
(char**) &myisam_data_pointer_size, 0, GET_ULONG, REQUIRED_ARG, |
|
1
by brian
clean slate |
3752 |
6, 2, 7, 0, 1, 0}, |
3753 |
{"myisam_max_extra_sort_file_size", OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE, |
|
3754 |
"Deprecated option", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3755 |
(char**) &global_system_variables.myisam_max_extra_sort_file_size, |
3756 |
(char**) &max_system_variables.myisam_max_extra_sort_file_size, |
|
151
by Brian Aker
Ulonglong to uint64_t |
3757 |
0, GET_ULL, REQUIRED_ARG, (uint64_t) MI_MAX_TEMP_LENGTH, |
3758 |
0, (uint64_t) MAX_FILE_SIZE, 0, 1, 0}, |
|
1
by brian
clean slate |
3759 |
{"myisam_max_sort_file_size", OPT_MYISAM_MAX_SORT_FILE_SIZE, |
3760 |
"Don't use the fast sort index method to created index if the temporary file would get bigger than this.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3761 |
(char**) &global_system_variables.myisam_max_sort_file_size, |
3762 |
(char**) &max_system_variables.myisam_max_sort_file_size, 0, |
|
152
by Brian Aker
longlong replacement |
3763 |
GET_ULL, REQUIRED_ARG, (int64_t) LONG_MAX, 0, (uint64_t) MAX_FILE_SIZE, |
1
by brian
clean slate |
3764 |
0, 1024*1024, 0}, |
3765 |
{"myisam_repair_threads", OPT_MYISAM_REPAIR_THREADS, |
|
3766 |
"Number of threads to use when repairing MyISAM tables. The value of 1 disables parallel repair.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3767 |
(char**) &global_system_variables.myisam_repair_threads, |
3768 |
(char**) &max_system_variables.myisam_repair_threads, 0, |
|
1
by brian
clean slate |
3769 |
GET_ULONG, REQUIRED_ARG, 1, 1, ULONG_MAX, 0, 1, 0}, |
3770 |
{"myisam_sort_buffer_size", OPT_MYISAM_SORT_BUFFER_SIZE, |
|
3771 |
"The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3772 |
(char**) &global_system_variables.myisam_sort_buff_size, |
3773 |
(char**) &max_system_variables.myisam_sort_buff_size, 0, |
|
1
by brian
clean slate |
3774 |
GET_ULONG, REQUIRED_ARG, 8192*1024, 4, ~0L, 0, 1, 0}, |
3775 |
{"myisam_stats_method", OPT_MYISAM_STATS_METHOD, |
|
3776 |
"Specifies how MyISAM index statistics collection code should threat NULLs. "
|
|
3777 |
"Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), " |
|
3778 |
"\"nulls_equal\" (emulate 4.0 behavior), and \"nulls_ignored\".", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3779 |
(char**) &myisam_stats_method_str, (char**) &myisam_stats_method_str, 0, |
1
by brian
clean slate |
3780 |
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3781 |
{"net_buffer_length", OPT_NET_BUFFER_LENGTH, |
|
3782 |
"Buffer length for TCP/IP and socket communication.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3783 |
(char**) &global_system_variables.net_buffer_length, |
3784 |
(char**) &max_system_variables.net_buffer_length, 0, GET_ULONG, |
|
1
by brian
clean slate |
3785 |
REQUIRED_ARG, 16384, 1024, 1024*1024L, 0, 1024, 0}, |
3786 |
{"net_read_timeout", OPT_NET_READ_TIMEOUT, |
|
3787 |
"Number of seconds to wait for more data from a connection before aborting the read.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3788 |
(char**) &global_system_variables.net_read_timeout, |
3789 |
(char**) &max_system_variables.net_read_timeout, 0, GET_ULONG, |
|
1
by brian
clean slate |
3790 |
REQUIRED_ARG, NET_READ_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, |
3791 |
{"net_retry_count", OPT_NET_RETRY_COUNT, |
|
3792 |
"If a read on a communication port is interrupted, retry this many times before giving up.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3793 |
(char**) &global_system_variables.net_retry_count, |
3794 |
(char**) &max_system_variables.net_retry_count,0, |
|
1
by brian
clean slate |
3795 |
GET_ULONG, REQUIRED_ARG, MYSQLD_NET_RETRY_COUNT, 1, ULONG_MAX, 0, 1, 0}, |
3796 |
{"net_write_timeout", OPT_NET_WRITE_TIMEOUT, |
|
3797 |
"Number of seconds to wait for a block to be written to a connection before aborting the write.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3798 |
(char**) &global_system_variables.net_write_timeout, |
3799 |
(char**) &max_system_variables.net_write_timeout, 0, GET_ULONG, |
|
1
by brian
clean slate |
3800 |
REQUIRED_ARG, NET_WRITE_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, |
3801 |
{ "old", OPT_OLD_MODE, "Use compatible behavior.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3802 |
(char**) &global_system_variables.old_mode, |
3803 |
(char**) &max_system_variables.old_mode, 0, GET_BOOL, NO_ARG, |
|
1
by brian
clean slate |
3804 |
0, 0, 0, 0, 0, 0}, |
3805 |
{"open_files_limit", OPT_OPEN_FILES_LIMIT, |
|
3806 |
"If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of files.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3807 |
(char**) &open_files_limit, (char**) &open_files_limit, 0, GET_ULONG, |
1
by brian
clean slate |
3808 |
REQUIRED_ARG, 0, 0, OS_FILE_LIMIT, 0, 1, 0}, |
3809 |
{"optimizer_prune_level", OPT_OPTIMIZER_PRUNE_LEVEL, |
|
3810 |
"Controls the heuristic(s) applied during query optimization to prune less-promising partial plans from the optimizer search space. Meaning: 0 - do not apply any heuristic, thus perform exhaustive search; 1 - prune plans based on number of retrieved rows.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3811 |
(char**) &global_system_variables.optimizer_prune_level, |
3812 |
(char**) &max_system_variables.optimizer_prune_level, |
|
1
by brian
clean slate |
3813 |
0, GET_ULONG, OPT_ARG, 1, 0, 1, 0, 1, 0}, |
3814 |
{"optimizer_search_depth", OPT_OPTIMIZER_SEARCH_DEPTH, |
|
3815 |
"Maximum depth of search performed by the query optimizer. Values larger than the number of relations in a query result in better query plans, but take longer to compile a query. Smaller values than the number of tables in a relation result in faster optimization, but may produce very bad query plans. If set to 0, the system will automatically pick a reasonable value; if set to MAX_TABLES+2, the optimizer will switch to the original find_best (used for testing/comparison).", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3816 |
(char**) &global_system_variables.optimizer_search_depth, |
3817 |
(char**) &max_system_variables.optimizer_search_depth, |
|
1
by brian
clean slate |
3818 |
0, GET_ULONG, OPT_ARG, MAX_TABLES+1, 0, MAX_TABLES+2, 0, 1, 0}, |
3819 |
{"plugin_dir", OPT_PLUGIN_DIR, |
|
3820 |
"Directory for plugins.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3821 |
(char**) &opt_plugin_dir_ptr, (char**) &opt_plugin_dir_ptr, 0, |
1
by brian
clean slate |
3822 |
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3823 |
{"plugin_load", OPT_PLUGIN_LOAD, |
|
3824 |
"Optional colon separated list of plugins to load, where each plugin is "
|
|
3825 |
"identified by name and path to library seperated by an equals.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3826 |
(char**) &opt_plugin_load, (char**) &opt_plugin_load, 0, |
1
by brian
clean slate |
3827 |
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3828 |
{"preload_buffer_size", OPT_PRELOAD_BUFFER_SIZE, |
|
3829 |
"The size of the buffer that is allocated when preloading indexes", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3830 |
(char**) &global_system_variables.preload_buff_size, |
3831 |
(char**) &max_system_variables.preload_buff_size, 0, GET_ULONG, |
|
1
by brian
clean slate |
3832 |
REQUIRED_ARG, 32*1024L, 1024, 1024*1024*1024L, 0, 1, 0}, |
3833 |
{"query_alloc_block_size", OPT_QUERY_ALLOC_BLOCK_SIZE, |
|
3834 |
"Allocation block size for query parsing and execution", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3835 |
(char**) &global_system_variables.query_alloc_block_size, |
3836 |
(char**) &max_system_variables.query_alloc_block_size, 0, GET_ULONG, |
|
1
by brian
clean slate |
3837 |
REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ULONG_MAX, 0, 1024, 0}, |
3838 |
{"query_prealloc_size", OPT_QUERY_PREALLOC_SIZE, |
|
3839 |
"Persistent buffer for query parsing and execution", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3840 |
(char**) &global_system_variables.query_prealloc_size, |
3841 |
(char**) &max_system_variables.query_prealloc_size, 0, GET_ULONG, |
|
1
by brian
clean slate |
3842 |
REQUIRED_ARG, QUERY_ALLOC_PREALLOC_SIZE, QUERY_ALLOC_PREALLOC_SIZE, |
3843 |
ULONG_MAX, 0, 1024, 0}, |
|
3844 |
{"range_alloc_block_size", OPT_RANGE_ALLOC_BLOCK_SIZE, |
|
3845 |
"Allocation block size for storing ranges during optimization", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3846 |
(char**) &global_system_variables.range_alloc_block_size, |
3847 |
(char**) &max_system_variables.range_alloc_block_size, 0, GET_ULONG, |
|
1
by brian
clean slate |
3848 |
REQUIRED_ARG, RANGE_ALLOC_BLOCK_SIZE, RANGE_ALLOC_BLOCK_SIZE, ULONG_MAX, |
3849 |
0, 1024, 0}, |
|
3850 |
{"read_buffer_size", OPT_RECORD_BUFFER, |
|
3851 |
"Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3852 |
(char**) &global_system_variables.read_buff_size, |
3853 |
(char**) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG, |
|
163
by Brian Aker
Merge Monty's code. |
3854 |
128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, INT32_MAX, MALLOC_OVERHEAD, IO_SIZE, |
1
by brian
clean slate |
3855 |
0}, |
3856 |
{"read_only", OPT_READONLY, |
|
3857 |
"Make all non-temporary tables read-only, with the exception for replication (slave) threads and users with the SUPER privilege", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3858 |
(char**) &opt_readonly, |
3859 |
(char**) &opt_readonly, |
|
1
by brian
clean slate |
3860 |
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0}, |
3861 |
{"read_rnd_buffer_size", OPT_RECORD_RND_BUFFER, |
|
3862 |
"When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks. If not set, then it's set to the value of record_buffer.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3863 |
(char**) &global_system_variables.read_rnd_buff_size, |
3864 |
(char**) &max_system_variables.read_rnd_buff_size, 0, |
|
1
by brian
clean slate |
3865 |
GET_ULONG, REQUIRED_ARG, 256*1024L, 64 /*IO_SIZE*2+MALLOC_OVERHEAD*/ , |
163
by Brian Aker
Merge Monty's code. |
3866 |
INT32_MAX, MALLOC_OVERHEAD, 1 /* Small lower limit to be able to test MRR */, 0}, |
1
by brian
clean slate |
3867 |
{"record_buffer", OPT_RECORD_BUFFER, |
3868 |
"Alias for read_buffer_size", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3869 |
(char**) &global_system_variables.read_buff_size, |
3870 |
(char**) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG, |
|
163
by Brian Aker
Merge Monty's code. |
3871 |
128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, INT32_MAX, MALLOC_OVERHEAD, IO_SIZE, 0}, |
1
by brian
clean slate |
3872 |
{"relay_log_purge", OPT_RELAY_LOG_PURGE, |
3873 |
"0 = do not purge relay logs. 1 = purge them as soon as they are no more needed.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3874 |
(char**) &relay_log_purge, |
3875 |
(char**) &relay_log_purge, 0, GET_BOOL, NO_ARG, |
|
1
by brian
clean slate |
3876 |
1, 0, 1, 0, 1, 0}, |
3877 |
{"relay_log_space_limit", OPT_RELAY_LOG_SPACE_LIMIT, |
|
3878 |
"Maximum space to use for all relay logs.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3879 |
(char**) &relay_log_space_limit, |
3880 |
(char**) &relay_log_space_limit, 0, GET_ULL, REQUIRED_ARG, 0L, 0L, |
|
152
by Brian Aker
longlong replacement |
3881 |
(int64_t) ULONG_MAX, 0, 1, 0}, |
1
by brian
clean slate |
3882 |
{"slave_compressed_protocol", OPT_SLAVE_COMPRESSED_PROTOCOL, |
3883 |
"Use compression on master/slave protocol.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3884 |
(char**) &opt_slave_compressed_protocol, |
3885 |
(char**) &opt_slave_compressed_protocol, |
|
1
by brian
clean slate |
3886 |
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0}, |
3887 |
{"slave_net_timeout", OPT_SLAVE_NET_TIMEOUT, |
|
3888 |
"Number of seconds to wait for more data from a master/slave connection before aborting the read.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3889 |
(char**) &slave_net_timeout, (char**) &slave_net_timeout, 0, |
1
by brian
clean slate |
3890 |
GET_ULONG, REQUIRED_ARG, SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, |
3891 |
{"slave_transaction_retries", OPT_SLAVE_TRANS_RETRIES, |
|
3892 |
"Number of times the slave SQL thread will retry a transaction in case "
|
|
3893 |
"it failed with a deadlock or elapsed lock wait timeout, "
|
|
3894 |
"before giving up and stopping.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3895 |
(char**) &slave_trans_retries, (char**) &slave_trans_retries, 0, |
152
by Brian Aker
longlong replacement |
3896 |
GET_ULONG, REQUIRED_ARG, 10L, 0L, (int64_t) ULONG_MAX, 0, 1, 0}, |
1
by brian
clean slate |
3897 |
{"slave-allow-batching", OPT_SLAVE_ALLOW_BATCHING, |
3898 |
"Allow slave to batch requests.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3899 |
(char**) &slave_allow_batching, (char**) &slave_allow_batching, |
1
by brian
clean slate |
3900 |
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0}, |
3901 |
{"slow_launch_time", OPT_SLOW_LAUNCH_TIME, |
|
3902 |
"If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3903 |
(char**) &slow_launch_time, (char**) &slow_launch_time, 0, GET_ULONG, |
1
by brian
clean slate |
3904 |
REQUIRED_ARG, 2L, 0L, LONG_TIMEOUT, 0, 1, 0}, |
3905 |
{"sort_buffer_size", OPT_SORT_BUFFER, |
|
3906 |
"Each thread that needs to do a sort allocates a buffer of this size.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3907 |
(char**) &global_system_variables.sortbuff_size, |
3908 |
(char**) &max_system_variables.sortbuff_size, 0, GET_ULONG, REQUIRED_ARG, |
|
1
by brian
clean slate |
3909 |
MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*2, ULONG_MAX, |
3910 |
MALLOC_OVERHEAD, 1, 0}, |
|
3911 |
{"sync-binlog", OPT_SYNC_BINLOG, |
|
3912 |
"Synchronously flush binary log to disk after every #th event. "
|
|
3913 |
"Use 0 (default) to disable synchronous flushing.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3914 |
(char**) &sync_binlog_period, (char**) &sync_binlog_period, 0, GET_ULONG, |
1
by brian
clean slate |
3915 |
REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1, 0}, |
3916 |
{"sync-frm", OPT_SYNC_FRM, "Sync .frm to disk on create. Enabled by default.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3917 |
(char**) &opt_sync_frm, (char**) &opt_sync_frm, 0, GET_BOOL, NO_ARG, 1, 0, |
1
by brian
clean slate |
3918 |
0, 0, 0, 0}, |
3919 |
{"table_cache", OPT_TABLE_OPEN_CACHE, |
|
3920 |
"Deprecated; use --table_open_cache instead.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3921 |
(char**) &table_cache_size, (char**) &table_cache_size, 0, GET_ULONG, |
1
by brian
clean slate |
3922 |
REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0}, |
3923 |
{"table_definition_cache", OPT_TABLE_DEF_CACHE, |
|
3924 |
"The number of cached table definitions.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3925 |
(char**) &table_def_size, (char**) &table_def_size, |
1
by brian
clean slate |
3926 |
0, GET_ULONG, REQUIRED_ARG, 128, 1, 512*1024L, 0, 1, 0}, |
3927 |
{"table_open_cache", OPT_TABLE_OPEN_CACHE, |
|
3928 |
"The number of cached open tables.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3929 |
(char**) &table_cache_size, (char**) &table_cache_size, 0, GET_ULONG, |
1
by brian
clean slate |
3930 |
REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0}, |
3931 |
{"table_lock_wait_timeout", OPT_TABLE_LOCK_WAIT_TIMEOUT, |
|
3932 |
"Timeout in seconds to wait for a table level lock before returning an "
|
|
3933 |
"error. Used only if the connection has active cursors.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3934 |
(char**) &table_lock_wait_timeout, (char**) &table_lock_wait_timeout, |
1
by brian
clean slate |
3935 |
0, GET_ULONG, REQUIRED_ARG, 50, 1, 1024 * 1024 * 1024, 0, 1, 0}, |
3936 |
{"thread_cache_size", OPT_THREAD_CACHE_SIZE, |
|
3937 |
"How many threads we should keep in a cache for reuse.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3938 |
(char**) &thread_cache_size, (char**) &thread_cache_size, 0, GET_ULONG, |
1
by brian
clean slate |
3939 |
REQUIRED_ARG, 0, 0, 16384, 0, 1, 0}, |
3940 |
{"thread_pool_size", OPT_THREAD_CACHE_SIZE, |
|
3941 |
"How many threads we should create to handle query requests in case of 'thread_handling=pool-of-threads'", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3942 |
(char**) &thread_pool_size, (char**) &thread_pool_size, 0, GET_ULONG, |
1
by brian
clean slate |
3943 |
REQUIRED_ARG, 20, 1, 16384, 0, 1, 0}, |
3944 |
{"thread_stack", OPT_THREAD_STACK, |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3945 |
"The stack size for each thread.", (char**) &my_thread_stack_size, |
3946 |
(char**) &my_thread_stack_size, 0, GET_ULONG, REQUIRED_ARG,DEFAULT_THREAD_STACK, |
|
1
by brian
clean slate |
3947 |
1024L*128L, ULONG_MAX, 0, 1024, 0}, |
3948 |
{ "time_format", OPT_TIME_FORMAT, |
|
3949 |
"The TIME format (for future).", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3950 |
(char**) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME], |
3951 |
(char**) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME], |
|
1
by brian
clean slate |
3952 |
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
3953 |
{"tmp_table_size", OPT_TMP_TABLE_SIZE, |
|
3954 |
"If an internal in-memory temporary table exceeds this size, MySQL will"
|
|
3955 |
" automatically convert it to an on-disk MyISAM table.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3956 |
(char**) &global_system_variables.tmp_table_size, |
3957 |
(char**) &max_system_variables.tmp_table_size, 0, GET_ULL, |
|
1
by brian
clean slate |
3958 |
REQUIRED_ARG, 16*1024*1024L, 1024, MAX_MEM_TABLE_SIZE, 0, 1, 0}, |
3959 |
{"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE, |
|
3960 |
"Allocation block size for transactions to be stored in binary log", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3961 |
(char**) &global_system_variables.trans_alloc_block_size, |
3962 |
(char**) &max_system_variables.trans_alloc_block_size, 0, GET_ULONG, |
|
1
by brian
clean slate |
3963 |
REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ULONG_MAX, 0, 1024, 0}, |
3964 |
{"transaction_prealloc_size", OPT_TRANS_PREALLOC_SIZE, |
|
3965 |
"Persistent buffer for transactions to be stored in binary log", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3966 |
(char**) &global_system_variables.trans_prealloc_size, |
3967 |
(char**) &max_system_variables.trans_prealloc_size, 0, GET_ULONG, |
|
1
by brian
clean slate |
3968 |
REQUIRED_ARG, TRANS_ALLOC_PREALLOC_SIZE, 1024, ULONG_MAX, 0, 1024, 0}, |
3969 |
{"wait_timeout", OPT_WAIT_TIMEOUT, |
|
3970 |
"The number of seconds the server waits for activity on a connection before closing it.", |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
3971 |
(char**) &global_system_variables.net_wait_timeout, |
3972 |
(char**) &max_system_variables.net_wait_timeout, 0, GET_ULONG, |
|
163
by Brian Aker
Merge Monty's code. |
3973 |
REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, IF_WIN(INT32_MAX/1000, LONG_TIMEOUT), |
1
by brian
clean slate |
3974 |
0, 1, 0}, |
3975 |
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} |
|
3976 |
};
|
|
3977 |
||
77.1.45
by Monty Taylor
Warning fixes. |
3978 |
static int show_net_compression(THD *thd __attribute__((__unused__)), |
3979 |
SHOW_VAR *var, |
|
3980 |
char *buff __attribute__((__unused__))) |
|
1
by brian
clean slate |
3981 |
{
|
3982 |
var->type= SHOW_MY_BOOL; |
|
3983 |
var->value= (char *)&thd->net.compress; |
|
3984 |
return 0; |
|
3985 |
}
|
|
3986 |
||
77.1.45
by Monty Taylor
Warning fixes. |
3987 |
static st_show_var_func_container |
3988 |
show_net_compression_cont= { &show_net_compression }; |
|
3989 |
||
1
by brian
clean slate |
3990 |
static int show_starttime(THD *thd, SHOW_VAR *var, char *buff) |
3991 |
{
|
|
3992 |
var->type= SHOW_LONG; |
|
3993 |
var->value= buff; |
|
3994 |
*((long *)buff)= (long) (thd->query_start() - server_start_time); |
|
3995 |
return 0; |
|
3996 |
}
|
|
3997 |
||
77.1.45
by Monty Taylor
Warning fixes. |
3998 |
static st_show_var_func_container |
3999 |
show_starttime_cont= { &show_starttime }; |
|
4000 |
||
1
by brian
clean slate |
4001 |
static int show_flushstatustime(THD *thd, SHOW_VAR *var, char *buff) |
4002 |
{
|
|
4003 |
var->type= SHOW_LONG; |
|
4004 |
var->value= buff; |
|
4005 |
*((long *)buff)= (long) (thd->query_start() - flush_status_time); |
|
4006 |
return 0; |
|
4007 |
}
|
|
4008 |
||
77.1.45
by Monty Taylor
Warning fixes. |
4009 |
static st_show_var_func_container |
4010 |
show_flushstatustime_cont= { &show_flushstatustime }; |
|
4011 |
||
4012 |
static int show_slave_running(THD *thd __attribute__((__unused__)), |
|
4013 |
SHOW_VAR *var, char *buff) |
|
1
by brian
clean slate |
4014 |
{
|
4015 |
var->type= SHOW_MY_BOOL; |
|
4016 |
pthread_mutex_lock(&LOCK_active_mi); |
|
4017 |
var->value= buff; |
|
150
by Brian Aker
More bool removal. More cow bell! |
4018 |
*((bool *)buff)= (bool) (active_mi && active_mi->slave_running && |
1
by brian
clean slate |
4019 |
active_mi->rli.slave_running); |
4020 |
pthread_mutex_unlock(&LOCK_active_mi); |
|
4021 |
return 0; |
|
4022 |
}
|
|
4023 |
||
77.1.45
by Monty Taylor
Warning fixes. |
4024 |
static st_show_var_func_container |
4025 |
show_slave_running_cont= { &show_slave_running }; |
|
4026 |
||
4027 |
static int show_slave_retried_trans(THD *thd __attribute__((__unused__)), |
|
4028 |
SHOW_VAR *var, char *buff) |
|
1
by brian
clean slate |
4029 |
{
|
4030 |
/*
|
|
4031 |
TODO: with multimaster, have one such counter per line in
|
|
4032 |
SHOW SLAVE STATUS, and have the sum over all lines here.
|
|
4033 |
*/
|
|
4034 |
pthread_mutex_lock(&LOCK_active_mi); |
|
4035 |
if (active_mi) |
|
4036 |
{
|
|
4037 |
var->type= SHOW_LONG; |
|
4038 |
var->value= buff; |
|
4039 |
pthread_mutex_lock(&active_mi->rli.data_lock); |
|
4040 |
*((long *)buff)= (long)active_mi->rli.retried_trans; |
|
4041 |
pthread_mutex_unlock(&active_mi->rli.data_lock); |
|
4042 |
}
|
|
4043 |
else
|
|
4044 |
var->type= SHOW_UNDEF; |
|
4045 |
pthread_mutex_unlock(&LOCK_active_mi); |
|
4046 |
return 0; |
|
4047 |
}
|
|
4048 |
||
77.1.45
by Monty Taylor
Warning fixes. |
4049 |
static st_show_var_func_container |
4050 |
show_slave_retried_trans_cont= { &show_slave_retried_trans }; |
|
4051 |
||
4052 |
static int show_slave_received_heartbeats(THD *thd __attribute__((__unused__)), |
|
4053 |
SHOW_VAR *var, char *buff) |
|
1
by brian
clean slate |
4054 |
{
|
4055 |
pthread_mutex_lock(&LOCK_active_mi); |
|
4056 |
if (active_mi) |
|
4057 |
{
|
|
4058 |
var->type= SHOW_LONGLONG; |
|
4059 |
var->value= buff; |
|
4060 |
pthread_mutex_lock(&active_mi->rli.data_lock); |
|
152
by Brian Aker
longlong replacement |
4061 |
*((int64_t *)buff)= active_mi->received_heartbeats; |
1
by brian
clean slate |
4062 |
pthread_mutex_unlock(&active_mi->rli.data_lock); |
4063 |
}
|
|
4064 |
else
|
|
4065 |
var->type= SHOW_UNDEF; |
|
4066 |
pthread_mutex_unlock(&LOCK_active_mi); |
|
4067 |
return 0; |
|
4068 |
}
|
|
4069 |
||
77.1.45
by Monty Taylor
Warning fixes. |
4070 |
static st_show_var_func_container |
4071 |
show_slave_received_heartbeats_cont= { &show_slave_received_heartbeats }; |
|
4072 |
||
4073 |
static int show_heartbeat_period(THD *thd __attribute__((__unused__)), |
|
4074 |
SHOW_VAR *var, char *buff) |
|
1
by brian
clean slate |
4075 |
{
|
4076 |
pthread_mutex_lock(&LOCK_active_mi); |
|
4077 |
if (active_mi) |
|
4078 |
{
|
|
4079 |
var->type= SHOW_CHAR; |
|
4080 |
var->value= buff; |
|
171.1.1
by Patrick Galbraith
Dar, I forgot to commit this earlier. |
4081 |
sprintf(buff, "%.3f",active_mi->heartbeat_period); |
1
by brian
clean slate |
4082 |
}
|
4083 |
else
|
|
4084 |
var->type= SHOW_UNDEF; |
|
4085 |
pthread_mutex_unlock(&LOCK_active_mi); |
|
4086 |
return 0; |
|
4087 |
}
|
|
4088 |
||
77.1.45
by Monty Taylor
Warning fixes. |
4089 |
static st_show_var_func_container |
4090 |
show_heartbeat_period_cont= { &show_heartbeat_period}; |
|
1
by brian
clean slate |
4091 |
|
77.1.45
by Monty Taylor
Warning fixes. |
4092 |
static int show_open_tables(THD *thd __attribute__((__unused__)), |
4093 |
SHOW_VAR *var, char *buff) |
|
1
by brian
clean slate |
4094 |
{
|
4095 |
var->type= SHOW_LONG; |
|
4096 |
var->value= buff; |
|
4097 |
*((long *)buff)= (long)cached_open_tables(); |
|
4098 |
return 0; |
|
4099 |
}
|
|
4100 |
||
77.1.45
by Monty Taylor
Warning fixes. |
4101 |
static int show_table_definitions(THD *thd __attribute__((__unused__)), |
4102 |
SHOW_VAR *var, char *buff) |
|
1
by brian
clean slate |
4103 |
{
|
4104 |
var->type= SHOW_LONG; |
|
4105 |
var->value= buff; |
|
4106 |
*((long *)buff)= (long)cached_table_definitions(); |
|
4107 |
return 0; |
|
4108 |
}
|
|
4109 |
||
77.1.45
by Monty Taylor
Warning fixes. |
4110 |
static st_show_var_func_container |
4111 |
show_open_tables_cont= { &show_open_tables }; |
|
4112 |
static st_show_var_func_container |
|
4113 |
show_table_definitions_cont= { &show_table_definitions }; |
|
4114 |
||
1
by brian
clean slate |
4115 |
/*
|
4116 |
Variables shown by SHOW STATUS in alphabetical order
|
|
4117 |
*/
|
|
4118 |
||
4119 |
SHOW_VAR status_vars[]= { |
|
4120 |
{"Aborted_clients", (char*) &aborted_threads, SHOW_LONG}, |
|
4121 |
{"Aborted_connects", (char*) &aborted_connects, SHOW_LONG}, |
|
4122 |
{"Binlog_cache_disk_use", (char*) &binlog_cache_disk_use, SHOW_LONG}, |
|
4123 |
{"Binlog_cache_use", (char*) &binlog_cache_use, SHOW_LONG}, |
|
4124 |
{"Bytes_received", (char*) offsetof(STATUS_VAR, bytes_received), SHOW_LONGLONG_STATUS}, |
|
4125 |
{"Bytes_sent", (char*) offsetof(STATUS_VAR, bytes_sent), SHOW_LONGLONG_STATUS}, |
|
4126 |
{"Com", (char*) com_status_vars, SHOW_ARRAY}, |
|
77.1.45
by Monty Taylor
Warning fixes. |
4127 |
{"Compression", (char*) &show_net_compression_cont, SHOW_FUNC}, |
1
by brian
clean slate |
4128 |
{"Connections", (char*) &thread_id, SHOW_LONG_NOFLUSH}, |
4129 |
{"Created_tmp_disk_tables", (char*) offsetof(STATUS_VAR, created_tmp_disk_tables), SHOW_LONG_STATUS}, |
|
4130 |
{"Created_tmp_files", (char*) &my_tmp_file_created, SHOW_LONG}, |
|
4131 |
{"Created_tmp_tables", (char*) offsetof(STATUS_VAR, created_tmp_tables), SHOW_LONG_STATUS}, |
|
4132 |
{"Flush_commands", (char*) &refresh_version, SHOW_LONG_NOFLUSH}, |
|
4133 |
{"Handler_commit", (char*) offsetof(STATUS_VAR, ha_commit_count), SHOW_LONG_STATUS}, |
|
4134 |
{"Handler_delete", (char*) offsetof(STATUS_VAR, ha_delete_count), SHOW_LONG_STATUS}, |
|
4135 |
{"Handler_discover", (char*) offsetof(STATUS_VAR, ha_discover_count), SHOW_LONG_STATUS}, |
|
4136 |
{"Handler_prepare", (char*) offsetof(STATUS_VAR, ha_prepare_count), SHOW_LONG_STATUS}, |
|
4137 |
{"Handler_read_first", (char*) offsetof(STATUS_VAR, ha_read_first_count), SHOW_LONG_STATUS}, |
|
4138 |
{"Handler_read_key", (char*) offsetof(STATUS_VAR, ha_read_key_count), SHOW_LONG_STATUS}, |
|
4139 |
{"Handler_read_next", (char*) offsetof(STATUS_VAR, ha_read_next_count), SHOW_LONG_STATUS}, |
|
4140 |
{"Handler_read_prev", (char*) offsetof(STATUS_VAR, ha_read_prev_count), SHOW_LONG_STATUS}, |
|
4141 |
{"Handler_read_rnd", (char*) offsetof(STATUS_VAR, ha_read_rnd_count), SHOW_LONG_STATUS}, |
|
4142 |
{"Handler_read_rnd_next", (char*) offsetof(STATUS_VAR, ha_read_rnd_next_count), SHOW_LONG_STATUS}, |
|
4143 |
{"Handler_rollback", (char*) offsetof(STATUS_VAR, ha_rollback_count), SHOW_LONG_STATUS}, |
|
4144 |
{"Handler_savepoint", (char*) offsetof(STATUS_VAR, ha_savepoint_count), SHOW_LONG_STATUS}, |
|
4145 |
{"Handler_savepoint_rollback",(char*) offsetof(STATUS_VAR, ha_savepoint_rollback_count), SHOW_LONG_STATUS}, |
|
4146 |
{"Handler_update", (char*) offsetof(STATUS_VAR, ha_update_count), SHOW_LONG_STATUS}, |
|
4147 |
{"Handler_write", (char*) offsetof(STATUS_VAR, ha_write_count), SHOW_LONG_STATUS}, |
|
4148 |
{"Key_blocks_not_flushed", (char*) offsetof(KEY_CACHE, global_blocks_changed), SHOW_KEY_CACHE_LONG}, |
|
4149 |
{"Key_blocks_unused", (char*) offsetof(KEY_CACHE, blocks_unused), SHOW_KEY_CACHE_LONG}, |
|
4150 |
{"Key_blocks_used", (char*) offsetof(KEY_CACHE, blocks_used), SHOW_KEY_CACHE_LONG}, |
|
4151 |
{"Key_read_requests", (char*) offsetof(KEY_CACHE, global_cache_r_requests), SHOW_KEY_CACHE_LONGLONG}, |
|
4152 |
{"Key_reads", (char*) offsetof(KEY_CACHE, global_cache_read), SHOW_KEY_CACHE_LONGLONG}, |
|
4153 |
{"Key_write_requests", (char*) offsetof(KEY_CACHE, global_cache_w_requests), SHOW_KEY_CACHE_LONGLONG}, |
|
4154 |
{"Key_writes", (char*) offsetof(KEY_CACHE, global_cache_write), SHOW_KEY_CACHE_LONGLONG}, |
|
4155 |
{"Last_query_cost", (char*) offsetof(STATUS_VAR, last_query_cost), SHOW_DOUBLE_STATUS}, |
|
4156 |
{"Max_used_connections", (char*) &max_used_connections, SHOW_LONG}, |
|
4157 |
{"Open_files", (char*) &my_file_opened, SHOW_LONG_NOFLUSH}, |
|
4158 |
{"Open_streams", (char*) &my_stream_opened, SHOW_LONG_NOFLUSH}, |
|
77.1.45
by Monty Taylor
Warning fixes. |
4159 |
{"Open_table_definitions", (char*) &show_table_definitions_cont, SHOW_FUNC}, |
4160 |
{"Open_tables", (char*) &show_open_tables_cont, SHOW_FUNC}, |
|
1
by brian
clean slate |
4161 |
{"Opened_files", (char*) &my_file_total_opened, SHOW_LONG_NOFLUSH}, |
4162 |
{"Opened_tables", (char*) offsetof(STATUS_VAR, opened_tables), SHOW_LONG_STATUS}, |
|
4163 |
{"Opened_table_definitions", (char*) offsetof(STATUS_VAR, opened_shares), SHOW_LONG_STATUS}, |
|
4164 |
{"Questions", (char*) offsetof(STATUS_VAR, questions), SHOW_LONG_STATUS}, |
|
4165 |
{"Select_full_join", (char*) offsetof(STATUS_VAR, select_full_join_count), SHOW_LONG_STATUS}, |
|
4166 |
{"Select_full_range_join", (char*) offsetof(STATUS_VAR, select_full_range_join_count), SHOW_LONG_STATUS}, |
|
4167 |
{"Select_range", (char*) offsetof(STATUS_VAR, select_range_count), SHOW_LONG_STATUS}, |
|
4168 |
{"Select_range_check", (char*) offsetof(STATUS_VAR, select_range_check_count), SHOW_LONG_STATUS}, |
|
4169 |
{"Select_scan", (char*) offsetof(STATUS_VAR, select_scan_count), SHOW_LONG_STATUS}, |
|
4170 |
{"Slave_open_temp_tables", (char*) &slave_open_temp_tables, SHOW_LONG}, |
|
77.1.45
by Monty Taylor
Warning fixes. |
4171 |
{"Slave_retried_transactions",(char*) &show_slave_retried_trans_cont, SHOW_FUNC}, |
4172 |
{"Slave_heartbeat_period", (char*) &show_heartbeat_period_cont, SHOW_FUNC}, |
|
4173 |
{"Slave_received_heartbeats",(char*) &show_slave_received_heartbeats_cont, SHOW_FUNC}, |
|
4174 |
{"Slave_running", (char*) &show_slave_running_cont, SHOW_FUNC}, |
|
1
by brian
clean slate |
4175 |
{"Slow_launch_threads", (char*) &slow_launch_threads, SHOW_LONG}, |
4176 |
{"Slow_queries", (char*) offsetof(STATUS_VAR, long_query_count), SHOW_LONG_STATUS}, |
|
4177 |
{"Sort_merge_passes", (char*) offsetof(STATUS_VAR, filesort_merge_passes), SHOW_LONG_STATUS}, |
|
4178 |
{"Sort_range", (char*) offsetof(STATUS_VAR, filesort_range_count), SHOW_LONG_STATUS}, |
|
4179 |
{"Sort_rows", (char*) offsetof(STATUS_VAR, filesort_rows), SHOW_LONG_STATUS}, |
|
4180 |
{"Sort_scan", (char*) offsetof(STATUS_VAR, filesort_scan_count), SHOW_LONG_STATUS}, |
|
4181 |
{"Table_locks_immediate", (char*) &locks_immediate, SHOW_LONG}, |
|
4182 |
{"Table_locks_waited", (char*) &locks_waited, SHOW_LONG}, |
|
4183 |
#ifdef HAVE_MMAP
|
|
4184 |
{"Tc_log_max_pages_used", (char*) &tc_log_max_pages_used, SHOW_LONG}, |
|
4185 |
{"Tc_log_page_size", (char*) &tc_log_page_size, SHOW_LONG}, |
|
4186 |
{"Tc_log_page_waits", (char*) &tc_log_page_waits, SHOW_LONG}, |
|
4187 |
#endif
|
|
4188 |
{"Threads_cached", (char*) &cached_thread_count, SHOW_LONG_NOFLUSH}, |
|
4189 |
{"Threads_connected", (char*) &connection_count, SHOW_INT}, |
|
4190 |
{"Threads_created", (char*) &thread_created, SHOW_LONG_NOFLUSH}, |
|
4191 |
{"Threads_running", (char*) &thread_running, SHOW_INT}, |
|
77.1.45
by Monty Taylor
Warning fixes. |
4192 |
{"Uptime", (char*) &show_starttime_cont, SHOW_FUNC}, |
4193 |
{"Uptime_since_flush_status",(char*) &show_flushstatustime_cont, SHOW_FUNC}, |
|
1
by brian
clean slate |
4194 |
{NullS, NullS, SHOW_LONG} |
4195 |
};
|
|
4196 |
||
4197 |
static void print_version(void) |
|
4198 |
{
|
|
4199 |
set_server_version(); |
|
4200 |
/*
|
|
4201 |
Note: the instance manager keys off the string 'Ver' so it can find the
|
|
4202 |
version from the output of 'mysqld --version', so don't change it!
|
|
4203 |
*/
|
|
4204 |
printf("%s Ver %s for %s on %s (%s)\n",my_progname, |
|
4205 |
server_version,SYSTEM_TYPE,MACHINE_TYPE, MYSQL_COMPILATION_COMMENT); |
|
4206 |
}
|
|
4207 |
||
4208 |
static void usage(void) |
|
4209 |
{
|
|
4210 |
if (!(default_charset_info= get_charset_by_csname(default_character_set_name, |
|
4211 |
MY_CS_PRIMARY, |
|
4212 |
MYF(MY_WME)))) |
|
4213 |
exit(1); |
|
4214 |
if (!default_collation_name) |
|
4215 |
default_collation_name= (char*) default_charset_info->name; |
|
4216 |
print_version(); |
|
4217 |
puts("\ |
|
4218 |
Copyright (C) 2000 MySQL AB, by Monty and others\n\ |
|
4219 |
This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\ |
|
4220 |
and you are welcome to modify and redistribute it under the GPL license\n\n\ |
|
4221 |
Starts the MySQL database server\n"); |
|
4222 |
||
4223 |
printf("Usage: %s [OPTIONS]\n", my_progname); |
|
4224 |
if (!opt_verbose) |
|
4225 |
puts("\nFor more help options (several pages), use mysqld --verbose --help"); |
|
4226 |
else
|
|
4227 |
{
|
|
4228 |
print_defaults(MYSQL_CONFIG_NAME,load_default_groups); |
|
4229 |
puts(""); |
|
4230 |
set_ports(); |
|
4231 |
||
4232 |
/* Print out all the options including plugin supplied options */
|
|
4233 |
my_print_help_inc_plugins(my_long_options, sizeof(my_long_options)/sizeof(my_option)); |
|
4234 |
||
4235 |
puts("\n\ |
|
4236 |
To see what values a running MySQL server is using, type\n\ |
|
4237 |
'mysqladmin variables' instead of 'mysqld --verbose --help'."); |
|
4238 |
}
|
|
4239 |
}
|
|
4240 |
||
4241 |
||
4242 |
/**
|
|
4243 |
Initialize all MySQL global variables to default values.
|
|
4244 |
||
4245 |
We don't need to set numeric variables refered to in my_long_options
|
|
4246 |
as these are initialized by my_getopt.
|
|
4247 |
||
4248 |
@note
|
|
4249 |
The reason to set a lot of global variables to zero is to allow one to
|
|
4250 |
restart the embedded server with a clean environment
|
|
4251 |
It's also needed on some exotic platforms where global variables are
|
|
4252 |
not set to 0 when a program starts.
|
|
4253 |
||
4254 |
We don't need to set numeric variables refered to in my_long_options
|
|
4255 |
as these are initialized by my_getopt.
|
|
4256 |
*/
|
|
4257 |
||
4258 |
static void mysql_init_variables(void) |
|
4259 |
{
|
|
4260 |
/* Things reset to zero */
|
|
4261 |
opt_skip_slave_start= opt_reckless_slave = 0; |
|
4262 |
mysql_home[0]= pidfile_name[0]= log_error_file[0]= 0; |
|
4263 |
opt_log= opt_slow_log= 0; |
|
4264 |
log_output_options= find_bit_type(log_output_str, &log_output_typelib); |
|
4265 |
opt_bin_log= 0; |
|
4266 |
opt_disable_networking= opt_skip_show_db=0; |
|
92
by Brian Aker
Removed opt_update_log |
4267 |
opt_logname= opt_binlog_index_name= opt_slow_logname= 0; |
1
by brian
clean slate |
4268 |
opt_tc_log_file= (char *)"tc.log"; // no hostname in tc_log file name ! |
4269 |
opt_secure_auth= 0; |
|
4270 |
opt_secure_file_priv= 0; |
|
4271 |
opt_bootstrap= opt_myisam_log= 0; |
|
4272 |
segfaulted= kill_in_progress= 0; |
|
4273 |
cleanup_done= 0; |
|
4274 |
defaults_argc= 0; |
|
4275 |
defaults_argv= 0; |
|
4276 |
server_id_supplied= 0; |
|
4277 |
test_flags= select_errors= dropping_tables= ha_open_options=0; |
|
4278 |
thread_count= thread_running= kill_cached_threads= wake_thread=0; |
|
4279 |
slave_open_temp_tables= 0; |
|
4280 |
cached_thread_count= 0; |
|
4281 |
opt_endinfo= using_udf_functions= 0; |
|
4282 |
opt_using_transactions= using_update_log= 0; |
|
4283 |
abort_loop= select_thread_in_use= signal_thread_in_use= 0; |
|
4284 |
ready_to_exit= shutdown_in_progress= 0; |
|
4285 |
aborted_threads= aborted_connects= 0; |
|
4286 |
specialflag= 0; |
|
4287 |
binlog_cache_use= binlog_cache_disk_use= 0; |
|
4288 |
max_used_connections= slow_launch_threads = 0; |
|
4289 |
mysqld_user= mysqld_chroot= opt_init_file= opt_bin_logname = 0; |
|
4290 |
errmesg= 0; |
|
11
by Brian Aker
Removing old UNIX socket bits |
4291 |
opt_mysql_tmpdir= my_bind_addr_str= NullS; |
1
by brian
clean slate |
4292 |
bzero((uchar*) &mysql_tmpdir_list, sizeof(mysql_tmpdir_list)); |
4293 |
bzero((char *) &global_status_var, sizeof(global_status_var)); |
|
4294 |
key_map_full.set_all(); |
|
4295 |
||
4296 |
/* Character sets */
|
|
4297 |
system_charset_info= &my_charset_utf8_general_ci; |
|
4298 |
files_charset_info= &my_charset_utf8_general_ci; |
|
4299 |
national_charset_info= &my_charset_utf8_general_ci; |
|
4300 |
table_alias_charset= &my_charset_bin; |
|
4301 |
character_set_filesystem= &my_charset_bin; |
|
4302 |
||
4303 |
opt_date_time_formats[0]= opt_date_time_formats[1]= opt_date_time_formats[2]= 0; |
|
4304 |
||
4305 |
/* Things with default values that are not zero */
|
|
4306 |
delay_key_write_options= (uint) DELAY_KEY_WRITE_ON; |
|
4307 |
slave_exec_mode_options= 0; |
|
4308 |
slave_exec_mode_options= (uint) |
|
4309 |
find_bit_type_or_exit(slave_exec_mode_str, &slave_exec_mode_typelib, NULL); |
|
4310 |
opt_specialflag= SPECIAL_ENGLISH; |
|
11
by Brian Aker
Removing old UNIX socket bits |
4311 |
ip_sock= INVALID_SOCKET; |
1
by brian
clean slate |
4312 |
mysql_home_ptr= mysql_home; |
4313 |
pidfile_name_ptr= pidfile_name; |
|
4314 |
log_error_file_ptr= log_error_file; |
|
4315 |
language_ptr= language; |
|
4316 |
mysql_data_home= mysql_real_data_home; |
|
4317 |
thd_startup_options= (OPTION_AUTO_IS_NULL | OPTION_BIN_LOG | |
|
4318 |
OPTION_QUOTE_SHOW_CREATE | OPTION_SQL_NOTES); |
|
4319 |
protocol_version= PROTOCOL_VERSION; |
|
4320 |
what_to_log= ~ (1L << (uint) COM_TIME); |
|
4321 |
refresh_version= 1L; /* Increments on each reload */ |
|
4322 |
global_query_id= thread_id= 1L; |
|
4323 |
strmov(server_version, MYSQL_SERVER_VERSION); |
|
4324 |
myisam_recover_options_str= "OFF"; |
|
4325 |
myisam_stats_method_str= "nulls_unequal"; |
|
4326 |
threads.empty(); |
|
4327 |
thread_cache.empty(); |
|
4328 |
key_caches.empty(); |
|
4329 |
if (!(dflt_key_cache= get_or_create_key_cache(default_key_cache_base.str, |
|
4330 |
default_key_cache_base.length))) |
|
4331 |
exit(1); |
|
4332 |
/* set key_cache_hash.default_value = dflt_key_cache */
|
|
4333 |
multi_keycache_init(); |
|
4334 |
||
4335 |
/* Set directory paths */
|
|
4336 |
strmake(language, LANGUAGE, sizeof(language)-1); |
|
4337 |
strmake(mysql_real_data_home, get_relative_path(DATADIR), |
|
4338 |
sizeof(mysql_real_data_home)-1); |
|
4339 |
mysql_data_home_buff[0]=FN_CURLIB; // all paths are relative from here |
|
4340 |
mysql_data_home_buff[1]=0; |
|
4341 |
mysql_data_home_len= 2; |
|
4342 |
||
4343 |
/* Replication parameters */
|
|
4344 |
master_info_file= (char*) "master.info", |
|
4345 |
relay_log_info_file= (char*) "relay-log.info"; |
|
4346 |
report_user= report_password = report_host= 0; /* TO BE DELETED */ |
|
4347 |
opt_relay_logname= opt_relaylog_index_name= 0; |
|
4348 |
||
4349 |
/* Variables in libraries */
|
|
4350 |
charsets_dir= 0; |
|
4351 |
default_character_set_name= (char*) MYSQL_DEFAULT_CHARSET_NAME; |
|
4352 |
default_collation_name= compiled_default_collation_name; |
|
10
by Brian Aker
Start of var cleanup (really.... looking at this code the entire thing needs |
4353 |
sys_charset_system.set((char*) system_charset_info->csname); |
1
by brian
clean slate |
4354 |
character_set_filesystem_name= (char*) "binary"; |
4355 |
lc_time_names_name= (char*) "en_US"; |
|
4356 |
/* Set default values for some option variables */
|
|
4357 |
default_storage_engine_str= (char*) "MyISAM"; |
|
4358 |
global_system_variables.table_plugin= NULL; |
|
4359 |
global_system_variables.tx_isolation= ISO_REPEATABLE_READ; |
|
151
by Brian Aker
Ulonglong to uint64_t |
4360 |
global_system_variables.select_limit= (uint64_t) HA_POS_ERROR; |
4361 |
max_system_variables.select_limit= (uint64_t) HA_POS_ERROR; |
|
4362 |
global_system_variables.max_join_size= (uint64_t) HA_POS_ERROR; |
|
4363 |
max_system_variables.max_join_size= (uint64_t) HA_POS_ERROR; |
|
1
by brian
clean slate |
4364 |
global_system_variables.old_alter_table= 0; |
4365 |
global_system_variables.binlog_format= BINLOG_FORMAT_UNSPEC; |
|
4366 |
/*
|
|
4367 |
Default behavior for 4.1 and 5.0 is to treat NULL values as unequal
|
|
4368 |
when collecting index statistics for MyISAM tables.
|
|
4369 |
*/
|
|
4370 |
global_system_variables.myisam_stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL; |
|
4371 |
||
4372 |
/* Variables that depends on compile options */
|
|
4373 |
opt_error_log= IF_WIN(1,0); |
|
4374 |
#ifdef HAVE_BROKEN_REALPATH
|
|
4375 |
have_symlink=SHOW_OPTION_NO; |
|
4376 |
#else
|
|
4377 |
have_symlink=SHOW_OPTION_YES; |
|
4378 |
#endif
|
|
4379 |
#ifdef HAVE_CRYPT
|
|
4380 |
have_crypt=SHOW_OPTION_YES; |
|
4381 |
#else
|
|
4382 |
have_crypt=SHOW_OPTION_NO; |
|
4383 |
#endif
|
|
4384 |
#ifdef HAVE_COMPRESS
|
|
4385 |
have_compress= SHOW_OPTION_YES; |
|
4386 |
#else
|
|
4387 |
have_compress= SHOW_OPTION_NO; |
|
4388 |
#endif
|
|
4389 |
||
4390 |
const char *tmpenv; |
|
4391 |
if (!(tmpenv = getenv("MY_BASEDIR_VERSION"))) |
|
4392 |
tmpenv = DEFAULT_MYSQL_HOME; |
|
4393 |
(void) strmake(mysql_home, tmpenv, sizeof(mysql_home)-1); |
|
4394 |
}
|
|
4395 |
||
4396 |
||
143
by Brian Aker
Bool cleanup. |
4397 |
bool
|
1
by brian
clean slate |
4398 |
mysqld_get_one_option(int optid, |
4399 |
const struct my_option *opt __attribute__((unused)), |
|
4400 |
char *argument) |
|
4401 |
{
|
|
4402 |
switch(optid) { |
|
4403 |
case '#': |
|
4404 |
opt_endinfo=1; /* unireg: memory allocation */ |
|
4405 |
break; |
|
4406 |
case 'a': |
|
4407 |
global_system_variables.tx_isolation= ISO_SERIALIZABLE; |
|
4408 |
break; |
|
4409 |
case 'b': |
|
4410 |
strmake(mysql_home,argument,sizeof(mysql_home)-1); |
|
4411 |
break; |
|
4412 |
case 'C': |
|
4413 |
if (default_collation_name == compiled_default_collation_name) |
|
4414 |
default_collation_name= 0; |
|
4415 |
break; |
|
4416 |
case 'l': |
|
4417 |
opt_log=1; |
|
4418 |
break; |
|
4419 |
case 'h': |
|
4420 |
strmake(mysql_real_data_home,argument, sizeof(mysql_real_data_home)-1); |
|
4421 |
/* Correct pointer set by my_getopt (for embedded library) */
|
|
4422 |
mysql_data_home= mysql_real_data_home; |
|
4423 |
mysql_data_home_len= strlen(mysql_data_home); |
|
4424 |
break; |
|
4425 |
case 'u': |
|
4426 |
if (!mysqld_user || !strcmp(mysqld_user, argument)) |
|
4427 |
mysqld_user= argument; |
|
4428 |
else
|
|
4429 |
sql_print_warning("Ignoring user change to '%s' because the user was set to '%s' earlier on the command line\n", argument, mysqld_user); |
|
4430 |
break; |
|
4431 |
case 'L': |
|
4432 |
strmake(language, argument, sizeof(language)-1); |
|
4433 |
break; |
|
4434 |
case OPT_SLAVE_SKIP_ERRORS: |
|
4435 |
init_slave_skip_errors(argument); |
|
4436 |
break; |
|
4437 |
case OPT_SLAVE_EXEC_MODE: |
|
4438 |
slave_exec_mode_options= (uint) |
|
4439 |
find_bit_type_or_exit(argument, &slave_exec_mode_typelib, ""); |
|
4440 |
break; |
|
4441 |
case 'V': |
|
4442 |
print_version(); |
|
4443 |
exit(0); |
|
4444 |
case 'W': |
|
4445 |
if (!argument) |
|
4446 |
global_system_variables.log_warnings++; |
|
4447 |
else if (argument == disabled_my_option) |
|
4448 |
global_system_variables.log_warnings= 0L; |
|
4449 |
else
|
|
4450 |
global_system_variables.log_warnings= atoi(argument); |
|
4451 |
break; |
|
4452 |
case 'T': |
|
4453 |
test_flags= argument ? (uint) atoi(argument) : 0; |
|
4454 |
opt_endinfo=1; |
|
4455 |
break; |
|
4456 |
case (int) OPT_BIG_TABLES: |
|
4457 |
thd_startup_options|=OPTION_BIG_TABLES; |
|
4458 |
break; |
|
4459 |
case (int) OPT_ISAM_LOG: |
|
4460 |
opt_myisam_log=1; |
|
4461 |
break; |
|
4462 |
case (int) OPT_BIN_LOG: |
|
4463 |
opt_bin_log= test(argument != disabled_my_option); |
|
4464 |
break; |
|
4465 |
case (int) OPT_ERROR_LOG_FILE: |
|
4466 |
opt_error_log= 1; |
|
4467 |
break; |
|
4468 |
case (int)OPT_REPLICATE_IGNORE_DB: |
|
4469 |
{
|
|
4470 |
rpl_filter->add_ignore_db(argument); |
|
4471 |
break; |
|
4472 |
}
|
|
4473 |
case (int)OPT_REPLICATE_DO_DB: |
|
4474 |
{
|
|
4475 |
rpl_filter->add_do_db(argument); |
|
4476 |
break; |
|
4477 |
}
|
|
4478 |
case (int)OPT_REPLICATE_REWRITE_DB: |
|
4479 |
{
|
|
4480 |
char* key = argument,*p, *val; |
|
4481 |
||
4482 |
if (!(p= strstr(argument, "->"))) |
|
4483 |
{
|
|
4484 |
fprintf(stderr, |
|
4485 |
"Bad syntax in replicate-rewrite-db - missing '->'!\n"); |
|
4486 |
exit(1); |
|
4487 |
}
|
|
4488 |
val= p--; |
|
4489 |
while (my_isspace(mysqld_charset, *p) && p > argument) |
|
4490 |
*p-- = 0; |
|
4491 |
if (p == argument) |
|
4492 |
{
|
|
4493 |
fprintf(stderr, |
|
4494 |
"Bad syntax in replicate-rewrite-db - empty FROM db!\n"); |
|
4495 |
exit(1); |
|
4496 |
}
|
|
4497 |
*val= 0; |
|
4498 |
val+= 2; |
|
4499 |
while (*val && my_isspace(mysqld_charset, *val)) |
|
4500 |
*val++; |
|
4501 |
if (!*val) |
|
4502 |
{
|
|
4503 |
fprintf(stderr, |
|
4504 |
"Bad syntax in replicate-rewrite-db - empty TO db!\n"); |
|
4505 |
exit(1); |
|
4506 |
}
|
|
4507 |
||
4508 |
rpl_filter->add_db_rewrite(key, val); |
|
4509 |
break; |
|
4510 |
}
|
|
4511 |
||
4512 |
case (int)OPT_BINLOG_IGNORE_DB: |
|
4513 |
{
|
|
4514 |
binlog_filter->add_ignore_db(argument); |
|
4515 |
break; |
|
4516 |
}
|
|
4517 |
case OPT_BINLOG_FORMAT: |
|
4518 |
{
|
|
4519 |
int id; |
|
4520 |
id= find_type_or_exit(argument, &binlog_format_typelib, opt->name); |
|
4521 |
global_system_variables.binlog_format= opt_binlog_format_id= id - 1; |
|
4522 |
break; |
|
4523 |
}
|
|
4524 |
case (int)OPT_BINLOG_DO_DB: |
|
4525 |
{
|
|
4526 |
binlog_filter->add_do_db(argument); |
|
4527 |
break; |
|
4528 |
}
|
|
4529 |
case (int)OPT_REPLICATE_DO_TABLE: |
|
4530 |
{
|
|
4531 |
if (rpl_filter->add_do_table(argument)) |
|
4532 |
{
|
|
4533 |
fprintf(stderr, "Could not add do table rule '%s'!\n", argument); |
|
4534 |
exit(1); |
|
4535 |
}
|
|
4536 |
break; |
|
4537 |
}
|
|
4538 |
case (int)OPT_REPLICATE_WILD_DO_TABLE: |
|
4539 |
{
|
|
4540 |
if (rpl_filter->add_wild_do_table(argument)) |
|
4541 |
{
|
|
4542 |
fprintf(stderr, "Could not add do table rule '%s'!\n", argument); |
|
4543 |
exit(1); |
|
4544 |
}
|
|
4545 |
break; |
|
4546 |
}
|
|
4547 |
case (int)OPT_REPLICATE_WILD_IGNORE_TABLE: |
|
4548 |
{
|
|
4549 |
if (rpl_filter->add_wild_ignore_table(argument)) |
|
4550 |
{
|
|
4551 |
fprintf(stderr, "Could not add ignore table rule '%s'!\n", argument); |
|
4552 |
exit(1); |
|
4553 |
}
|
|
4554 |
break; |
|
4555 |
}
|
|
4556 |
case (int)OPT_REPLICATE_IGNORE_TABLE: |
|
4557 |
{
|
|
4558 |
if (rpl_filter->add_ignore_table(argument)) |
|
4559 |
{
|
|
4560 |
fprintf(stderr, "Could not add ignore table rule '%s'!\n", argument); |
|
4561 |
exit(1); |
|
4562 |
}
|
|
4563 |
break; |
|
4564 |
}
|
|
4565 |
case (int) OPT_SLOW_QUERY_LOG: |
|
4566 |
opt_slow_log= 1; |
|
4567 |
break; |
|
4568 |
#ifdef WITH_CSV_STORAGE_ENGINE
|
|
4569 |
case OPT_LOG_OUTPUT: |
|
4570 |
{
|
|
4571 |
if (!argument || !argument[0]) |
|
4572 |
{
|
|
4573 |
log_output_options= LOG_FILE; |
|
4574 |
log_output_str= log_output_typelib.type_names[1]; |
|
4575 |
}
|
|
4576 |
else
|
|
4577 |
{
|
|
4578 |
log_output_str= argument; |
|
4579 |
log_output_options= |
|
4580 |
find_bit_type_or_exit(argument, &log_output_typelib, opt->name); |
|
4581 |
}
|
|
4582 |
break; |
|
4583 |
}
|
|
4584 |
#endif
|
|
4585 |
case (int) OPT_SKIP_NEW: |
|
4586 |
opt_specialflag|= SPECIAL_NO_NEW_FUNC; |
|
4587 |
delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE; |
|
4588 |
myisam_concurrent_insert=0; |
|
4589 |
myisam_recover_options= HA_RECOVER_NONE; |
|
4590 |
my_use_symdir=0; |
|
4591 |
ha_open_options&= ~(HA_OPEN_ABORT_IF_CRASHED | HA_OPEN_DELAY_KEY_WRITE); |
|
4592 |
break; |
|
4593 |
case (int) OPT_SAFE: |
|
4594 |
opt_specialflag|= SPECIAL_SAFE_MODE; |
|
4595 |
delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE; |
|
4596 |
myisam_recover_options= HA_RECOVER_DEFAULT; |
|
4597 |
ha_open_options&= ~(HA_OPEN_DELAY_KEY_WRITE); |
|
4598 |
break; |
|
4599 |
case (int) OPT_SKIP_PRIOR: |
|
4600 |
opt_specialflag|= SPECIAL_NO_PRIOR; |
|
4601 |
break; |
|
4602 |
case (int) OPT_SKIP_SHOW_DB: |
|
4603 |
opt_skip_show_db=1; |
|
4604 |
opt_specialflag|=SPECIAL_SKIP_SHOW_DB; |
|
4605 |
break; |
|
4606 |
case (int) OPT_WANT_CORE: |
|
4607 |
test_flags |= TEST_CORE_ON_SIGNAL; |
|
4608 |
break; |
|
4609 |
case (int) OPT_SKIP_STACK_TRACE: |
|
4610 |
test_flags|=TEST_NO_STACKTRACE; |
|
4611 |
break; |
|
4612 |
case (int) OPT_SKIP_SYMLINKS: |
|
4613 |
my_use_symdir=0; |
|
4614 |
break; |
|
4615 |
case (int) OPT_BIND_ADDRESS: |
|
4616 |
{
|
|
4617 |
struct addrinfo *res_lst, hints; |
|
4618 |
||
4619 |
bzero(&hints, sizeof(struct addrinfo)); |
|
4620 |
hints.ai_socktype= SOCK_STREAM; |
|
4621 |
hints.ai_protocol= IPPROTO_TCP; |
|
4622 |
||
4623 |
if (getaddrinfo(argument, NULL, &hints, &res_lst) != 0) |
|
4624 |
{
|
|
4625 |
sql_print_error("Can't start server: cannot resolve hostname!"); |
|
4626 |
exit(1); |
|
4627 |
}
|
|
4628 |
||
4629 |
if (res_lst->ai_next) |
|
4630 |
{
|
|
4631 |
sql_print_error("Can't start server: bind-address refers to multiple interfaces!"); |
|
4632 |
exit(1); |
|
4633 |
}
|
|
4634 |
freeaddrinfo(res_lst); |
|
4635 |
}
|
|
4636 |
break; |
|
4637 |
case (int) OPT_PID_FILE: |
|
4638 |
strmake(pidfile_name, argument, sizeof(pidfile_name)-1); |
|
4639 |
break; |
|
4640 |
case OPT_CONSOLE: |
|
4641 |
if (opt_console) |
|
4642 |
opt_error_log= 0; // Force logs to stdout |
|
4643 |
break; |
|
4644 |
case OPT_LOW_PRIORITY_UPDATES: |
|
4645 |
thr_upgraded_concurrent_insert_lock= TL_WRITE_LOW_PRIORITY; |
|
4646 |
global_system_variables.low_priority_updates=1; |
|
4647 |
break; |
|
4648 |
case OPT_BOOTSTRAP: |
|
4649 |
opt_noacl=opt_bootstrap=1; |
|
4650 |
break; |
|
4651 |
case OPT_SERVER_ID: |
|
4652 |
server_id_supplied = 1; |
|
4653 |
break; |
|
4654 |
case OPT_DELAY_KEY_WRITE_ALL: |
|
4655 |
if (argument != disabled_my_option) |
|
4656 |
argument= (char*) "ALL"; |
|
4657 |
/* Fall through */
|
|
4658 |
case OPT_DELAY_KEY_WRITE: |
|
4659 |
if (argument == disabled_my_option) |
|
4660 |
delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE; |
|
4661 |
else if (! argument) |
|
4662 |
delay_key_write_options= (uint) DELAY_KEY_WRITE_ON; |
|
4663 |
else
|
|
4664 |
{
|
|
4665 |
int type; |
|
4666 |
type= find_type_or_exit(argument, &delay_key_write_typelib, opt->name); |
|
4667 |
delay_key_write_options= (uint) type-1; |
|
4668 |
}
|
|
4669 |
break; |
|
4670 |
case OPT_CHARSETS_DIR: |
|
4671 |
strmake(mysql_charsets_dir, argument, sizeof(mysql_charsets_dir)-1); |
|
4672 |
charsets_dir = mysql_charsets_dir; |
|
4673 |
break; |
|
4674 |
case OPT_TX_ISOLATION: |
|
4675 |
{
|
|
4676 |
int type; |
|
4677 |
type= find_type_or_exit(argument, &tx_isolation_typelib, opt->name); |
|
4678 |
global_system_variables.tx_isolation= (type-1); |
|
4679 |
break; |
|
4680 |
}
|
|
4681 |
case OPT_MYISAM_RECOVER: |
|
4682 |
{
|
|
4683 |
if (!argument) |
|
4684 |
{
|
|
4685 |
myisam_recover_options= HA_RECOVER_DEFAULT; |
|
4686 |
myisam_recover_options_str= myisam_recover_typelib.type_names[0]; |
|
4687 |
}
|
|
4688 |
else if (!argument[0]) |
|
4689 |
{
|
|
4690 |
myisam_recover_options= HA_RECOVER_NONE; |
|
4691 |
myisam_recover_options_str= "OFF"; |
|
4692 |
}
|
|
4693 |
else
|
|
4694 |
{
|
|
4695 |
myisam_recover_options_str=argument; |
|
4696 |
myisam_recover_options= |
|
4697 |
find_bit_type_or_exit(argument, &myisam_recover_typelib, opt->name); |
|
4698 |
}
|
|
4699 |
ha_open_options|=HA_OPEN_ABORT_IF_CRASHED; |
|
4700 |
break; |
|
4701 |
}
|
|
4702 |
case OPT_TC_HEURISTIC_RECOVER: |
|
4703 |
tc_heuristic_recover= find_type_or_exit(argument, |
|
4704 |
&tc_heuristic_recover_typelib, |
|
4705 |
opt->name); |
|
4706 |
break; |
|
4707 |
case OPT_MYISAM_STATS_METHOD: |
|
4708 |
{
|
|
4709 |
ulong method_conv; |
|
4710 |
int method; |
|
4711 |
||
4712 |
myisam_stats_method_str= argument; |
|
4713 |
method= find_type_or_exit(argument, &myisam_stats_method_typelib, |
|
4714 |
opt->name); |
|
4715 |
switch (method-1) { |
|
4716 |
case 2: |
|
4717 |
method_conv= MI_STATS_METHOD_IGNORE_NULLS; |
|
4718 |
break; |
|
4719 |
case 1: |
|
4720 |
method_conv= MI_STATS_METHOD_NULLS_EQUAL; |
|
4721 |
break; |
|
4722 |
case 0: |
|
4723 |
default: |
|
4724 |
method_conv= MI_STATS_METHOD_NULLS_NOT_EQUAL; |
|
4725 |
break; |
|
4726 |
}
|
|
4727 |
global_system_variables.myisam_stats_method= method_conv; |
|
4728 |
break; |
|
4729 |
}
|
|
4730 |
case OPT_LOWER_CASE_TABLE_NAMES: |
|
4731 |
lower_case_table_names= argument ? atoi(argument) : 1; |
|
4732 |
lower_case_table_names_used= 1; |
|
4733 |
break; |
|
4734 |
}
|
|
4735 |
return 0; |
|
4736 |
}
|
|
4737 |
||
4738 |
||
4739 |
/** Handle arguments for multiple key caches. */
|
|
4740 |
||
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
4741 |
extern "C" char **mysql_getopt_value(const char *keyname, uint key_length, |
1
by brian
clean slate |
4742 |
const struct my_option *option); |
4743 |
||
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
4744 |
char** |
1
by brian
clean slate |
4745 |
mysql_getopt_value(const char *keyname, uint key_length, |
4746 |
const struct my_option *option) |
|
4747 |
{
|
|
4748 |
switch (option->id) { |
|
4749 |
case OPT_KEY_BUFFER_SIZE: |
|
4750 |
case OPT_KEY_CACHE_BLOCK_SIZE: |
|
4751 |
case OPT_KEY_CACHE_DIVISION_LIMIT: |
|
4752 |
case OPT_KEY_CACHE_AGE_THRESHOLD: |
|
4753 |
{
|
|
4754 |
KEY_CACHE *key_cache; |
|
4755 |
if (!(key_cache= get_or_create_key_cache(keyname, key_length))) |
|
4756 |
exit(1); |
|
4757 |
switch (option->id) { |
|
4758 |
case OPT_KEY_BUFFER_SIZE: |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
4759 |
return (char**) &key_cache->param_buff_size; |
1
by brian
clean slate |
4760 |
case OPT_KEY_CACHE_BLOCK_SIZE: |
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
4761 |
return (char**) &key_cache->param_block_size; |
1
by brian
clean slate |
4762 |
case OPT_KEY_CACHE_DIVISION_LIMIT: |
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
4763 |
return (char**) &key_cache->param_division_limit; |
1
by brian
clean slate |
4764 |
case OPT_KEY_CACHE_AGE_THRESHOLD: |
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
4765 |
return (char**) &key_cache->param_age_threshold; |
1
by brian
clean slate |
4766 |
}
|
4767 |
}
|
|
4768 |
}
|
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
4769 |
return (char **)option->value; |
1
by brian
clean slate |
4770 |
}
|
4771 |
||
4772 |
||
4773 |
extern "C" void option_error_reporter(enum loglevel level, const char *format, ...); |
|
4774 |
||
4775 |
void option_error_reporter(enum loglevel level, const char *format, ...) |
|
4776 |
{
|
|
4777 |
va_list args; |
|
4778 |
va_start(args, format); |
|
4779 |
||
4780 |
/* Don't print warnings for --loose options during bootstrap */
|
|
4781 |
if (level == ERROR_LEVEL || !opt_bootstrap || |
|
4782 |
global_system_variables.log_warnings) |
|
4783 |
{
|
|
4784 |
vprint_msg_to_log(level, format, args); |
|
4785 |
}
|
|
4786 |
va_end(args); |
|
4787 |
}
|
|
4788 |
||
4789 |
||
4790 |
/**
|
|
4791 |
@todo
|
|
4792 |
- FIXME add EXIT_TOO_MANY_ARGUMENTS to "mysys_err.h" and return that code?
|
|
4793 |
*/
|
|
4794 |
static void get_options(int *argc,char **argv) |
|
4795 |
{
|
|
4796 |
int ho_error; |
|
4797 |
||
4798 |
my_getopt_register_get_addr(mysql_getopt_value); |
|
4799 |
my_getopt_error_reporter= option_error_reporter; |
|
4800 |
||
4801 |
/* Skip unknown options so that they may be processed later by plugins */
|
|
163
by Brian Aker
Merge Monty's code. |
4802 |
my_getopt_skip_unknown= true; |
1
by brian
clean slate |
4803 |
|
4804 |
if ((ho_error= handle_options(argc, &argv, my_long_options, |
|
4805 |
mysqld_get_one_option))) |
|
4806 |
exit(ho_error); |
|
4807 |
(*argc)++; /* add back one for the progname handle_options removes */ |
|
4808 |
/* no need to do this for argv as we are discarding it. */
|
|
4809 |
||
4810 |
if ((opt_log_slow_admin_statements || opt_log_queries_not_using_indexes || |
|
4811 |
opt_log_slow_slave_statements) && |
|
4812 |
!opt_slow_log) |
|
4813 |
sql_print_warning("options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log-slow-queries is not set"); |
|
4814 |
||
4815 |
#if defined(HAVE_BROKEN_REALPATH)
|
|
4816 |
my_use_symdir=0; |
|
4817 |
my_disable_symlinks=1; |
|
4818 |
have_symlink=SHOW_OPTION_NO; |
|
4819 |
#else
|
|
4820 |
if (!my_use_symdir) |
|
4821 |
{
|
|
4822 |
my_disable_symlinks=1; |
|
4823 |
have_symlink=SHOW_OPTION_DISABLED; |
|
4824 |
}
|
|
4825 |
#endif
|
|
4826 |
if (opt_debugging) |
|
4827 |
{
|
|
4828 |
/* Allow break with SIGINT, no core or stack trace */
|
|
4829 |
test_flags|= TEST_SIGINT | TEST_NO_STACKTRACE; |
|
4830 |
test_flags&= ~TEST_CORE_ON_SIGNAL; |
|
4831 |
}
|
|
4832 |
/* Set global MyISAM variables from delay_key_write_options */
|
|
4833 |
fix_delay_key_write((THD*) 0, OPT_GLOBAL); |
|
4834 |
/* Set global slave_exec_mode from its option */
|
|
4835 |
fix_slave_exec_mode(OPT_GLOBAL); |
|
4836 |
||
4837 |
if (mysqld_chroot) |
|
4838 |
set_root(mysqld_chroot); |
|
4839 |
fix_paths(); |
|
4840 |
||
4841 |
/*
|
|
4842 |
Set some global variables from the global_system_variables
|
|
4843 |
In most cases the global variables will not be used
|
|
4844 |
*/
|
|
4845 |
my_default_record_cache_size=global_system_variables.read_buff_size; |
|
4846 |
myisam_max_temp_length= |
|
4847 |
(my_off_t) global_system_variables.myisam_max_sort_file_size; |
|
4848 |
||
4849 |
/* Set global variables based on startup options */
|
|
4850 |
myisam_block_size=(uint) 1 << my_bit_log2(opt_myisam_block_size); |
|
4851 |
||
4852 |
/* long_query_time is in microseconds */
|
|
4853 |
global_system_variables.long_query_time= max_system_variables.long_query_time= |
|
152
by Brian Aker
longlong replacement |
4854 |
(int64_t) (long_query_time * 1000000.0); |
1
by brian
clean slate |
4855 |
|
4856 |
if (opt_short_log_format) |
|
4857 |
opt_specialflag|= SPECIAL_SHORT_LOG_FORMAT; |
|
4858 |
||
4859 |
if (init_global_datetime_format(MYSQL_TIMESTAMP_DATE, |
|
4860 |
&global_system_variables.date_format) || |
|
4861 |
init_global_datetime_format(MYSQL_TIMESTAMP_TIME, |
|
4862 |
&global_system_variables.time_format) || |
|
4863 |
init_global_datetime_format(MYSQL_TIMESTAMP_DATETIME, |
|
4864 |
&global_system_variables.datetime_format)) |
|
4865 |
exit(1); |
|
4866 |
||
12.1.3
by Brian Aker
Removal of dead code/remove non-used Falcon tests. |
4867 |
pool_of_threads_scheduler(&thread_scheduler); /* purecov: tested */ |
1
by brian
clean slate |
4868 |
}
|
4869 |
||
4870 |
||
4871 |
/*
|
|
4872 |
Create version name for running mysqld version
|
|
4873 |
We automaticly add suffixes -debug, -embedded and -log to the version
|
|
4874 |
name to make the version more descriptive.
|
|
4875 |
(MYSQL_SERVER_SUFFIX is set by the compilation environment)
|
|
4876 |
*/
|
|
4877 |
||
4878 |
static void set_server_version(void) |
|
4879 |
{
|
|
4880 |
char *end= strxmov(server_version, MYSQL_SERVER_VERSION, |
|
4881 |
MYSQL_SERVER_SUFFIX_STR, NullS); |
|
92
by Brian Aker
Removed opt_update_log |
4882 |
if (opt_log || opt_slow_log || opt_bin_log) |
1
by brian
clean slate |
4883 |
strmov(end, "-log"); // This may slow down system |
4884 |
}
|
|
4885 |
||
4886 |
||
4887 |
static char *get_relative_path(const char *path) |
|
4888 |
{
|
|
4889 |
if (test_if_hard_path(path) && |
|
4890 |
is_prefix(path,DEFAULT_MYSQL_HOME) && |
|
4891 |
strcmp(DEFAULT_MYSQL_HOME,FN_ROOTDIR)) |
|
4892 |
{
|
|
4893 |
path+=(uint) strlen(DEFAULT_MYSQL_HOME); |
|
4894 |
while (*path == FN_LIBCHAR) |
|
4895 |
path++; |
|
4896 |
}
|
|
4897 |
return (char*) path; |
|
4898 |
}
|
|
4899 |
||
4900 |
||
4901 |
/**
|
|
4902 |
Fix filename and replace extension where 'dir' is relative to
|
|
4903 |
mysql_real_data_home.
|
|
4904 |
@return
|
|
4905 |
1 if len(path) > FN_REFLEN
|
|
4906 |
*/
|
|
4907 |
||
4908 |
bool
|
|
4909 |
fn_format_relative_to_data_home(char * to, const char *name, |
|
4910 |
const char *dir, const char *extension) |
|
4911 |
{
|
|
4912 |
char tmp_path[FN_REFLEN]; |
|
4913 |
if (!test_if_hard_path(dir)) |
|
4914 |
{
|
|
4915 |
strxnmov(tmp_path,sizeof(tmp_path)-1, mysql_real_data_home, |
|
4916 |
dir, NullS); |
|
4917 |
dir=tmp_path; |
|
4918 |
}
|
|
4919 |
return !fn_format(to, name, dir, extension, |
|
4920 |
MY_APPEND_EXT | MY_UNPACK_FILENAME | MY_SAFE_PATH); |
|
4921 |
}
|
|
4922 |
||
4923 |
||
4924 |
static void fix_paths(void) |
|
4925 |
{
|
|
4926 |
char buff[FN_REFLEN],*pos; |
|
4927 |
convert_dirname(mysql_home,mysql_home,NullS); |
|
4928 |
/* Resolve symlinks to allow 'mysql_home' to be a relative symlink */
|
|
4929 |
my_realpath(mysql_home,mysql_home,MYF(0)); |
|
4930 |
/* Ensure that mysql_home ends in FN_LIBCHAR */
|
|
4931 |
pos=strend(mysql_home); |
|
4932 |
if (pos[-1] != FN_LIBCHAR) |
|
4933 |
{
|
|
4934 |
pos[0]= FN_LIBCHAR; |
|
4935 |
pos[1]= 0; |
|
4936 |
}
|
|
4937 |
convert_dirname(mysql_real_data_home,mysql_real_data_home,NullS); |
|
4938 |
(void) fn_format(buff, mysql_real_data_home, "", "", |
|
4939 |
(MY_RETURN_REAL_PATH|MY_RESOLVE_SYMLINKS)); |
|
4940 |
(void) unpack_dirname(mysql_unpacked_real_data_home, buff); |
|
4941 |
convert_dirname(language,language,NullS); |
|
4942 |
(void) my_load_path(mysql_home,mysql_home,""); // Resolve current dir |
|
4943 |
(void) my_load_path(mysql_real_data_home,mysql_real_data_home,mysql_home); |
|
4944 |
(void) my_load_path(pidfile_name,pidfile_name,mysql_real_data_home); |
|
4945 |
(void) my_load_path(opt_plugin_dir, opt_plugin_dir_ptr ? opt_plugin_dir_ptr : |
|
4946 |
get_relative_path(PLUGINDIR), mysql_home); |
|
4947 |
opt_plugin_dir_ptr= opt_plugin_dir; |
|
4948 |
||
4949 |
char *sharedir=get_relative_path(SHAREDIR); |
|
4950 |
if (test_if_hard_path(sharedir)) |
|
4951 |
strmake(buff,sharedir,sizeof(buff)-1); /* purecov: tested */ |
|
4952 |
else
|
|
4953 |
strxnmov(buff,sizeof(buff)-1,mysql_home,sharedir,NullS); |
|
4954 |
convert_dirname(buff,buff,NullS); |
|
4955 |
(void) my_load_path(language,language,buff); |
|
4956 |
||
4957 |
/* If --character-sets-dir isn't given, use shared library dir */
|
|
4958 |
if (charsets_dir != mysql_charsets_dir) |
|
4959 |
{
|
|
4960 |
strxnmov(mysql_charsets_dir, sizeof(mysql_charsets_dir)-1, buff, |
|
4961 |
CHARSET_DIR, NullS); |
|
4962 |
}
|
|
4963 |
(void) my_load_path(mysql_charsets_dir, mysql_charsets_dir, buff); |
|
4964 |
convert_dirname(mysql_charsets_dir, mysql_charsets_dir, NullS); |
|
4965 |
charsets_dir=mysql_charsets_dir; |
|
4966 |
||
4967 |
if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir)) |
|
4968 |
exit(1); |
|
4969 |
if (!slave_load_tmpdir) |
|
4970 |
{
|
|
4971 |
if (!(slave_load_tmpdir = (char*) my_strdup(mysql_tmpdir, MYF(MY_FAE)))) |
|
4972 |
exit(1); |
|
4973 |
}
|
|
4974 |
/*
|
|
4975 |
Convert the secure-file-priv option to system format, allowing
|
|
4976 |
a quick strcmp to check if read or write is in an allowed dir
|
|
4977 |
*/
|
|
4978 |
if (opt_secure_file_priv) |
|
4979 |
{
|
|
4980 |
convert_dirname(buff, opt_secure_file_priv, NullS); |
|
4981 |
my_free(opt_secure_file_priv, MYF(0)); |
|
4982 |
opt_secure_file_priv= my_strdup(buff, MYF(MY_FAE)); |
|
4983 |
}
|
|
4984 |
}
|
|
4985 |
||
4986 |
||
4987 |
static ulong find_bit_type_or_exit(const char *x, TYPELIB *bit_lib, |
|
4988 |
const char *option) |
|
4989 |
{
|
|
4990 |
ulong res; |
|
4991 |
||
4992 |
const char **ptr; |
|
4993 |
||
4994 |
if ((res= find_bit_type(x, bit_lib)) == ~(ulong) 0) |
|
4995 |
{
|
|
4996 |
ptr= bit_lib->type_names; |
|
4997 |
if (!*x) |
|
4998 |
fprintf(stderr, "No option given to %s\n", option); |
|
4999 |
else
|
|
5000 |
fprintf(stderr, "Wrong option to %s. Option(s) given: %s\n", option, x); |
|
5001 |
fprintf(stderr, "Alternatives are: '%s'", *ptr); |
|
5002 |
while (*++ptr) |
|
5003 |
fprintf(stderr, ",'%s'", *ptr); |
|
5004 |
fprintf(stderr, "\n"); |
|
5005 |
exit(1); |
|
5006 |
}
|
|
5007 |
return res; |
|
5008 |
}
|
|
5009 |
||
5010 |
||
5011 |
/**
|
|
5012 |
@return
|
|
5013 |
a bitfield from a string of substrings separated by ','
|
|
5014 |
or
|
|
5015 |
~(ulong) 0 on error.
|
|
5016 |
*/
|
|
5017 |
||
5018 |
static ulong find_bit_type(const char *x, TYPELIB *bit_lib) |
|
5019 |
{
|
|
5020 |
bool found_end; |
|
5021 |
int found_count; |
|
5022 |
const char *end,*i,*j; |
|
5023 |
const char **array, *pos; |
|
5024 |
ulong found,found_int,bit; |
|
5025 |
||
5026 |
found=0; |
|
5027 |
found_end= 0; |
|
5028 |
pos=(char *) x; |
|
5029 |
while (*pos == ' ') pos++; |
|
5030 |
found_end= *pos == 0; |
|
5031 |
while (!found_end) |
|
5032 |
{
|
|
5033 |
if (!*(end=strcend(pos,','))) /* Let end point at fieldend */ |
|
5034 |
{
|
|
5035 |
while (end > pos && end[-1] == ' ') |
|
5036 |
end--; /* Skip end-space */ |
|
5037 |
found_end=1; |
|
5038 |
}
|
|
5039 |
found_int=0; found_count=0; |
|
5040 |
for (array=bit_lib->type_names, bit=1 ; (i= *array++) ; bit<<=1) |
|
5041 |
{
|
|
5042 |
j=pos; |
|
5043 |
while (j != end) |
|
5044 |
{
|
|
5045 |
if (my_toupper(mysqld_charset,*i++) != |
|
5046 |
my_toupper(mysqld_charset,*j++)) |
|
5047 |
goto skip; |
|
5048 |
}
|
|
5049 |
found_int=bit; |
|
5050 |
if (! *i) |
|
5051 |
{
|
|
5052 |
found_count=1; |
|
5053 |
break; |
|
5054 |
}
|
|
5055 |
else if (j != pos) // Half field found |
|
5056 |
{
|
|
5057 |
found_count++; // Could be one of two values |
|
5058 |
}
|
|
5059 |
skip: ; |
|
5060 |
}
|
|
5061 |
if (found_count != 1) |
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
5062 |
return(~(ulong) 0); // No unique value |
1
by brian
clean slate |
5063 |
found|=found_int; |
5064 |
pos=end+1; |
|
5065 |
}
|
|
5066 |
||
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
5067 |
return(found); |
1
by brian
clean slate |
5068 |
} /* find_bit_type */ |
5069 |
||
5070 |
||
5071 |
/**
|
|
5072 |
Check if file system used for databases is case insensitive.
|
|
5073 |
||
5074 |
@param dir_name Directory to test
|
|
5075 |
||
5076 |
@retval
|
|
5077 |
-1 Don't know (Test failed)
|
|
5078 |
@retval
|
|
5079 |
0 File system is case sensitive
|
|
5080 |
@retval
|
|
5081 |
1 File system is case insensitive
|
|
5082 |
*/
|
|
5083 |
||
5084 |
static int test_if_case_insensitive(const char *dir_name) |
|
5085 |
{
|
|
5086 |
int result= 0; |
|
5087 |
File file; |
|
5088 |
char buff[FN_REFLEN], buff2[FN_REFLEN]; |
|
15
by brian
Fix for stat, NETWARE removal |
5089 |
struct stat stat_info; |
1
by brian
clean slate |
5090 |
|
5091 |
fn_format(buff, glob_hostname, dir_name, ".lower-test", |
|
5092 |
MY_UNPACK_FILENAME | MY_REPLACE_EXT | MY_REPLACE_DIR); |
|
5093 |
fn_format(buff2, glob_hostname, dir_name, ".LOWER-TEST", |
|
5094 |
MY_UNPACK_FILENAME | MY_REPLACE_EXT | MY_REPLACE_DIR); |
|
5095 |
(void) my_delete(buff2, MYF(0)); |
|
5096 |
if ((file= my_create(buff, 0666, O_RDWR, MYF(0))) < 0) |
|
5097 |
{
|
|
5098 |
sql_print_warning("Can't create test file %s", buff); |
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
5099 |
return(-1); |
1
by brian
clean slate |
5100 |
}
|
5101 |
my_close(file, MYF(0)); |
|
15
by brian
Fix for stat, NETWARE removal |
5102 |
if (!stat(buff2, &stat_info)) |
1
by brian
clean slate |
5103 |
result= 1; // Can access file |
5104 |
(void) my_delete(buff, MYF(MY_WME)); |
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
5105 |
return(result); |
1
by brian
clean slate |
5106 |
}
|
5107 |
||
5108 |
||
5109 |
/**
|
|
5110 |
Create file to store pid number.
|
|
5111 |
*/
|
|
5112 |
static void create_pid_file() |
|
5113 |
{
|
|
5114 |
File file; |
|
5115 |
if ((file = my_create(pidfile_name,0664, |
|
5116 |
O_WRONLY | O_TRUNC, MYF(MY_WME))) >= 0) |
|
5117 |
{
|
|
5118 |
char buff[21], *end; |
|
5119 |
end= int10_to_str((long) getpid(), buff, 10); |
|
5120 |
*end++= '\n'; |
|
5121 |
if (!my_write(file, (uchar*) buff, (uint) (end-buff), MYF(MY_WME | MY_NABP))) |
|
5122 |
{
|
|
5123 |
(void) my_close(file, MYF(0)); |
|
5124 |
return; |
|
5125 |
}
|
|
5126 |
(void) my_close(file, MYF(0)); |
|
5127 |
}
|
|
5128 |
sql_perror("Can't start server: can't create PID file"); |
|
5129 |
exit(1); |
|
5130 |
}
|
|
5131 |
||
5132 |
/** Clear most status variables. */
|
|
5133 |
void refresh_status(THD *thd) |
|
5134 |
{
|
|
5135 |
pthread_mutex_lock(&LOCK_status); |
|
5136 |
||
5137 |
/* Add thread's status variabes to global status */
|
|
5138 |
add_to_status(&global_status_var, &thd->status_var); |
|
5139 |
||
5140 |
/* Reset thread's status variables */
|
|
5141 |
bzero((uchar*) &thd->status_var, sizeof(thd->status_var)); |
|
5142 |
||
5143 |
/* Reset some global variables */
|
|
5144 |
reset_status_vars(); |
|
5145 |
||
5146 |
/* Reset the counters of all key caches (default and named). */
|
|
5147 |
process_key_caches(reset_key_cache_counters); |
|
5148 |
flush_status_time= time((time_t*) 0); |
|
5149 |
pthread_mutex_unlock(&LOCK_status); |
|
5150 |
||
5151 |
/*
|
|
5152 |
Set max_used_connections to the number of currently open
|
|
5153 |
connections. Lock LOCK_thread_count out of LOCK_status to avoid
|
|
5154 |
deadlocks. Status reset becomes not atomic, but status data is
|
|
5155 |
not exact anyway.
|
|
5156 |
*/
|
|
5157 |
pthread_mutex_lock(&LOCK_thread_count); |
|
5158 |
max_used_connections= thread_count; |
|
5159 |
pthread_mutex_unlock(&LOCK_thread_count); |
|
5160 |
}
|
|
5161 |
||
5162 |
||
5163 |
/*****************************************************************************
|
|
5164 |
Instantiate templates
|
|
5165 |
*****************************************************************************/
|
|
5166 |
||
5167 |
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
|
|
5168 |
/* Used templates */
|
|
5169 |
template class I_List<THD>; |
|
5170 |
template class I_List_iterator<THD>; |
|
5171 |
template class I_List<i_string>; |
|
5172 |
template class I_List<i_string_pair>; |
|
5173 |
template class I_List<NAMED_LIST>; |
|
5174 |
template class I_List<Statement>; |
|
5175 |
template class I_List_iterator<Statement>; |
|
5176 |
#endif
|