343
343
char server_version[SERVER_VERSION_LENGTH];
344
344
char *drizzle_tmpdir= NULL;
345
345
char *opt_drizzle_tmpdir= NULL;
346
const char *myisam_recover_options_str="OFF";
347
346
const char *myisam_stats_method_str="nulls_unequal";
349
348
/** name of reference on left espression in rewritten IN subquery */
433
432
static void fix_paths(void);
434
433
void handle_connections_sockets();
435
434
extern "C" pthread_handler_t handle_slave(void *arg);
436
static uint32_t find_bit_type(const char *x, TYPELIB *bit_lib);
437
static uint32_t find_bit_type_or_exit(const char *x, TYPELIB *bit_lib,
439
435
static void clean_up(bool print_message);
441
437
static void usage(void);
2190
2183
N_("Log connections and queries to file."),
2191
2184
(char**) &opt_logname,
2192
2185
(char**) &opt_logname, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
2193
{"log-isam", OPT_ISAM_LOG,
2194
N_("Log all MyISAM changes to file."),
2195
(char**) &myisam_log_filename, (char**) &myisam_log_filename, 0, GET_STR,
2196
OPT_ARG, 0, 0, 0, 0, 0, 0},
2197
2186
{"log-warnings", 'W',
2198
2187
N_("Log some not critical warnings to the log file."),
2199
2188
(char**) &global_system_variables.log_warnings,
2203
2192
N_("Lock drizzled in memory."),
2204
2193
(char**) &locked_in_memory,
2205
2194
(char**) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
2206
{"myisam-recover", OPT_MYISAM_RECOVER,
2207
N_("Syntax: myisam-recover[=option[,option...]], where option can be "
2208
"DEFAULT, BACKUP, FORCE or QUICK."),
2209
(char**) &myisam_recover_options_str, (char**) &myisam_recover_options_str, 0,
2210
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
2211
2195
{"pid-file", OPT_PID_FILE,
2212
2196
N_("Pid file used by safe_mysqld."),
2213
2197
(char**) &pidfile_name_ptr, (char**) &pidfile_name_ptr, 0, GET_STR,
2301
2285
(char**) &max_system_variables.join_buff_size, 0, GET_UINT64,
2302
2286
REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ULONG_MAX,
2303
2287
MALLOC_OVERHEAD, IO_SIZE, 0},
2304
{"keep_files_on_create", OPT_KEEP_FILES_ON_CREATE,
2305
N_("Don't overwrite stale .MYD and .MYI even if no directory is specified."),
2306
(char**) &global_system_variables.keep_files_on_create,
2307
(char**) &max_system_variables.keep_files_on_create,
2308
0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
2309
2288
{"key_buffer_size", OPT_KEY_BUFFER_SIZE,
2310
2289
N_("The size of the buffer used for index blocks for MyISAM tables. "
2311
2290
"Increase this to get better index handling (for all reads and multiple "
2380
2359
(char**) &global_system_variables.max_sort_length,
2381
2360
(char**) &max_system_variables.max_sort_length, 0, GET_SIZE,
2382
2361
REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0},
2383
{"max_tmp_tables", OPT_MAX_TMP_TABLES,
2384
N_("Maximum number of temporary tables a client can keep open at a time."),
2385
(char**) &global_system_variables.max_tmp_tables,
2386
(char**) &max_system_variables.max_tmp_tables, 0, GET_UINT64,
2387
REQUIRED_ARG, 32, 1, ULONG_MAX, 0, 1, 0},
2388
2362
{"max_write_lock_count", OPT_MAX_WRITE_LOCK_COUNT,
2389
2363
N_("After this many write locks, allow some read locks to run in between."),
2390
2364
(char**) &max_write_lock_count, (char**) &max_write_lock_count, 0, GET_ULL,
2762
2736
refresh_version= 1L; /* Increments on each reload */
2764
2738
strcpy(server_version, VERSION);
2765
myisam_recover_options_str= "OFF";
2766
2739
myisam_stats_method_str= "nulls_unequal";
2767
2740
session_list.clear();
2768
2741
key_caches.empty();
2933
2906
global_system_variables.optimizer_use_mrr= (type-1);
2936
case OPT_MYISAM_RECOVER:
2940
myisam_recover_options= HA_RECOVER_DEFAULT;
2941
myisam_recover_options_str= myisam_recover_typelib.type_names[0];
2943
else if (!argument[0])
2945
myisam_recover_options= HA_RECOVER_NONE;
2946
myisam_recover_options_str= "OFF";
2950
myisam_recover_options_str=argument;
2951
myisam_recover_options=
2952
find_bit_type_or_exit(argument, &myisam_recover_typelib, opt->name);
2954
ha_open_options|=HA_OPEN_ABORT_IF_CRASHED;
2957
2909
case OPT_TC_HEURISTIC_RECOVER:
2958
2910
tc_heuristic_recover= find_type_or_exit(argument,
2959
2911
&tc_heuristic_recover_typelib,
3208
static uint32_t find_bit_type_or_exit(const char *x, TYPELIB *bit_lib,
3215
if ((res= find_bit_type(x, bit_lib)) == ~(uint32_t) 0)
3217
ptr= bit_lib->type_names;
3219
fprintf(stderr, _("No option given to %s\n"), option);
3221
fprintf(stderr, _("Wrong option to %s. Option(s) given: %s\n"),
3223
fprintf(stderr, _("Alternatives are: '%s'"), *ptr);
3225
fprintf(stderr, ",'%s'", *ptr);
3226
fprintf(stderr, "\n");
3235
a bitfield from a string of substrings separated by ','
3237
~(uint32_t) 0 on error.
3240
static uint32_t find_bit_type(const char *x, TYPELIB *bit_lib)
3244
const char *end,*i,*j;
3245
const char **array, *pos;
3246
uint32_t found,found_int,bit;
3251
while (*pos == ' ') pos++;
3252
found_end= *pos == 0;
3255
if ((end=strrchr(pos,',')) != NULL) /* Let end point at fieldend */
3257
while (end > pos && end[-1] == ' ')
3258
end--; /* Skip end-space */
3263
end=pos+strlen(pos);
3266
found_int=0; found_count=0;
3267
for (array=bit_lib->type_names, bit=1 ; (i= *array++) ; bit<<=1)
3272
if (my_toupper(mysqld_charset,*i++) !=
3273
my_toupper(mysqld_charset,*j++))
3282
else if (j != pos) // Half field found
3284
found_count++; // Could be one of two values
3288
if (found_count != 1)
3289
return(~(uint32_t) 0); // No unique value
3295
} /* find_bit_type */
3297
3159
/*****************************************************************************
3298
3160
Instantiate templates
3299
3161
*****************************************************************************/