32
31
#include <stdexcept>
34
33
#include <boost/program_options.hpp>
35
#include <drizzled/program_options/config_file.h>
36
34
#include <boost/thread/recursive_mutex.hpp>
37
35
#include <boost/thread/mutex.hpp>
38
#include <boost/thread/shared_mutex.hpp>
39
36
#include <boost/thread/condition_variable.hpp>
40
37
#include <boost/filesystem.hpp>
41
#include <boost/detail/atomic_count.hpp>
43
#include <drizzled/cached_directory.h>
44
#include <drizzled/charset.h>
45
#include <drizzled/data_home.h>
46
#include <drizzled/debug.h>
47
#include <drizzled/definition/cache.h>
48
#include <drizzled/drizzled.h>
39
#include "drizzled/internal/my_sys.h"
40
#include "drizzled/internal/my_bit.h"
41
#include <drizzled/my_hash.h>
42
#include <drizzled/error.h>
49
43
#include <drizzled/errmsg_print.h>
50
#include <drizzled/error.h>
51
#include <drizzled/global_buffer.h>
52
#include <drizzled/internal/my_bit.h>
53
#include <drizzled/internal/my_sys.h>
44
#include <drizzled/tztime.h>
45
#include <drizzled/sql_base.h>
46
#include <drizzled/show.h>
47
#include <drizzled/sql_parse.h>
54
48
#include <drizzled/item/cmpfunc.h>
49
#include <drizzled/session.h>
55
50
#include <drizzled/item/create.h>
56
#include <drizzled/message/cache.h>
57
#include <drizzled/module/load_list.h>
58
#include <drizzled/module/registry.h>
59
#include <drizzled/my_hash.h>
60
#include <drizzled/plugin/client.h>
61
#include <drizzled/plugin/error_message.h>
62
#include <drizzled/plugin/event_observer.h>
63
#include <drizzled/plugin/listen.h>
64
#include <drizzled/plugin/monitored_in_transaction.h>
65
#include <drizzled/plugin/scheduler.h>
66
#include <drizzled/plugin/storage_engine.h>
67
#include <drizzled/plugin/xa_resource_manager.h>
68
#include <drizzled/probes.h>
69
#include <drizzled/replication_services.h> /* For ReplicationServices::evaluateRegisteredPlugins() */
70
#include <drizzled/session.h>
71
#include <drizzled/session/cache.h>
72
#include <drizzled/show.h>
73
#include <drizzled/sql_base.h>
74
#include <drizzled/sql_parse.h>
75
#include <drizzled/temporal_format.h> /* For init_temporal_formats() */
76
#include <drizzled/tztime.h>
77
51
#include <drizzled/unireg.h>
78
#include <plugin/myisam/myisam.h>
79
#include <drizzled/typelib.h>
80
#include <drizzled/visibility.h>
52
#include "drizzled/temporal_format.h" /* For init_temporal_formats() */
53
#include "drizzled/plugin/listen.h"
54
#include "drizzled/plugin/error_message.h"
55
#include "drizzled/plugin/client.h"
56
#include "drizzled/plugin/scheduler.h"
57
#include "drizzled/plugin/xa_resource_manager.h"
58
#include "drizzled/plugin/monitored_in_transaction.h"
59
#include "drizzled/replication_services.h" /* For ReplicationServices::evaluateRegisteredPlugins() */
60
#include "drizzled/probes.h"
61
#include "drizzled/session_list.h"
62
#include "drizzled/charset.h"
63
#include "plugin/myisam/myisam.h"
64
#include "drizzled/drizzled.h"
65
#include "drizzled/module/registry.h"
66
#include "drizzled/module/load_list.h"
82
68
#include <google/protobuf/stubs/common.h>
84
#include <drizzled/refresh_version.h>
86
70
#if TIME_WITH_SYS_TIME
87
71
# include <sys/time.h>
666
682
static void find_plugin_dir(string progname)
668
fs::path full_progname(fs::system_complete(progname));
670
fs::path progdir(full_progname.parent_path());
671
if (progdir.filename() == ".libs")
673
progdir= progdir.parent_path();
676
if (fs::exists(progdir / "drizzled.lo") || fs::exists(progdir / "drizzled.o"))
684
if (progname[0] != FN_LIBCHAR)
686
/* We have a relative path and need to find the absolute */
687
char working_dir[FN_REFLEN];
688
char *working_dir_ptr= working_dir;
689
working_dir_ptr= getcwd(working_dir_ptr, FN_REFLEN);
690
string new_path(working_dir);
691
if (*(new_path.end()-1) != '/')
692
new_path.push_back('/');
693
if (progname[0] == '.' && progname[1] == '/')
694
new_path.append(progname.substr(2));
696
new_path.append(progname);
697
progname.swap(new_path);
700
/* Now, trim off the exe name */
701
string progdir(progname.substr(0, progname.rfind(FN_LIBCHAR)+1));
702
if (progdir.rfind(".libs/") != string::npos)
704
progdir.assign(progdir.substr(0, progdir.rfind(".libs/")));
706
string testlofile(progdir);
707
testlofile.append("drizzled.lo");
708
string testofile(progdir);
709
testofile.append("drizzled.o");
710
struct stat testfile_stat;
711
if (not (stat(testlofile.c_str(), &testfile_stat) && stat(testofile.c_str(), &testfile_stat)))
678
713
/* We are in a source dir! Plugin dir is ../plugin/.libs */
679
base_plugin_dir= progdir.parent_path();
714
size_t last_libchar_pos= progdir.rfind(FN_LIBCHAR,progdir.size()-2)+1;
715
base_plugin_dir= progdir.substr(0,last_libchar_pos);
680
716
base_plugin_dir /= "plugin";
681
717
base_plugin_dir /= ".libs";
684
if (plugin_dir.root_directory() == "")
686
fs::path full_plugin_dir(fs::system_complete(base_plugin_dir));
687
full_plugin_dir /= plugin_dir;
688
plugin_dir= full_plugin_dir;
692
static void notify_plugin_dir(fs::path in_plugin_dir)
694
plugin_dir= in_plugin_dir;
695
if (plugin_dir.root_directory() == "")
697
fs::path full_plugin_dir(fs::system_complete(basedir));
698
full_plugin_dir /= plugin_dir;
699
plugin_dir= full_plugin_dir;
703
static void expand_secure_file_priv(fs::path in_secure_file_priv)
705
secure_file_priv= fs::system_complete(in_secure_file_priv);
719
(void) internal::my_load_path(opt_plugin_dir, fs::path(fs::system_complete(base_plugin_dir)).file_string().c_str(), "");
722
static void notify_plugin_dir(string in_plugin_dir)
724
if (not in_plugin_dir.empty())
726
(void) internal::my_load_path(opt_plugin_dir, in_plugin_dir.c_str(), drizzle_home);
708
730
static void check_limits_aii(uint64_t in_auto_increment_increment)
1101
1207
global_system_variables.time_zone= my_tz_SYSTEM;
1103
char ret_hostname[FN_REFLEN];
1104
if (gethostname(ret_hostname,sizeof(ret_hostname)) < 0)
1209
if (gethostname(glob_hostname,sizeof(glob_hostname)) < 0)
1106
errmsg_printf(error::WARN,
1107
_("gethostname failed, using '%s' as hostname"),
1108
getServerHostname().c_str());
1109
pid_file= "drizzle";
1211
strncpy(glob_hostname, STRING_WITH_LEN("localhost"));
1212
errmsg_printf(ERRMSG_LVL_WARN, _("gethostname failed, using '%s' as hostname"),
1214
strncpy(pidfile_name, STRING_WITH_LEN("drizzle"));
1113
setServerHostname(ret_hostname);
1114
pid_file= getServerHostname();
1116
pid_file.replace_extension(".pid");
1118
system_config_dir /= "drizzle";
1217
strncpy(pidfile_name, glob_hostname, sizeof(pidfile_name)-5);
1218
strcpy(internal::fn_ext(pidfile_name),".pid"); // Add proper extension
1220
std::string system_config_dir_drizzle(SYSCONFDIR);
1221
system_config_dir_drizzle.append("/drizzle");
1223
std::string system_config_file_drizzle("drizzled.cnf");
1120
1225
config_options.add_options()
1121
1226
("help,?", po::value<bool>(&opt_help)->default_value(false)->zero_tokens(),
1122
_("Display this help and exit."))
1123
("daemon,d", po::value<bool>(&opt_daemon)->default_value(false)->zero_tokens(),
1124
_("Run as a daemon."))
1227
N_("Display this help and exit."))
1125
1228
("no-defaults", po::value<bool>()->default_value(false)->zero_tokens(),
1126
_("Configuration file defaults are not used if no-defaults is set"))
1229
N_("Configuration file defaults are not used if no-defaults is set"))
1127
1230
("defaults-file", po::value<vector<string> >()->composing()->notifier(&compose_defaults_file_list),
1128
_("Configuration file to use"))
1129
("config-dir", po::value<fs::path>(&system_config_dir),
1130
_("Base location for config files"))
1131
("plugin-dir", po::value<fs::path>(&plugin_dir)->notifier(¬ify_plugin_dir),
1132
_("Directory for plugins."))
1231
N_("Configuration file to use"))
1232
("config-dir", po::value<string>()->default_value(system_config_dir_drizzle),
1233
N_("Base location for config files"))
1234
("plugin-dir", po::value<string>()->notifier(¬ify_plugin_dir),
1235
N_("Directory for plugins."))
1135
1238
plugin_load_options.add_options()
1136
1239
("plugin-add", po::value<vector<string> >()->composing()->notifier(&compose_plugin_add),
1137
_("Optional comma separated list of plugins to load at startup in addition "
1240
N_("Optional comma separated list of plugins to load at startup in addition "
1138
1241
"to the default list of plugins. "
1139
1242
"[for example: --plugin_add=crc32,logger_gearman]"))
1140
1243
("plugin-remove", po::value<vector<string> >()->composing()->notifier(&compose_plugin_remove),
1141
_("Optional comma separated list of plugins to not load at startup. Effectively "
1244
N_("Optional comma separated list of plugins to not load at startup. Effectively "
1142
1245
"removes a plugin from the list of plugins to be loaded. "
1143
1246
"[for example: --plugin_remove=crc32,logger_gearman]"))
1144
1247
("plugin-load", po::value<string>()->notifier(¬ify_plugin_load)->default_value(PANDORA_PLUGIN_LIST),
1145
_("Optional comma separated list of plugins to load at starup instead of "
1248
N_("Optional comma separated list of plugins to load at starup instead of "
1146
1249
"the default plugin load list. "
1147
1250
"[for example: --plugin_load=crc32,logger_gearman]"))
1150
1253
long_options.add_options()
1151
1254
("auto-increment-increment", po::value<uint64_t>(&global_system_variables.auto_increment_increment)->default_value(1)->notifier(&check_limits_aii),
1152
_("Auto-increment columns are incremented by this"))
1255
N_("Auto-increment columns are incremented by this"))
1153
1256
("auto-increment-offset", po::value<uint64_t>(&global_system_variables.auto_increment_offset)->default_value(1)->notifier(&check_limits_aio),
1154
_("Offset added to Auto-increment columns. Used when auto-increment-increment != 1"))
1155
("basedir,b", po::value<fs::path>(&basedir),
1156
_("Path to installation directory. All paths are usually resolved "
1257
N_("Offset added to Auto-increment columns. Used when auto-increment-increment != 1"))
1258
("basedir,b", po::value<string>(),
1259
N_("Path to installation directory. All paths are usually resolved "
1157
1260
"relative to this."))
1158
1261
("chroot,r", po::value<string>(),
1159
_("Chroot drizzled daemon during startup."))
1262
N_("Chroot drizzled daemon during startup."))
1160
1263
("collation-server", po::value<string>(),
1161
_("Set the default collation."))
1264
N_("Set the default collation."))
1162
1265
("completion-type", po::value<uint32_t>(&global_system_variables.completion_type)->default_value(0)->notifier(&check_limits_completion_type),
1163
_("Default completion type."))
1164
("core-file", _("Write core on errors."))
1165
("datadir", po::value<fs::path>(&getDataHome()),
1166
_("Path to the database root."))
1266
N_("Default completion type."))
1267
("core-file", N_("Write core on errors."))
1268
("datadir", po::value<string>(),
1269
N_("Path to the database root."))
1167
1270
("default-storage-engine", po::value<string>(),
1168
_("Set the default storage engine for tables."))
1271
N_("Set the default storage engine for tables."))
1169
1272
("default-time-zone", po::value<string>(),
1170
_("Set the default time zone."))
1273
N_("Set the default time zone."))
1171
1274
("exit-info,T", po::value<long>(),
1172
_("Used for debugging; Use at your own risk!"))
1275
N_("Used for debugging; Use at your own risk!"))
1173
1276
("gdb", po::value<bool>(&opt_debugging)->default_value(false)->zero_tokens(),
1174
_("Set up signals usable for debugging"))
1277
N_("Set up signals usable for debugging"))
1175
1278
("lc-time-name", po::value<string>(),
1176
_("Set the language used for the month names and the days of the week."))
1177
("log-warnings,W", po::value<bool>(&global_system_variables.log_warnings)->default_value(false)->zero_tokens(),
1178
_("Log some not critical warnings to the log file."))
1179
("pid-file", po::value<fs::path>(&pid_file),
1180
_("Pid file used by drizzled."))
1279
N_("Set the language used for the month names and the days of the week."))
1280
("log-warnings,W", po::value<string>(),
1281
N_("Log some not critical warnings to the log file."))
1282
("pid-file", po::value<string>(),
1283
N_("Pid file used by drizzled."))
1181
1284
("port-open-timeout", po::value<uint32_t>(&drizzled_bind_timeout)->default_value(0),
1182
_("Maximum time in seconds to wait for the port to become free. "))
1183
("replicate-query", po::value<bool>(&global_system_variables.replicate_query)->default_value(false)->zero_tokens(),
1184
_("Include the SQL query in replicated protobuf messages."))
1185
("secure-file-priv", po::value<fs::path>(&secure_file_priv)->notifier(expand_secure_file_priv),
1186
_("Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files "
1285
N_("Maximum time in seconds to wait for the port to become free. "))
1286
("secure-file-priv", po::value<string>(),
1287
N_("Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files "
1187
1288
"within specified directory"))
1188
1289
("server-id", po::value<uint32_t>(&server_id)->default_value(0),
1189
_("Uniquely identifies the server instance in the community of "
1290
N_("Uniquely identifies the server instance in the community of "
1190
1291
"replication partners."))
1191
1292
("skip-stack-trace",
1192
_("Don't print a stack trace on failure."))
1293
N_("Don't print a stack trace on failure."))
1193
1294
("symbolic-links,s", po::value<bool>(&internal::my_use_symdir)->default_value(IF_PURIFY(false,true))->zero_tokens(),
1194
_("Enable symbolic link support."))
1295
N_("Enable symbolic link support."))
1195
1296
("timed-mutexes", po::value<bool>(&internal::timed_mutexes)->default_value(false)->zero_tokens(),
1196
_("Specify whether to time mutexes (only InnoDB mutexes are currently "
1297
N_("Specify whether to time mutexes (only InnoDB mutexes are currently "
1198
1299
("tmpdir,t", po::value<string>(),
1199
_("Path for temporary files."))
1300
N_("Path for temporary files."))
1200
1301
("transaction-isolation", po::value<string>(),
1201
_("Default transaction isolation level."))
1202
("transaction-message-threshold", po::value<size_t>(&transaction_message_threshold)->default_value(1024*1024)->notifier(&check_limits_transaction_message_threshold),
1203
_("Max message size written to transaction log, valid values 131072 - 1048576 bytes."))
1302
N_("Default transaction isolation level."))
1204
1303
("user,u", po::value<string>(),
1205
_("Run drizzled daemon as user."))
1304
N_("Run drizzled daemon as user."))
1207
_("Output version information and exit."))
1208
("back-log", po::value<back_log_constraints>(&back_log),
1209
_("The number of outstanding connection requests Drizzle can have. This "
1306
N_("Output version information and exit."))
1307
("back-log", po::value<uint32_t>(&back_log)->default_value(50)->notifier(&check_limits_back_log),
1308
N_("The number of outstanding connection requests Drizzle can have. This "
1210
1309
"comes into play when the main Drizzle thread gets very many connection "
1211
1310
"requests in a very short time."))
1212
1311
("bulk-insert-buffer-size",
1213
1312
po::value<uint64_t>(&global_system_variables.bulk_insert_buff_size)->default_value(8192*1024),
1214
_("Size of tree cache used in bulk insert optimization. Note that this is "
1313
N_("Size of tree cache used in bulk insert optimization. Note that this is "
1215
1314
"a limit per thread!"))
1216
1315
("div-precision-increment", po::value<uint32_t>(&global_system_variables.div_precincrement)->default_value(4)->notifier(&check_limits_dpi),
1217
_("Precision of the result of '/' operator will be increased on that "
1316
N_("Precision of the result of '/' operator will be increased on that "
1219
1318
("group-concat-max-len", po::value<uint64_t>(&global_system_variables.group_concat_max_len)->default_value(1024)->notifier(&check_limits_gcml),
1220
_("The maximum length of the result of function group_concat."))
1319
N_("The maximum length of the result of function group_concat."))
1221
1320
("join-buffer-size", po::value<uint64_t>(&global_system_variables.join_buff_size)->default_value(128*1024L)->notifier(&check_limits_join_buffer_size),
1222
_("The size of the buffer that is used for full joins."))
1223
("join-heap-threshold",
1224
po::value<uint64_t>()->default_value(0),
1225
_("A global cap on the amount of memory that can be allocated by session join buffers (0 means unlimited)"))
1226
("max-allowed-packet", po::value<uint32_t>(&global_system_variables.max_allowed_packet)->default_value(64*1024*1024L)->notifier(&check_limits_map),
1227
_("Max packetlength to send/receive from to server."))
1321
N_("The size of the buffer that is used for full joins."))
1322
("max-allowed-packet", po::value<uint32_t>(&global_system_variables.max_allowed_packet)->default_value(1024*1024L)->notifier(&check_limits_map),
1323
N_("Max packetlength to send/receive from to server."))
1324
("max-connect-errors", po::value<uint64_t>(&max_connect_errors)->default_value(MAX_CONNECT_ERRORS)->notifier(&check_limits_mce),
1325
N_("If there is more than this number of interrupted connections from a "
1326
"host this host will be blocked from further connections."))
1228
1327
("max-error-count", po::value<uint64_t>(&global_system_variables.max_error_count)->default_value(DEFAULT_ERROR_COUNT)->notifier(&check_limits_max_err_cnt),
1229
_("Max number of errors/warnings to store for a statement."))
1328
N_("Max number of errors/warnings to store for a statement."))
1230
1329
("max-heap-table-size", po::value<uint64_t>(&global_system_variables.max_heap_table_size)->default_value(16*1024*1024L)->notifier(&check_limits_mhts),
1231
_("Don't allow creation of heap tables bigger than this."))
1330
N_("Don't allow creation of heap tables bigger than this."))
1232
1331
("max-join-size", po::value<drizzled::ha_rows>(&global_system_variables.max_join_size)->default_value(INT32_MAX)->notifier(&check_limits_max_join_size),
1233
_("Joins that are probably going to read more than max_join_size records "
1332
N_("Joins that are probably going to read more than max_join_size records "
1234
1333
"return an error."))
1235
1334
("max-length-for-sort-data", po::value<uint64_t>(&global_system_variables.max_length_for_sort_data)->default_value(1024)->notifier(&check_limits_mlfsd),
1236
_("Max number of bytes in sorted records."))
1335
N_("Max number of bytes in sorted records."))
1237
1336
("max-seeks-for-key", po::value<uint64_t>(&global_system_variables.max_seeks_for_key)->default_value(ULONG_MAX)->notifier(&check_limits_msfk),
1238
_("Limit assumed max number of seeks when looking up rows based on a key"))
1337
N_("Limit assumed max number of seeks when looking up rows based on a key"))
1239
1338
("max-sort-length", po::value<size_t>(&global_system_variables.max_sort_length)->default_value(1024)->notifier(&check_limits_max_sort_length),
1240
_("The number of bytes to use when sorting BLOB or TEXT values "
1339
N_("The number of bytes to use when sorting BLOB or TEXT values "
1241
1340
"(only the first max_sort_length bytes of each value are used; the "
1242
1341
"rest are ignored)."))
1243
("max-write-lock-count", po::value<uint64_t>(&max_write_lock_count)->default_value(UINT64_MAX),
1244
_("After this many write locks, allow some read locks to run in between."))
1342
("max-write-lock-count", po::value<uint64_t>(&max_write_lock_count)->default_value(ULONG_MAX)->notifier(&check_limits_mwlc),
1343
N_("After this many write locks, allow some read locks to run in between."))
1245
1344
("min-examined-row-limit", po::value<uint64_t>(&global_system_variables.min_examined_row_limit)->default_value(0)->notifier(&check_limits_merl),
1246
_("Don't log queries which examine less than min_examined_row_limit "
1345
N_("Don't log queries which examine less than min_examined_row_limit "
1247
1346
"rows to file."))
1248
1347
("disable-optimizer-prune",
1249
_("Do not apply any heuristic(s) during query optimization to prune, "
1348
N_("Do not apply any heuristic(s) during query optimization to prune, "
1250
1349
"thus perform an exhaustive search from the optimizer search space."))
1251
1350
("optimizer-search-depth", po::value<uint32_t>(&global_system_variables.optimizer_search_depth)->default_value(0)->notifier(&check_limits_osd),
1252
_("Maximum depth of search performed by the query optimizer. Values "
1351
N_("Maximum depth of search performed by the query optimizer. Values "
1253
1352
"larger than the number of relations in a query result in better query "
1254
1353
"plans, but take longer to compile a query. Smaller values than the "
1255
1354
"number of tables in a relation result in faster optimization, but may "
1258
1357
"optimizer will switch to the original find_best (used for "
1259
1358
"testing/comparison)."))
1260
1359
("preload-buffer-size", po::value<uint64_t>(&global_system_variables.preload_buff_size)->default_value(32*1024L)->notifier(&check_limits_pbs),
1261
_("The size of the buffer that is allocated when preloading indexes"))
1360
N_("The size of the buffer that is allocated when preloading indexes"))
1262
1361
("query-alloc-block-size",
1263
1362
po::value<uint32_t>(&global_system_variables.query_alloc_block_size)->default_value(QUERY_ALLOC_BLOCK_SIZE)->notifier(&check_limits_qabs),
1264
_("Allocation block size for query parsing and execution"))
1363
N_("Allocation block size for query parsing and execution"))
1265
1364
("query-prealloc-size",
1266
1365
po::value<uint32_t>(&global_system_variables.query_prealloc_size)->default_value(QUERY_ALLOC_PREALLOC_SIZE)->notifier(&check_limits_qps),
1267
_("Persistent buffer for query parsing and execution"))
1366
N_("Persistent buffer for query parsing and execution"))
1268
1367
("range-alloc-block-size",
1269
1368
po::value<size_t>(&global_system_variables.range_alloc_block_size)->default_value(RANGE_ALLOC_BLOCK_SIZE)->notifier(&check_limits_rabs),
1270
_("Allocation block size for storing ranges during optimization"))
1369
N_("Allocation block size for storing ranges during optimization"))
1271
1370
("read-buffer-size",
1272
1371
po::value<uint32_t>(&global_system_variables.read_buff_size)->default_value(128*1024L)->notifier(&check_limits_read_buffer_size),
1273
_("Each thread that does a sequential scan allocates a buffer of this "
1372
N_("Each thread that does a sequential scan allocates a buffer of this "
1274
1373
"size for each table it scans. If you do many sequential scans, you may "
1275
1374
"want to increase this value."))
1276
("read-buffer-threshold",
1277
po::value<uint64_t>()->default_value(0),
1278
_("A global cap on the size of read-buffer-size (0 means unlimited)"))
1279
1375
("read-rnd-buffer-size",
1280
1376
po::value<uint32_t>(&global_system_variables.read_rnd_buff_size)->default_value(256*1024L)->notifier(&check_limits_read_rnd_buffer_size),
1281
_("When reading rows in sorted order after a sort, the rows are read "
1377
N_("When reading rows in sorted order after a sort, the rows are read "
1282
1378
"through this buffer to avoid a disk seeks. If not set, then it's set "
1283
1379
"to the value of record_buffer."))
1284
("read-rnd-threshold",
1285
po::value<uint64_t>()->default_value(0),
1286
_("A global cap on the size of read-rnd-buffer-size (0 means unlimited)"))
1287
1380
("scheduler", po::value<string>(),
1288
_("Select scheduler to be used (by default multi-thread)."))
1381
N_("Select scheduler to be used (by default multi-thread)."))
1289
1382
("sort-buffer-size",
1290
1383
po::value<size_t>(&global_system_variables.sortbuff_size)->default_value(MAX_SORT_MEMORY)->notifier(&check_limits_sort_buffer_size),
1291
_("Each thread that needs to do a sort allocates a buffer of this size."))
1292
("sort-heap-threshold",
1293
po::value<uint64_t>()->default_value(0),
1294
_("A global cap on the amount of memory that can be allocated by session sort buffers (0 means unlimited)"))
1384
N_("Each thread that needs to do a sort allocates a buffer of this size."))
1295
1385
("table-definition-cache", po::value<size_t>(&table_def_size)->default_value(128)->notifier(&check_limits_tdc),
1296
_("The number of cached table definitions."))
1386
N_("The number of cached table definitions."))
1297
1387
("table-open-cache", po::value<uint64_t>(&table_cache_size)->default_value(TABLE_OPEN_CACHE_DEFAULT)->notifier(&check_limits_toc),
1298
_("The number of cached open tables."))
1388
N_("The number of cached open tables."))
1299
1389
("table-lock-wait-timeout", po::value<uint64_t>(&table_lock_wait_timeout)->default_value(50)->notifier(&check_limits_tlwt),
1300
_("Timeout in seconds to wait for a table level lock before returning an "
1390
N_("Timeout in seconds to wait for a table level lock before returning an "
1301
1391
"error. Used only if the connection has active cursors."))
1302
1392
("thread-stack", po::value<size_t>(&my_thread_stack_size)->default_value(DEFAULT_THREAD_STACK)->notifier(&check_limits_thread_stack),
1303
_("The stack size for each thread."))
1393
N_("The stack size for each thread."))
1304
1394
("tmp-table-size",
1305
1395
po::value<uint64_t>(&global_system_variables.tmp_table_size)->default_value(16*1024*1024L)->notifier(&check_limits_tmp_table_size),
1306
_("If an internal in-memory temporary table exceeds this size, Drizzle will"
1396
N_("If an internal in-memory temporary table exceeds this size, Drizzle will"
1307
1397
" automatically convert it to an on-disk MyISAM table."))
1308
("verbose", po::value<std::string>()->default_value(error::verbose_string())->notifier(&error::check_verbosity),
1309
_("The stack size for each thread."))
1312
1400
full_options.add(long_options);
1327
1415
po::store(parsed, vm);
1329
catch (std::exception&)
1331
errmsg_printf(error::ERROR, _("Duplicate entry for command line option\n"));
1419
errmsg_printf(ERRMSG_LVL_ERROR, _("Duplicate entry for command line option\n"));
1332
1420
unireg_abort(1);
1335
1423
if (not vm["no-defaults"].as<bool>())
1337
fs::path system_config_file_drizzle(system_config_dir);
1338
system_config_file_drizzle /= "drizzled.cnf";
1339
1425
defaults_file_list.insert(defaults_file_list.begin(),
1340
system_config_file_drizzle.file_string());
1342
fs::path config_conf_d_location(system_config_dir);
1343
config_conf_d_location /= "conf.d";
1346
CachedDirectory config_conf_d(config_conf_d_location.file_string());
1347
if (not config_conf_d.fail())
1426
system_config_file_drizzle);
1429
string config_conf_d_location(vm["config-dir"].as<string>());
1430
config_conf_d_location.append("/conf.d");
1431
CachedDirectory config_conf_d(config_conf_d_location);
1432
if (not config_conf_d.fail())
1435
for (CachedDirectory::Entries::const_iterator iter= config_conf_d.getEntries().begin();
1436
iter != config_conf_d.getEntries().end();
1350
for (CachedDirectory::Entries::const_iterator iter= config_conf_d.getEntries().begin();
1351
iter != config_conf_d.getEntries().end();
1439
string file_entry((*iter)->filename);
1441
if (not file_entry.empty()
1442
&& file_entry != "."
1443
&& file_entry != "..")
1354
string file_entry((*iter)->filename);
1356
if (not file_entry.empty()
1357
&& file_entry != "."
1358
&& file_entry != "..")
1360
fs::path the_entry(config_conf_d_location);
1361
the_entry /= file_entry;
1362
defaults_file_list.push_back(the_entry.file_string());
1445
string the_entry(config_conf_d_location);
1446
the_entry.push_back('/');
1447
the_entry.append(file_entry);
1448
defaults_file_list.push_back(the_entry);
1453
process_defaults_files();
1368
1454
/* TODO: here is where we should add a process_env_vars */
1370
1456
/* We need a notify here so that plugin_init will work properly */
1375
catch (po::validation_error &err)
1377
errmsg_printf(error::ERROR,
1379
"Use --help to get a list of available options\n"),
1380
internal::my_progname, err.what());
1384
process_defaults_files();
1386
/* Process with notify a second time because a config file may contain
1387
plugin loader options */
1393
catch (po::validation_error &err)
1395
errmsg_printf(error::ERROR,
1397
"Use --help to get a list of available options\n"),
1398
internal::my_progname, err.what());
1405
int init_remaining_variables(module::Registry &plugins)
1407
int style = po::command_line_style::default_style & ~po::command_line_style::allow_guessing;
1409
current_pid= getpid(); /* Save for later ref */
1411
1458
/* At this point, we've read all the options we need to read from files and
1412
1459
collected most of them into unknown options - now let's load everything
1415
1462
if (plugin_init(plugins, plugin_options))
1417
errmsg_printf(error::ERROR, _("Failed to initialize plugins\n"));
1464
errmsg_printf(ERRMSG_LVL_ERROR, _("Failed to initialize plugins\n"));
1418
1465
unireg_abort(1);