359
359
static void usage(void);
360
360
void close_connections(void);
362
po::options_description config_options("Config File Options");
362
363
po::options_description long_options("Kernel Options");
364
po::options_description plugin_load_options("Plugin Loading Options");
363
365
po::options_description plugin_options("Plugin Options");
366
po::options_description initial_options("Config and Plugin Loading");
367
po::options_description full_options("Kernel and Plugin Loading and Plugin");
364
368
vector<string> unknown_options;
365
369
vector<string> defaults_file_list;
366
370
po::variables_map vm;
1082
1086
ifstream input_defaults_file(file_location.c_str());
1084
1088
po::parsed_options file_parsed=
1085
po::parse_config_file(input_defaults_file, long_options, true);
1089
po::parse_config_file(input_defaults_file, full_options, true);
1086
1090
vector<string> file_unknown=
1087
1091
po::collect_unrecognized(file_parsed.options, po::include_positional);
1169
1173
std::string system_config_file_drizzle("drizzled.cnf");
1171
long_options.add_options()
1175
config_options.add_options()
1172
1176
("help-extended", po::value<bool>(&opt_help_extended)->default_value(false)->zero_tokens(),
1173
1177
N_("Display this help and exit after initializing plugins."))
1174
1178
("help,?", po::value<bool>(&opt_help)->default_value(false)->zero_tokens(),
1175
1179
N_("Display this help and exit."))
1180
("no-defaults", po::value<bool>()->default_value(false)->zero_tokens(),
1181
N_("Configuration file defaults are not used if no-defaults is set"))
1182
("defaults-file", po::value<vector<string> >()->composing()->notifier(&compose_defaults_file_list),
1183
N_("Configuration file to use"))
1184
("config-dir", po::value<string>()->default_value(system_config_dir_drizzle),
1185
N_("Base location for config files"))
1188
plugin_load_options.add_options()
1189
("plugin-dir", po::value<string>(),
1190
N_("Directory for plugins."))
1191
("plugin-add", po::value<vector<string> >()->composing()->notifier(&compose_plugin_add),
1192
N_("Optional comma separated list of plugins to load at startup in addition "
1193
"to the default list of plugins. "
1194
"[for example: --plugin_add=crc32,logger_gearman]"))
1195
("plugin-remove", po::value<vector<string> >()->composing()->notifier(&compose_plugin_remove),
1196
N_("Optional comma separated list of plugins to not load at startup. Effectively "
1197
"removes a plugin from the list of plugins to be loaded. "
1198
"[for example: --plugin_remove=crc32,logger_gearman]"))
1199
("plugin-load", po::value<string>()->notifier(¬ify_plugin_load)->default_value(PANDORA_PLUGIN_LIST),
1200
N_("Optional comma separated list of plugins to load at starup instead of "
1201
"the default plugin load list. "
1202
"[for example: --plugin_load=crc32,logger_gearman]"))
1205
long_options.add_options()
1176
1206
("auto-increment-increment", po::value<uint64_t>(&global_system_variables.auto_increment_increment)->default_value(1)->notifier(&check_limits_aii),
1177
1207
N_("Auto-increment columns are incremented by this"))
1178
1208
("auto-increment-offset", po::value<uint64_t>(&global_system_variables.auto_increment_offset)->default_value(1)->notifier(&check_limits_aio),
1281
1311
"automatically pick a reasonable value; if set to MAX_TABLES+2, the "
1282
1312
"optimizer will switch to the original find_best (used for "
1283
1313
"testing/comparison)."))
1284
("plugin-dir", po::value<string>(),
1285
N_("Directory for plugins."))
1286
("plugin-add", po::value<vector<string> >()->composing()->notifier(&compose_plugin_add),
1287
N_("Optional comma separated list of plugins to load at startup in addition "
1288
"to the default list of plugins. "
1289
"[for example: --plugin_add=crc32,logger_gearman]"))
1290
("plugin-remove", po::value<vector<string> >()->composing()->notifier(&compose_plugin_remove),
1291
N_("Optional comma separated list of plugins to not load at startup. Effectively "
1292
"removes a plugin from the list of plugins to be loaded. "
1293
"[for example: --plugin_remove=crc32,logger_gearman]"))
1294
("plugin-load", po::value<string>()->notifier(¬ify_plugin_load)->default_value(PANDORA_PLUGIN_LIST),
1295
N_("Optional comma separated list of plugins to load at starup instead of "
1296
"the default plugin load list. "
1297
"[for example: --plugin_load=crc32,logger_gearman]"))
1298
1314
("preload-buffer-size", po::value<uint64_t>(&global_system_variables.preload_buff_size)->default_value(32*1024L)->notifier(&check_limits_pbs),
1299
1315
N_("The size of the buffer that is allocated when preloading indexes"))
1300
1316
("query-alloc-block-size",
1334
1350
po::value<uint64_t>(&global_system_variables.tmp_table_size)->default_value(16*1024*1024L)->notifier(&check_limits_tmp_table_size),
1335
1351
N_("If an internal in-memory temporary table exceeds this size, Drizzle will"
1336
1352
" automatically convert it to an on-disk MyISAM table."))
1337
("no-defaults", po::value<bool>()->default_value(false)->zero_tokens(),
1338
N_("Configuration file defaults are not used if no-defaults is set"))
1339
("defaults-file", po::value<vector<string> >()->composing()->notifier(&compose_defaults_file_list),
1340
N_("Configuration file to use"))
1341
("config-dir", po::value<string>()->default_value(system_config_dir_drizzle),
1342
N_("Base location for config files"))
1355
full_options.add(long_options);
1356
full_options.add(plugin_load_options);
1358
initial_options.add(config_options);
1359
initial_options.add(plugin_load_options);
1361
/* Get options about where config files and the like are */
1345
1362
po::parsed_options parsed= po::command_line_parser(argc, argv).
1346
options(long_options).allow_unregistered().extra_parser(parse_size_arg).run();
1363
options(initial_options).allow_unregistered().extra_parser(parse_size_arg).run();
1347
1364
unknown_options=
1348
1365
po::collect_unrecognized(parsed.options, po::include_positional);
1391
1407
process_defaults_files();
1408
/* TODO: here is where we should add a process_env_vars */
1410
/* At this point, we've read all the options we need to read from files and
1411
collected most of them into unknown options - now let's load everything
1414
if (plugin_init(plugins, plugin_options))
1416
errmsg_printf(ERRMSG_LVL_ERROR, _("Failed to initialize plugins\n"));
1420
full_options.add(plugin_options);
1422
vector<string> final_unknown_options;
1425
po::parsed_options final_parsed=
1426
po::command_line_parser(unknown_options).
1427
options(full_options).extra_parser(parse_size_arg).run();
1429
final_unknown_options=
1430
po::collect_unrecognized(final_parsed.options, po::include_positional);
1432
po::store(final_parsed, vm);
1435
catch (po::invalid_command_line_syntax &err)
1437
errmsg_printf(ERRMSG_LVL_ERROR,
1439
"Use --help to get a list of available options\n"),
1440
internal::my_progname, err.what());
1443
catch (po::unknown_option &err)
1445
errmsg_printf(ERRMSG_LVL_ERROR,
1446
_("%s\nUse --help to get a list of available options\n"),
1396
1455
/* Inverted Booleans */
1398
1457
global_system_variables.optimizer_prune_level=
1495
1554
/* Allow storage engine to give real error messages */
1496
1555
ha_init_errors();
1498
if (plugin_init(plugins, plugin_options))
1500
errmsg_printf(ERRMSG_LVL_ERROR, _("Failed to initialize plugins\n"));
1505
1558
if (opt_help || opt_help_extended)
1506
1559
unireg_abort(0);
1508
vector<string> final_unknown_options;
1511
po::parsed_options parsed=
1512
po::command_line_parser(unknown_options).
1513
options(plugin_options).extra_parser(parse_size_arg).run();
1515
final_unknown_options=
1516
po::collect_unrecognized(parsed.options, po::include_positional);
1518
po::store(parsed, vm);
1521
catch (po::invalid_command_line_syntax &err)
1523
errmsg_printf(ERRMSG_LVL_ERROR,
1525
"Use --help to get a list of available options\n"),
1526
internal::my_progname, err.what());
1529
catch (po::unknown_option &err)
1531
errmsg_printf(ERRMSG_LVL_ERROR,
1532
_("%s\nUse --help to get a list of available options\n"),
1539
1561
plugin_finalize(plugins);
1541
1563
string scheduler_name;
2026
2048
printf(_("Usage: %s [OPTIONS]\n"), internal::my_progname);
2028
2050
po::options_description all_options("Drizzled Options");
2051
all_options.add(config_options);
2052
all_options.add(plugin_load_options);
2029
2053
all_options.add(long_options);
2030
2054
all_options.add(plugin_options);
2031
2055
cout << all_options << endl;