~drizzle-trunk/drizzle/development

520.4.14 by Monty Taylor
Removed korr.h and tztime.h from common_includes. Also removed the HAVE_DTRACE block and stuck it in autoconf.
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
1999.6.1 by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
520.4.14 by Monty Taylor
Removed korr.h and tztime.h from common_includes. Also removed the HAVE_DTRACE block and stuck it in autoconf.
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; version 2 of the License.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU General Public License
16
 *  along with this program; if not, write to the Free Software
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 */
19
2173.2.1 by Monty Taylor
Fixes incorrect usage of include
20
#include <config.h>
2154.2.5 by Brian Aker
Fix the include list in drizzled.cc (just sorted, and included correctly).
21
22
#include <drizzled/configmake.h>
23
#include <drizzled/atomics.h>
24
#include <drizzled/data_home.h>
520.6.2 by Monty Taylor
Removed netdb.h from common_includes. Check it out - it was only used in ***2*** files. _Definitely_ a common include.
25
26
#include <netdb.h>
1241.9.47 by Monty Taylor
Add sys/types.cc to drizzled to fix freebsd.
27
#include <sys/types.h>
520.6.2 by Monty Taylor
Removed netdb.h from common_includes. Check it out - it was only used in ***2*** files. _Definitely_ a common include.
28
#include <netinet/tcp.h>
1208.1.1 by Monty Taylor
Fixed FreeBSD build issues.
29
#include <netinet/in.h>
520.6.5 by Monty Taylor
Removed signal.h from common_includes.
30
#include <signal.h>
1241.9.59 by Monty Taylor
Removed the first mystrings header.
31
#include <limits.h>
1666.4.18 by Monty Taylor
Added parsing of size suffixes.
32
#include <stdexcept>
520.6.2 by Monty Taylor
Removed netdb.h from common_includes. Check it out - it was only used in ***2*** files. _Definitely_ a common include.
33
1633.1.1 by Monty Taylor
Added in support for program_options output in --help output.
34
#include <boost/program_options.hpp>
2154.2.5 by Brian Aker
Fix the include list in drizzled.cc (just sorted, and included correctly).
35
#include <drizzled/program_options/config_file.h>
1689.2.1 by Brian Aker
Convert LOCK_global_system_variables to boost.
36
#include <boost/thread/recursive_mutex.hpp>
37
#include <boost/thread/mutex.hpp>
1812.3.7 by Brian Aker
Typdef our lock type.
38
#include <boost/thread/shared_mutex.hpp>
1689.2.3 by Brian Aker
Convert COND_refresh.
39
#include <boost/thread/condition_variable.hpp>
1794.3.5 by Monty Taylor
Fixed temporoary dir sequencing.
40
#include <boost/filesystem.hpp>
2039.3.5 by Brian Aker
Switched connection_count to use boost atomic.
41
#include <boost/detail/atomic_count.hpp>
1633.1.1 by Monty Taylor
Added in support for program_options output in --help output.
42
2154.2.5 by Brian Aker
Fix the include list in drizzled.cc (just sorted, and included correctly).
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>
49
#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>
54
#include <drizzled/item/cmpfunc.h>
55
#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/plugin/client.h>
60
#include <drizzled/plugin/error_message.h>
61
#include <drizzled/plugin/event_observer.h>
62
#include <drizzled/plugin/listen.h>
63
#include <drizzled/plugin/monitored_in_transaction.h>
64
#include <drizzled/plugin/scheduler.h>
65
#include <drizzled/plugin/storage_engine.h>
66
#include <drizzled/plugin/xa_resource_manager.h>
67
#include <drizzled/probes.h>
68
#include <drizzled/replication_services.h> /* For ReplicationServices::evaluateRegisteredPlugins() */
69
#include <drizzled/session.h>
70
#include <drizzled/session/cache.h>
71
#include <drizzled/show.h>
575.4.7 by Monty Taylor
More header cleanup.
72
#include <drizzled/sql_base.h>
73
#include <drizzled/sql_parse.h>
2241.3.1 by Olaf van der Spek
Refactor Session::status_var
74
#include <drizzled/statistics_variables.h>
2272.1.1 by Olaf van der Spek
Refactor includes
75
#include <drizzled/table/cache.h>
2154.2.5 by Brian Aker
Fix the include list in drizzled.cc (just sorted, and included correctly).
76
#include <drizzled/temporal_format.h> /* For init_temporal_formats() */
670.2.4 by Monty Taylor
Removed more stuff from the headers.
77
#include <drizzled/unireg.h>
2154.2.5 by Brian Aker
Fix the include list in drizzled.cc (just sorted, and included correctly).
78
#include <plugin/myisam/myisam.h>
2151.5.9 by Olaf van der Spek
merge trunk
79
#include <drizzled/typelib.h>
2173.2.1 by Monty Taylor
Fixes incorrect usage of include
80
#include <drizzled/visibility.h>
2241.3.2 by Olaf van der Spek
Refactor Session::variables
81
#include <drizzled/system_variables.h>
2263.3.11 by Olaf van der Spek
Open Tables
82
#include <drizzled/open_tables_state.h>
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
83
1089.1.3 by Brian Aker
Fix protobuf to release memory. Add in assert() for wrong column usage. Fix
84
#include <google/protobuf/stubs/common.h>
85
481.1.15 by Monty Taylor
Removed time.h and sys/time.h from global.h.
86
#if TIME_WITH_SYS_TIME
87
# include <sys/time.h>
88
# include <time.h>
89
#else
90
# if HAVE_SYS_TIME_H
91
#  include <sys/time.h>
92
# else
93
#  include <time.h>
94
# endif
95
#endif
96
1 by brian
clean slate
97
#ifdef HAVE_SYS_PRCTL_H
98
#include <sys/prctl.h>
99
#endif
1241.9.1 by Monty Taylor
Removed global.h. Fixed all the headers.
100
#include <sys/socket.h>
1 by brian
clean slate
101
102
103
#include <errno.h>
104
#include <sys/stat.h>
2173.2.1 by Monty Taylor
Fixes incorrect usage of include
105
#include <drizzled/option.h>
1 by brian
clean slate
106
#ifdef HAVE_SYSENT_H
107
#include <sysent.h>
108
#endif
109
#include <pwd.h>				// For getpwent
110
#include <grp.h>
111
112
#ifdef HAVE_SELECT_H
113
#  include <select.h>
114
#endif
115
116
#ifdef HAVE_SYS_SELECT_H
117
#include <sys/select.h>
118
#endif
119
120
#include <sys/utsname.h>
121
122
#ifdef HAVE_SYS_MMAN_H
123
#include <sys/mman.h>
124
#endif
125
126
#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H)
127
#include <ieeefp.h>
128
#endif /* __FreeBSD__ && HAVE_IEEEFP_H */
129
130
#ifdef HAVE_FPU_CONTROL_H
131
#include <fpu_control.h>
132
#endif
133
134
#ifdef HAVE_SYS_FPU_H
135
/* for IRIX to use set_fpc_csr() */
136
#include <sys/fpu.h>
137
#endif
138
2173.2.1 by Monty Taylor
Fixes incorrect usage of include
139
#include <drizzled/internal/my_pthread.h>			// For thr_setconcurency()
140
#include <drizzled/constrained_value.h>
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
141
142
#include <drizzled/gettext.h>
143
144
1859.2.14 by Brian Aker
Add support for --with-valgrind
145
#ifdef HAVE_VALGRIND
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
146
#define IF_PURIFY(A,B) (A)
147
#else
148
#define IF_PURIFY(A,B) (B)
149
#endif
150
151
#define MAX_MEM_TABLE_SIZE SIZE_MAX
1757.2.4 by Monty Taylor
Next step.
152
#include <iostream>
153
#include <fstream>
154
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
155
156
using namespace std;
1794.3.5 by Monty Taylor
Fixed temporoary dir sequencing.
157
namespace fs=boost::filesystem;
1633.1.1 by Monty Taylor
Added in support for program_options output in --help output.
158
namespace po=boost::program_options;
1815.1.1 by Monty Taylor
Embed a modified version of parse_config_file. There are several more bugs
159
namespace dpo=drizzled::program_options;
1633.1.1 by Monty Taylor
Added in support for program_options output in --help output.
160
2131.10.1 by Stewart Smith
add a very simple --daemon or -d option to drizzled using the exact same code as memcached to start as a daemon.
161
bool opt_daemon= false;
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
162
2318.2.3 by Olaf van der Spek
Refactor
163
namespace drizzled {
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
164
1 by brian
clean slate
165
inline void setup_fpu()
166
{
167
#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H)
168
  /*
169
     We can't handle floating point exceptions with threads, so disable
170
     this on freebsd.
171
     Don't fall for overflow, underflow,divide-by-zero or loss of precision
172
  */
173
#if defined(__i386__)
174
  fpsetmask(~(FP_X_INV | FP_X_DNML | FP_X_OFL | FP_X_UFL | FP_X_DZ |
175
	      FP_X_IMP));
176
#else
177
  fpsetmask(~(FP_X_INV |             FP_X_OFL | FP_X_UFL | FP_X_DZ |
178
              FP_X_IMP));
179
#endif /* __i386__ */
180
#endif /* __FreeBSD__ && HAVE_IEEEFP_H */
181
182
  /*
183
    x86 (32-bit) requires FPU precision to be explicitly set to 64 bit for
184
    portable results of floating point operations
185
  */
186
#if defined(__i386__) && defined(HAVE_FPU_CONTROL_H) && defined(_FPU_DOUBLE)
187
  fpu_control_t cw;
188
  _FPU_GETCW(cw);
189
  cw= (cw & ~_FPU_EXTENDED) | _FPU_DOUBLE;
190
  _FPU_SETCW(cw);
191
#endif /* __i386__ && HAVE_FPU_CONTROL_H && _FPU_DOUBLE */
192
}
193
194
#ifdef SOLARIS
195
extern "C" int gethostname(char *name, int namelen);
196
#endif
197
1089.9.1 by Jay Pipes
Removes a bunch of dead code and unused variables in drizzled.cc and server_includes.h
198
const char *first_keyword= "first";
722.1.3 by Monty Taylor
Cleaned up a few build things.
199
const char * const DRIZZLE_CONFIG_NAME= "drizzled";
1776.4.1 by Monty Taylor
Migrates the creation of the plugin lists to have program_options directly
200
1 by brian
clean slate
201
#define GET_HA_ROWS GET_ULL
202
2318.2.3 by Olaf van der Spek
Refactor
203
const char *tx_isolation_names[] = {"READ-UNCOMMITTED", "READ-COMMITTED", "REPEATABLE-READ", "SERIALIZABLE", NULL};
1241.9.57 by Monty Taylor
Oy. Bigger change than I normally like - but this stuff is all intertwined.
204
2318.2.3 by Olaf van der Spek
Refactor
205
TYPELIB tx_isolation_typelib= {array_elements(tx_isolation_names) - 1, "", tx_isolation_names, NULL};
1241.9.57 by Monty Taylor
Oy. Bigger change than I normally like - but this stuff is all intertwined.
206
1 by brian
clean slate
207
/*
208
  Used with --help for detailed option
209
*/
1300.5.2 by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then
210
bool opt_help= false;
1 by brian
clean slate
211
212
arg_cmp_func Arg_comparator::comparator_matrix[5][2] =
213
{{&Arg_comparator::compare_string,     &Arg_comparator::compare_e_string},
214
 {&Arg_comparator::compare_real,       &Arg_comparator::compare_e_real},
215
 {&Arg_comparator::compare_int_signed, &Arg_comparator::compare_e_int},
216
 {&Arg_comparator::compare_row,        &Arg_comparator::compare_e_row},
1122.2.13 by Monty Taylor
Header cleanup.
217
 {&Arg_comparator::compare_decimal,    &Arg_comparator::compare_e_decimal}};
1 by brian
clean slate
218
219
/* static variables */
220
1816.2.3 by Monty Taylor
Fixed some more ICC warnings. How did I get started on this this morning?
221
static bool opt_debugging= false;
566 by Brian Aker
Clean up dead thead code.
222
static uint32_t wake_thread;
2318.2.26 by Olaf van der Spek
Refactor
223
static const char* drizzled_chroot;
2318.2.27 by Olaf van der Spek
Refactor
224
static const char* default_character_set_name= "utf8";
225
static const char* character_set_filesystem_name= "binary";
2318.2.28 by Olaf van der Spek
Refactor
226
static const char* lc_time_names_name= "en_US";
227
static const char* default_storage_engine_str= "innodb";
2318.2.26 by Olaf van der Spek
Refactor
228
static const char* const compiled_default_collation_name= "utf8_general_ci";
2318.2.28 by Olaf van der Spek
Refactor
229
static const char* default_collation_name= compiled_default_collation_name;
1 by brian
clean slate
230
231
/* Global variables */
232
2318.2.2 by Olaf van der Spek
Add some const
233
const char *drizzled_user;
1300.5.2 by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then
234
bool volatile select_thread_in_use;
1 by brian
clean slate
235
bool volatile abort_loop;
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
236
DRIZZLED_API bool volatile shutdown_in_progress;
2318.2.16 by Olaf van der Spek
Refactor
237
const char* opt_scheduler= "multi_thread";
994.2.2 by Monty Taylor
Store a Registry of SchedulerFactories and set one of them at startup for better error messages earlier.
238
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
239
DRIZZLED_API size_t my_thread_stack_size= 0;
629.2.7 by Monty Taylor
Fixed a couple of memory buffer size issues.
240
1 by brian
clean slate
241
/*
1130.1.4 by Monty Taylor
Moved StorageEngine into plugin namespace.
242
  Legacy global plugin::StorageEngine. These will be removed (please do not add more).
1 by brian
clean slate
243
*/
1130.1.4 by Monty Taylor
Moved StorageEngine into plugin namespace.
244
plugin::StorageEngine *heap_engine;
245
plugin::StorageEngine *myisam_engine;
1 by brian
clean slate
246
1300.5.2 by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then
247
bool calling_initgroups= false; /**< Used in SIGSEGV handler. */
971.3.53 by Eric Day
Cleaned up error messages and a few other things from Jay's review.
248
971.6.7 by Eric Day
Reworked listen interface to not require binding of TCP ports.
249
uint32_t drizzled_bind_timeout;
1089.6.1 by Padraig O'Sullivan
Converted the test_flags variable from a uint32_t to std::bitset.
250
uint32_t dropping_tables, ha_open_options;
482 by Brian Aker
Remove uint.
251
uint32_t tc_heuristic_recover= 0;
520.1.22 by Brian Aker
Second pass of thd cleanup
252
uint64_t session_startup_options;
2318.2.42 by Olaf van der Spek
Refactor
253
back_log_constraints back_log(SOMAXCONN);
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
254
DRIZZLED_API uint32_t server_id;
2290.1.1 by Joseph Daly
Add server uuid
255
DRIZZLED_API string server_uuid;
622.1.1 by Brian Aker
32bit fixes around vars
256
uint64_t table_cache_size;
1226.1.3 by Brian Aker
Possible solution for hash/rehash.
257
size_t table_def_size;
1093.1.57 by Jay Pipes
Merge and resolved conflicts for Monty's plugins/slots reorganization
258
uint32_t global_thread_id= 1UL;
606 by Brian Aker
Remove dead lex structure and clean up use of pid_t
259
pid_t current_pid;
1 by brian
clean slate
260
1241.9.33 by Monty Taylor
Moved most of the global vars to set_var where they belong.
261
extern const double log_10[309];
262
1 by brian
clean slate
263
const double log_10[] = {
264
  1e000, 1e001, 1e002, 1e003, 1e004, 1e005, 1e006, 1e007, 1e008, 1e009,
265
  1e010, 1e011, 1e012, 1e013, 1e014, 1e015, 1e016, 1e017, 1e018, 1e019,
266
  1e020, 1e021, 1e022, 1e023, 1e024, 1e025, 1e026, 1e027, 1e028, 1e029,
267
  1e030, 1e031, 1e032, 1e033, 1e034, 1e035, 1e036, 1e037, 1e038, 1e039,
268
  1e040, 1e041, 1e042, 1e043, 1e044, 1e045, 1e046, 1e047, 1e048, 1e049,
269
  1e050, 1e051, 1e052, 1e053, 1e054, 1e055, 1e056, 1e057, 1e058, 1e059,
270
  1e060, 1e061, 1e062, 1e063, 1e064, 1e065, 1e066, 1e067, 1e068, 1e069,
271
  1e070, 1e071, 1e072, 1e073, 1e074, 1e075, 1e076, 1e077, 1e078, 1e079,
272
  1e080, 1e081, 1e082, 1e083, 1e084, 1e085, 1e086, 1e087, 1e088, 1e089,
273
  1e090, 1e091, 1e092, 1e093, 1e094, 1e095, 1e096, 1e097, 1e098, 1e099,
274
  1e100, 1e101, 1e102, 1e103, 1e104, 1e105, 1e106, 1e107, 1e108, 1e109,
275
  1e110, 1e111, 1e112, 1e113, 1e114, 1e115, 1e116, 1e117, 1e118, 1e119,
276
  1e120, 1e121, 1e122, 1e123, 1e124, 1e125, 1e126, 1e127, 1e128, 1e129,
277
  1e130, 1e131, 1e132, 1e133, 1e134, 1e135, 1e136, 1e137, 1e138, 1e139,
278
  1e140, 1e141, 1e142, 1e143, 1e144, 1e145, 1e146, 1e147, 1e148, 1e149,
279
  1e150, 1e151, 1e152, 1e153, 1e154, 1e155, 1e156, 1e157, 1e158, 1e159,
280
  1e160, 1e161, 1e162, 1e163, 1e164, 1e165, 1e166, 1e167, 1e168, 1e169,
281
  1e170, 1e171, 1e172, 1e173, 1e174, 1e175, 1e176, 1e177, 1e178, 1e179,
282
  1e180, 1e181, 1e182, 1e183, 1e184, 1e185, 1e186, 1e187, 1e188, 1e189,
283
  1e190, 1e191, 1e192, 1e193, 1e194, 1e195, 1e196, 1e197, 1e198, 1e199,
284
  1e200, 1e201, 1e202, 1e203, 1e204, 1e205, 1e206, 1e207, 1e208, 1e209,
285
  1e210, 1e211, 1e212, 1e213, 1e214, 1e215, 1e216, 1e217, 1e218, 1e219,
286
  1e220, 1e221, 1e222, 1e223, 1e224, 1e225, 1e226, 1e227, 1e228, 1e229,
287
  1e230, 1e231, 1e232, 1e233, 1e234, 1e235, 1e236, 1e237, 1e238, 1e239,
288
  1e240, 1e241, 1e242, 1e243, 1e244, 1e245, 1e246, 1e247, 1e248, 1e249,
289
  1e250, 1e251, 1e252, 1e253, 1e254, 1e255, 1e256, 1e257, 1e258, 1e259,
290
  1e260, 1e261, 1e262, 1e263, 1e264, 1e265, 1e266, 1e267, 1e268, 1e269,
291
  1e270, 1e271, 1e272, 1e273, 1e274, 1e275, 1e276, 1e277, 1e278, 1e279,
292
  1e280, 1e281, 1e282, 1e283, 1e284, 1e285, 1e286, 1e287, 1e288, 1e289,
293
  1e290, 1e291, 1e292, 1e293, 1e294, 1e295, 1e296, 1e297, 1e298, 1e299,
294
  1e300, 1e301, 1e302, 1e303, 1e304, 1e305, 1e306, 1e307, 1e308
295
};
296
855 by Brian Aker
Refactor reset of status.
297
time_t server_start_time;
298
time_t flush_status_time;
1 by brian
clean slate
299
1813.2.1 by Monty Taylor
Migrated --basedir to feed a path.
300
fs::path basedir(PREFIX);
1813.2.2 by Monty Taylor
Replaced pid-file with fs::path.
301
fs::path pid_file;
2318.5.31 by Olaf van der Spek
Refactor
302
fs::path secure_file_priv;
1813.2.7 by Monty Taylor
Migrated plugin_dir to fs::path.
303
fs::path plugin_dir;
1813.2.15 by Monty Taylor
migrated config-dir.
304
fs::path system_config_dir(SYSCONFDIR);
305
2318.5.31 by Olaf van der Spek
Refactor
306
const char *opt_tc_log_file;
982.1.11 by Padraig O'Sullivan
Reverted my changes for replacing Bitmap<> for the moment. Going to fix up
307
const key_map key_map_empty(0);
2119.4.2 by Monty Taylor
Fixed a sun studio compile issue.
308
key_map key_map_full(0);                        // Will be initialized later
1 by brian
clean slate
309
1556.1.1 by Brian Aker
Updates for moving temporary directory.
310
std::string drizzle_tmpdir;
680 by Brian Aker
Remove locks around temp tables for searching tmp directory path.
311
char *opt_drizzle_tmpdir= NULL;
1 by brian
clean slate
312
313
/** name of reference on left espression in rewritten IN subquery */
314
const char *in_left_expr_name= "<left expr>";
315
/** name of additional condition */
316
const char *in_additional_cond= "<IN COND>";
317
const char *in_having_cond= "<IN HAVING>";
318
319
/* classes for comparation parsing/processing */
320
321
FILE *stderror_file=0;
322
2119.4.2 by Monty Taylor
Fixed a sun studio compile issue.
323
drizzle_system_variables global_system_variables;
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
324
drizzle_system_variables max_system_variables;
325
global_counters current_global_counters;
1 by brian
clean slate
326
2254 by Brian Aker
Shift CHARSET_INFO to charset_info_st
327
DRIZZLED_API const charset_info_st *system_charset_info;
328
const charset_info_st *files_charset_info;
329
const charset_info_st *table_alias_charset;
330
const charset_info_st *character_set_filesystem;
1 by brian
clean slate
331
332
MY_LOCALE *my_default_lc_time_names;
333
177.3.1 by mark
remove ifdef HAVE_DLOPEN, make configure require dlopen()
334
SHOW_COMP_OPTION have_symlink;
1 by brian
clean slate
335
1812.3.5 by Brian Aker
Move to boost condition_any
336
boost::condition_variable_any COND_refresh;
2119.4.2 by Monty Taylor
Fixed a sun studio compile issue.
337
boost::condition_variable COND_thread_count;
1 by brian
clean slate
338
pthread_t signal_thread;
339
340
/* Static variables */
341
900 by Brian Aker
Creating signal handler plugin.
342
int cleanup_done;
1 by brian
clean slate
343
1300.5.2 by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then
344
passwd *user_info;
1 by brian
clean slate
345
2039.3.5 by Brian Aker
Switched connection_count to use boost atomic.
346
boost::detail::atomic_count connection_count(0);
1 by brian
clean slate
347
1796.4.9 by Andrew Hutchings
Add join cache global constraint
348
global_buffer_constraint<uint64_t> global_sort_buffer(0);
349
global_buffer_constraint<uint64_t> global_join_buffer(0);
1796.4.10 by Andrew Hutchings
Add global constraint for --read-rnd-buffer-size
350
global_buffer_constraint<uint64_t> global_read_rnd_buffer(0);
1796.4.11 by Andrew Hutchings
Add global constraint on read buffer
351
global_buffer_constraint<uint64_t> global_read_buffer(0);
1796.4.1 by Andrew Hutchings
Add initial template work and test
352
2132.3.17 by Andrew Hutchings
Fix possible visibility issue
353
DRIZZLED_API size_t transaction_message_threshold;
2132.3.1 by Andrew Hutchings
Make transaction_message_threshold a read-only global variable instead of a per-session variable
354
2318.2.28 by Olaf van der Spek
Refactor
355
static void drizzle_init_variables();
1757.2.6 by Monty Taylor
We've gotten further. Now things sometimes work, but some things aren't
356
static void get_options();
1794.3.4 by Monty Taylor
Fixed plugin dir sequencing
357
static void fix_paths();
1 by brian
clean slate
358
2318.2.28 by Olaf van der Spek
Refactor
359
static void usage();
360
void close_connections();
1633.1.1 by Monty Taylor
Added in support for program_options output in --help output.
361
1798.2.7 by Monty Taylor
Hopefully fixed more madness with plugin paths.
362
fs::path base_plugin_dir(PKGPLUGINDIR);
363
2183.1.1 by Monty Taylor
Use fs::path instead of string searching.
364
po::options_description config_options(_("Config File Options"));
365
po::options_description long_options(_("Kernel Options"));
366
po::options_description plugin_load_options(_("Plugin Loading Options"));
367
po::options_description plugin_options(_("Plugin Options"));
368
po::options_description initial_options(_("Config and Plugin Loading"));
369
po::options_description full_options(_("Kernel and Plugin Loading and Plugin"));
1757.2.6 by Monty Taylor
We've gotten further. Now things sometimes work, but some things aren't
370
vector<string> unknown_options;
1776.4.3 by Monty Taylor
Add config-dir option.
371
vector<string> defaults_file_list;
1635.1.1 by Monty Taylor
Moved actual parsing of plugin program_options to drizzled.cc so that we do
372
po::variables_map vm;
1813.2.9 by Monty Taylor
Made data_home be fs::path natively.
373
1635.1.1 by Monty Taylor
Moved actual parsing of plugin program_options to drizzled.cc so that we do
374
po::variables_map &getVariablesMap()
375
{
376
  return vm;
377
}
1786.3.1 by Monty Taylor
Initial working local catalog.
378
2318.5.31 by Olaf van der Spek
Refactor
379
static std::string g_hostname= "localhost";
380
381
const std::string& getServerHostname()
382
{
383
  return g_hostname;
2183.1.2 by Monty Taylor
A slew of tiny meaningless changes.
384
}
2139.3.1 by Brian Aker
Merge in encapsulation so that when laying out catalogs we have folks just
385
1 by brian
clean slate
386
/****************************************************************************
575.4.4 by Yoshinori Sano
Rename mysql to drizzle.
387
** Code to end drizzled
1 by brian
clean slate
388
****************************************************************************/
389
2318.2.28 by Olaf van der Spek
Refactor
390
void close_connections()
1 by brian
clean slate
391
{
907 by Brian Aker
Shutdown for Linux fixed.
392
  /* Abort listening to new connections */
1130.1.12 by Monty Taylor
Moved service stuff into plugin/
393
  plugin::Listen::shutdown();
1 by brian
clean slate
394
395
  /* kill connection thread */
396
  {
2275.3.2 by Olaf van der Spek
Session Cache
397
    boost::mutex::scoped_lock scopedLock(session::Cache::mutex());
1 by brian
clean slate
398
1755.2.4 by Brian Aker
Modify close connection to use boost conditional instead of native.
399
    while (select_thread_in_use)
1 by brian
clean slate
400
    {
2224.1.1 by Olaf van der Spek
Finish removing XID cache
401
      boost::xtime xt;
402
      xtime_get(&xt, boost::TIME_UTC);
403
      xt.sec += 2;
1755.2.4 by Brian Aker
Modify close connection to use boost conditional instead of native.
404
405
      for (uint32_t tmp=0 ; tmp < 10 && select_thread_in_use; tmp++)
406
      {
407
        bool success= COND_thread_count.timed_wait(scopedLock, xt);
408
        if (not success)
409
          break;
410
      }
1 by brian
clean slate
411
    }
412
  }
413
414
415
  /*
416
    First signal all threads that it's time to die
417
    This will give the threads some time to gracefully abort their
418
    statements and inform their clients that the server is about to die.
419
  */
420
421
  {
2275.3.2 by Olaf van der Spek
Session Cache
422
    boost::mutex::scoped_lock scopedLock(session::Cache::mutex());
2282.1.2 by Olaf van der Spek
Session Cache
423
    session::Cache::list list= session::Cache::getCache();
1932.3.7 by Brian Aker
Connection count restructure.
424
2246.4.1 by Olaf van der Spek
Use BOOST_FOREACH
425
    BOOST_FOREACH(session::Cache::list::reference tmp, list)
1843.7.4 by Brian Aker
Scope locks.
426
    {
1910.2.8 by Brian Aker
Enapsulate Kill.
427
      tmp->setKilled(Session::KILL_CONNECTION);
1932.3.5 by Brian Aker
Finish change so that we use a shared_ptr for the session list.
428
      tmp->scheduler->killSession(tmp.get());
1843.7.4 by Brian Aker
Scope locks.
429
      DRIZZLE_CONNECTION_DONE(tmp->thread_id);
1961 by Brian Aker
This extends our coverage of interrupting active threads. With no crash
430
1843.7.4 by Brian Aker
Scope locks.
431
      tmp->lockOnSys();
432
    }
1 by brian
clean slate
433
  }
434
2282.1.2 by Olaf van der Spek
Session Cache
435
  if (session::Cache::count())
948 by Brian Aker
Restoring code Monty deleted.
436
    sleep(2);                                   // Give threads time to die
437
1 by brian
clean slate
438
  /*
439
    Force remaining threads to die by closing the connection to the client
440
    This will ensure that threads that are waiting for a command from the
441
    client on a blocking read call are aborted.
442
  */
934.3.10 by Monty Taylor
Revert std::vector changes. dammit.
443
  for (;;)
1 by brian
clean slate
444
  {
2275.3.2 by Olaf van der Spek
Session Cache
445
    boost::mutex::scoped_lock scopedLock(session::Cache::mutex());
2282.1.2 by Olaf van der Spek
Session Cache
446
    session::Cache::list list= session::Cache::getCache();
1932.3.7 by Brian Aker
Connection count restructure.
447
1932.3.3 by Brian Aker
Pull in code to abstract out the session list a bit.
448
    if (list.empty())
1 by brian
clean slate
449
    {
450
      break;
451
    }
1166.4.1 by Diego Medina
* Fixed LP bug#436685
452
    /* Close before unlock, avoiding crash. See LP bug#436685 */
2015.3.1 by Brian Aker
Encapsulate client call. Also remove the need to call current_session when
453
    list.front()->getClient()->close();
1 by brian
clean slate
454
  }
455
}
456
457
1022.2.2 by Monty Taylor
Small cleanup inspired by merge.
458
void unireg_abort(int exit_code)
1 by brian
clean slate
459
{
460
  if (exit_code)
2126.2.1 by Brian Aker
Merge in changes for catalogs usage of constants for identifier.
461
  {
2126.3.3 by Brian Aker
Merge in error message rework. Many error messages are fixed in this patch.
462
    errmsg_printf(error::ERROR, _("Aborting"));
2126.2.1 by Brian Aker
Merge in changes for catalogs usage of constants for identifier.
463
  }
1802.8.3 by Monty Taylor
Remove help-extended.
464
  else if (opt_help)
2126.2.1 by Brian Aker
Merge in changes for catalogs usage of constants for identifier.
465
  {
1 by brian
clean slate
466
    usage();
2126.2.1 by Brian Aker
Merge in changes for catalogs usage of constants for identifier.
467
  }
2126.3.3 by Brian Aker
Merge in error message rework. Many error messages are fixed in this patch.
468
2318.2.4 by Olaf van der Spek
Refactor
469
  clean_up(!opt_help && exit_code);
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
470
  internal::my_end();
971.6.11 by Eric Day
Removed purecov messages.
471
  exit(exit_code);
1 by brian
clean slate
472
}
473
474
1300.5.2 by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then
475
void clean_up(bool print_message)
1 by brian
clean slate
476
{
477
  if (cleanup_done++)
971.6.11 by Eric Day
Removed purecov messages.
478
    return;
1 by brian
clean slate
479
480
  table_cache_free();
481
  free_charsets();
1530.2.5 by Monty Taylor
Renamed classes that were in drizzled::plugin but which were not meant
482
  module::Registry &modules= module::Registry::singleton();
483
  modules.shutdownModules();
1 by brian
clean slate
484
1089.1.3 by Brian Aker
Fix protobuf to release memory. Add in assert() for wrong column usage. Fix
485
  deinit_temporal_formats();
486
487
#if GOOGLE_PROTOBUF_VERSION >= 2001000
488
  google::protobuf::ShutdownProtobufLibrary();
489
#endif
490
1813.2.2 by Monty Taylor
Replaced pid-file with fs::path.
491
  (void) unlink(pid_file.file_string().c_str());	// This may not always exist
228 by Brian Aker
First pass on socket cleanup.
492
202.3.6 by Monty Taylor
First pass at gettexizing the error messages.
493
  if (print_message && server_start_time)
2126.3.3 by Brian Aker
Merge in error message rework. Many error messages are fixed in this patch.
494
    errmsg_printf(drizzled::error::INFO, _(ER(ER_SHUTDOWN_COMPLETE)),internal::my_progname);
1932.3.4 by Brian Aker
Move counter lock so that ownership is held by session_list.
495
2282.1.2 by Olaf van der Spek
Session Cache
496
  session::Cache::shutdownFirst();
1 by brian
clean slate
497
498
  /*
499
    The following lines may never be executed as the main thread may have
500
    killed us
501
  */
502
} /* clean_up */
503
504
505
/* Change to run as another user if started with --user */
506
1300.5.2 by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then
507
passwd *check_user(const char *user)
1 by brian
clean slate
508
{
1300.5.2 by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then
509
  passwd *tmp_user_info;
1 by brian
clean slate
510
  uid_t user_id= geteuid();
511
512
  // Don't bother if we aren't superuser
513
  if (user_id)
514
  {
515
    if (user)
516
    {
517
      /* Don't give a warning, if real user is same as given with --user */
518
      tmp_user_info= getpwnam(user);
519
      if ((!tmp_user_info || user_id != tmp_user_info->pw_uid) &&
312.1.10 by Monty Taylor
Added some strings from drizzled.cc.
520
          global_system_variables.log_warnings)
2126.3.3 by Brian Aker
Merge in error message rework. Many error messages are fixed in this patch.
521
            errmsg_printf(error::WARN, _("One can only use the --user switch "
312.1.10 by Monty Taylor
Added some strings from drizzled.cc.
522
                            "if running as root\n"));
1 by brian
clean slate
523
    }
524
    return NULL;
525
  }
1910.2.8 by Brian Aker
Enapsulate Kill.
526
  if (not user)
1 by brian
clean slate
527
  {
2126.3.3 by Brian Aker
Merge in error message rework. Many error messages are fixed in this patch.
528
      errmsg_printf(error::ERROR, _("Fatal error: Please read \"Security\" section of "
2132.1.1 by Brian Aker
Merge in additional error control.
529
                                    "the manual to find out how to run drizzled as root"));
228 by Brian Aker
First pass on socket cleanup.
530
    unireg_abort(1);
1 by brian
clean slate
531
  }
2132.1.1 by Brian Aker
Merge in additional error control.
532
533
  if (not strcmp(user, "root"))
1 by brian
clean slate
534
    return NULL;                        // Avoid problem with dynamic libraries
535
536
  if (!(tmp_user_info= getpwnam(user)))
537
  {
538
    // Allow a numeric uid to be used
539
    const char *pos;
2026.2.1 by Monty Taylor
Renamed things prefixed mysql_ or mysqld_
540
    for (pos= user; my_isdigit(&my_charset_utf8_general_ci,*pos); pos++) ;
1 by brian
clean slate
541
    if (*pos)                                   // Not numeric id
542
      goto err;
543
    if (!(tmp_user_info= getpwuid(atoi(user))))
544
      goto err;
545
  }
546
  return tmp_user_info;
547
548
err:
2126.3.3 by Brian Aker
Merge in error message rework. Many error messages are fixed in this patch.
549
  errmsg_printf(error::ERROR, _("Fatal error: Can't change to run as user '%s' ;  "
312.1.10 by Monty Taylor
Added some strings from drizzled.cc.
550
                    "Please check that the user exists!\n"),user);
1 by brian
clean slate
551
  unireg_abort(1);
552
553
#ifdef PR_SET_DUMPABLE
2104.3.3 by Brian Aker
Cleanup test flags for debug options on server startup
554
  if (getDebug().test(debug::CORE_ON_SIGNAL))
1 by brian
clean slate
555
  {
556
    /* inform kernel that process is dumpable */
557
    (void) prctl(PR_SET_DUMPABLE, 1);
558
  }
559
#endif
560
908.1.13 by Monty Taylor
Fix for Sun Studio 5.10.
561
/* Sun Studio 5.10 doesn't like this line.  5.9 requires it */
908.1.14 by Monty Taylor
I never learn.
562
#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x590)
908.1.12 by Monty Taylor
mmm.
563
  return NULL;
908.1.13 by Monty Taylor
Fix for Sun Studio 5.10.
564
#endif
908.1.12 by Monty Taylor
mmm.
565
1 by brian
clean slate
566
}
567
1300.5.2 by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then
568
void set_user(const char *user, passwd *user_info_arg)
1 by brian
clean slate
569
{
51.2.1 by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from
570
  assert(user_info_arg != 0);
2318.2.3 by Olaf van der Spek
Refactor
571
  initgroups(user, user_info_arg->pw_gid);
1 by brian
clean slate
572
  if (setgid(user_info_arg->pw_gid) == -1)
573
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
574
    sql_perror(_("Set process group ID failed"));
1 by brian
clean slate
575
    unireg_abort(1);
576
  }
577
  if (setuid(user_info_arg->pw_uid) == -1)
578
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
579
    sql_perror(_("Set process user ID failed"));
1 by brian
clean slate
580
    unireg_abort(1);
581
  }
582
}
583
584
1300.5.2 by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then
585
1 by brian
clean slate
586
/** Change root user if started with @c --chroot . */
587
static void set_root(const char *path)
588
{
575.4.6 by Monty Taylor
Removed my_getwd.
589
  if ((chroot(path) == -1) || !chdir("/"))
1 by brian
clean slate
590
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
591
    sql_perror(_("Process chroot failed"));
1 by brian
clean slate
592
    unireg_abort(1);
593
  }
594
}
595
596
597
/*
520.1.22 by Brian Aker
Second pass of thd cleanup
598
  Unlink session from global list of available connections and free session
1 by brian
clean slate
599
600
  SYNOPSIS
1241.9.12 by Monty Taylor
Trims more out of server_includes.h.
601
    Session::unlink()
520.1.22 by Brian Aker
Second pass of thd cleanup
602
    session		 Thread handler
1 by brian
clean slate
603
*/
604
2246.4.6 by Olaf van der Spek
Remove some unnecessary drizzled::
605
void Session::unlink(session_id_t &session_id)
2015.3.3 by Brian Aker
Update disconnect code.
606
{
2282.1.2 by Olaf van der Spek
Session Cache
607
  Session::shared_ptr session= session::Cache::find(session_id);
2015.3.3 by Brian Aker
Update disconnect code.
608
609
  if (session)
610
    unlink(session);
611
}
612
2318.6.43 by Olaf van der Spek
Refactor
613
void Session::unlink(const Session::shared_ptr& session)
1932.3.13 by Brian Aker
Cleanup session ownership rules such that we know exactly when session has
614
{
2039.3.5 by Brian Aker
Switched connection_count to use boost atomic.
615
  --connection_count;
1932.3.13 by Brian Aker
Cleanup session ownership rules such that we know exactly when session has
616
617
  session->cleanup();
618
2275.3.2 by Olaf van der Spek
Session Cache
619
  boost::mutex::scoped_lock scopedLock(session::Cache::mutex());
1932.3.13 by Brian Aker
Cleanup session ownership rules such that we know exactly when session has
620
621
  if (unlikely(plugin::EventObserver::disconnectSession(*session)))
622
  {
623
    // We should do something about an error...
624
  }
2282.1.2 by Olaf van der Spek
Session Cache
625
  session::Cache::erase(session);
1 by brian
clean slate
626
}
627
628
629
#ifndef SA_RESETHAND
630
#define SA_RESETHAND 0
631
#endif
632
#ifndef SA_NODEFER
633
#define SA_NODEFER 0
634
#endif
635
636
1300.5.2 by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then
637
638
2224.1.1 by Olaf van der Spek
Finish removing XID cache
639
const char *load_default_groups[]=
1 by brian
clean slate
640
{
1300.5.2 by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then
641
  DRIZZLE_CONFIG_NAME, "server", 0, 0
642
};
1 by brian
clean slate
643
1794.3.4 by Monty Taylor
Fixed plugin dir sequencing
644
static void find_plugin_dir(string progname)
645
{
2183.1.1 by Monty Taylor
Use fs::path instead of string searching.
646
  fs::path full_progname(fs::system_complete(progname));
647
648
  fs::path progdir(full_progname.parent_path());
649
  if (progdir.filename() == ".libs")
650
  {
651
    progdir= progdir.parent_path();
652
  }
653
654
  if (fs::exists(progdir / "drizzled.lo") || fs::exists(progdir / "drizzled.o"))
1794.3.4 by Monty Taylor
Fixed plugin dir sequencing
655
  {
656
    /* We are in a source dir! Plugin dir is ../plugin/.libs */
2183.1.1 by Monty Taylor
Use fs::path instead of string searching.
657
    base_plugin_dir= progdir.parent_path();
1798.2.7 by Monty Taylor
Hopefully fixed more madness with plugin paths.
658
    base_plugin_dir /= "plugin";
659
    base_plugin_dir /= ".libs";
1794.3.4 by Monty Taylor
Fixed plugin dir sequencing
660
  }
1813.2.7 by Monty Taylor
Migrated plugin_dir to fs::path.
661
662
  if (plugin_dir.root_directory() == "")
663
  {
664
    fs::path full_plugin_dir(fs::system_complete(base_plugin_dir));
665
    full_plugin_dir /= plugin_dir;
666
    plugin_dir= full_plugin_dir;
667
  }
1794.3.4 by Monty Taylor
Fixed plugin dir sequencing
668
}
669
1813.2.7 by Monty Taylor
Migrated plugin_dir to fs::path.
670
static void notify_plugin_dir(fs::path in_plugin_dir)
1794.3.4 by Monty Taylor
Fixed plugin dir sequencing
671
{
1813.2.7 by Monty Taylor
Migrated plugin_dir to fs::path.
672
  plugin_dir= in_plugin_dir;
673
  if (plugin_dir.root_directory() == "")
1794.3.4 by Monty Taylor
Fixed plugin dir sequencing
674
  {
1813.2.7 by Monty Taylor
Migrated plugin_dir to fs::path.
675
    fs::path full_plugin_dir(fs::system_complete(basedir));
676
    full_plugin_dir /= plugin_dir;
677
    plugin_dir= full_plugin_dir;
1794.3.4 by Monty Taylor
Fixed plugin dir sequencing
678
  }
679
}
680
1813.2.10 by Monty Taylor
Expand secure-file-priv once at startup rather than on each path check.
681
static void expand_secure_file_priv(fs::path in_secure_file_priv)
682
{
683
  secure_file_priv= fs::system_complete(in_secure_file_priv);
684
}
1813.2.7 by Monty Taylor
Migrated plugin_dir to fs::path.
685
1757.2.4 by Monty Taylor
Next step.
686
static void check_limits_aii(uint64_t in_auto_increment_increment)
687
{
1757.3.1 by Andrew Hutchings
Hacky quick fix for mtaylor's problem:
688
  global_system_variables.auto_increment_increment= 1;
1757.2.4 by Monty Taylor
Next step.
689
  if (in_auto_increment_increment < 1 || in_auto_increment_increment > UINT64_MAX)
690
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
691
    cout << _("Error: Invalid Value for auto_increment_increment");
1757.2.4 by Monty Taylor
Next step.
692
    exit(-1);
693
  }
694
  global_system_variables.auto_increment_increment= in_auto_increment_increment;
695
}
696
697
static void check_limits_aio(uint64_t in_auto_increment_offset)
698
{
1757.3.1 by Andrew Hutchings
Hacky quick fix for mtaylor's problem:
699
  global_system_variables.auto_increment_offset= 1;
1757.2.4 by Monty Taylor
Next step.
700
  if (in_auto_increment_offset < 1 || in_auto_increment_offset > UINT64_MAX)
701
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
702
    cout << _("Error: Invalid Value for auto_increment_offset");
1757.2.4 by Monty Taylor
Next step.
703
    exit(-1);
704
  }
705
  global_system_variables.auto_increment_offset= in_auto_increment_offset;
706
}
707
708
static void check_limits_completion_type(uint32_t in_completion_type)
709
{
710
  global_system_variables.completion_type= 0;
711
  if (in_completion_type > 2)
712
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
713
    cout << _("Error: Invalid Value for completion_type");
1757.2.4 by Monty Taylor
Next step.
714
    exit(-1);
715
  }
716
  global_system_variables.completion_type= in_completion_type;
717
}
718
719
720
static void check_limits_dpi(uint32_t in_div_precincrement)
721
{
1757.3.1 by Andrew Hutchings
Hacky quick fix for mtaylor's problem:
722
  global_system_variables.div_precincrement= 4;
1757.2.4 by Monty Taylor
Next step.
723
  if (in_div_precincrement > DECIMAL_MAX_SCALE)
724
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
725
    cout << _("Error: Invalid Value for div-precision-increment");
1757.2.4 by Monty Taylor
Next step.
726
    exit(-1);
727
  }
728
  global_system_variables.div_precincrement= in_div_precincrement;
729
}
730
731
static void check_limits_gcml(uint64_t in_group_concat_max_len)
732
{
1757.3.1 by Andrew Hutchings
Hacky quick fix for mtaylor's problem:
733
  global_system_variables.group_concat_max_len= 1024;
1757.2.4 by Monty Taylor
Next step.
734
  if (in_group_concat_max_len > ULONG_MAX || in_group_concat_max_len < 4)
735
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
736
    cout << _("Error: Invalid Value for group_concat_max_len");
1757.2.4 by Monty Taylor
Next step.
737
    exit(-1);
738
  }
739
  global_system_variables.group_concat_max_len= in_group_concat_max_len;
740
}
741
742
static void check_limits_join_buffer_size(uint64_t in_join_buffer_size)
743
{
1757.3.1 by Andrew Hutchings
Hacky quick fix for mtaylor's problem:
744
  global_system_variables.join_buff_size= (128*1024L);
1757.2.4 by Monty Taylor
Next step.
745
  if (in_join_buffer_size < IO_SIZE*2 || in_join_buffer_size > ULONG_MAX)
746
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
747
    cout << _("Error: Invalid Value for join_buffer_size");
1757.2.4 by Monty Taylor
Next step.
748
    exit(-1);
749
  }
1757.2.10 by Monty Taylor
Fix max_heap_table_size setting issue.
750
  in_join_buffer_size-= in_join_buffer_size % IO_SIZE;
751
  global_system_variables.join_buff_size= in_join_buffer_size;
1757.2.4 by Monty Taylor
Next step.
752
}
753
754
static void check_limits_map(uint32_t in_max_allowed_packet)
755
{
1877.1.3 by Andrew Hutchings
Make default max_packet_size 64MB as 1MB doesn't seem really sane for text/blob columns
756
  global_system_variables.max_allowed_packet= (64*1024*1024L);
1757.2.4 by Monty Taylor
Next step.
757
  if (in_max_allowed_packet < 1024 || in_max_allowed_packet > 1024*1024L*1024L)
758
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
759
    cout << _("Error: Invalid Value for max_allowed_packet");
1757.2.4 by Monty Taylor
Next step.
760
    exit(-1);
761
  }
1757.2.10 by Monty Taylor
Fix max_heap_table_size setting issue.
762
  in_max_allowed_packet-= in_max_allowed_packet % 1024;
763
  global_system_variables.max_allowed_packet= in_max_allowed_packet;
1757.2.4 by Monty Taylor
Next step.
764
}
765
766
static void check_limits_max_err_cnt(uint64_t in_max_error_count)
767
{
1757.3.1 by Andrew Hutchings
Hacky quick fix for mtaylor's problem:
768
  global_system_variables.max_error_count= DEFAULT_ERROR_COUNT;
1757.2.4 by Monty Taylor
Next step.
769
  if (in_max_error_count > 65535)
770
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
771
    cout << _("Error: Invalid Value for max_error_count");
1757.2.4 by Monty Taylor
Next step.
772
    exit(-1);
773
  }
774
  global_system_variables.max_error_count= in_max_error_count;
775
}
776
777
static void check_limits_mhts(uint64_t in_max_heap_table_size)
778
{
1757.3.1 by Andrew Hutchings
Hacky quick fix for mtaylor's problem:
779
  global_system_variables.max_heap_table_size= (16*1024*1024L);
1757.2.4 by Monty Taylor
Next step.
780
  if (in_max_heap_table_size < 16384 || in_max_heap_table_size > MAX_MEM_TABLE_SIZE)
781
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
782
    cout << _("Error: Invalid Value for max_heap_table_size");
1757.2.4 by Monty Taylor
Next step.
783
    exit(-1);
784
  }
1757.2.10 by Monty Taylor
Fix max_heap_table_size setting issue.
785
  in_max_heap_table_size-= in_max_heap_table_size % 1024;
786
  global_system_variables.max_heap_table_size= in_max_heap_table_size;
1757.2.4 by Monty Taylor
Next step.
787
}
788
789
static void check_limits_merl(uint64_t in_min_examined_row_limit)
790
{
791
  global_system_variables.min_examined_row_limit= 0;
792
  if (in_min_examined_row_limit > ULONG_MAX)
793
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
794
    cout << _("Error: Invalid Value for min_examined_row_limit");
1757.2.4 by Monty Taylor
Next step.
795
    exit(-1);
796
  }
1757.2.10 by Monty Taylor
Fix max_heap_table_size setting issue.
797
  global_system_variables.min_examined_row_limit= in_min_examined_row_limit;
1757.2.4 by Monty Taylor
Next step.
798
}
799
2246.4.6 by Olaf van der Spek
Remove some unnecessary drizzled::
800
static void check_limits_max_join_size(ha_rows in_max_join_size)
1757.2.4 by Monty Taylor
Next step.
801
{
1757.3.1 by Andrew Hutchings
Hacky quick fix for mtaylor's problem:
802
  global_system_variables.max_join_size= INT32_MAX;
1757.2.4 by Monty Taylor
Next step.
803
  if ((uint64_t)in_max_join_size < 1 || (uint64_t)in_max_join_size > INT32_MAX)
804
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
805
    cout << _("Error: Invalid Value for max_join_size");
1757.2.4 by Monty Taylor
Next step.
806
    exit(-1);
807
  }
808
  global_system_variables.max_join_size= in_max_join_size;
809
}
810
811
static void check_limits_mlfsd(int64_t in_max_length_for_sort_data)
812
{
1757.3.1 by Andrew Hutchings
Hacky quick fix for mtaylor's problem:
813
  global_system_variables.max_length_for_sort_data= 1024;
1757.2.4 by Monty Taylor
Next step.
814
  if (in_max_length_for_sort_data < 4 || in_max_length_for_sort_data > 8192*1024L)
815
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
816
    cout << _("Error: Invalid Value for max_length_for_sort_data");
1757.2.4 by Monty Taylor
Next step.
817
    exit(-1);
818
  }
819
  global_system_variables.max_length_for_sort_data= in_max_length_for_sort_data;
820
}
821
822
static void check_limits_msfk(uint64_t in_max_seeks_for_key)
823
{
1757.3.1 by Andrew Hutchings
Hacky quick fix for mtaylor's problem:
824
  global_system_variables.max_seeks_for_key= ULONG_MAX;
1757.2.4 by Monty Taylor
Next step.
825
  if (in_max_seeks_for_key < 1 || in_max_seeks_for_key > ULONG_MAX)
826
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
827
    cout << _("Error: Invalid Value for max_seeks_for_key");
1757.2.4 by Monty Taylor
Next step.
828
    exit(-1);
829
  }
830
  global_system_variables.max_seeks_for_key= in_max_seeks_for_key;
831
}
832
833
static void check_limits_max_sort_length(size_t in_max_sort_length)
834
{
1757.3.1 by Andrew Hutchings
Hacky quick fix for mtaylor's problem:
835
  global_system_variables.max_sort_length= 1024;
1757.2.4 by Monty Taylor
Next step.
836
  if ((int64_t)in_max_sort_length < 4 || (int64_t)in_max_sort_length > 8192*1024L)
837
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
838
    cout << _("Error: Invalid Value for max_sort_length");
1757.2.4 by Monty Taylor
Next step.
839
    exit(-1);
840
  }
841
  global_system_variables.max_sort_length= in_max_sort_length;
842
}
843
844
static void check_limits_osd(uint32_t in_optimizer_search_depth)
845
{
846
  global_system_variables.optimizer_search_depth= 0;
847
  if (in_optimizer_search_depth > MAX_TABLES + 2)
848
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
849
    cout << _("Error: Invalid Value for optimizer_search_depth");
1757.2.4 by Monty Taylor
Next step.
850
    exit(-1);
851
  }
852
  global_system_variables.optimizer_search_depth= in_optimizer_search_depth;
853
}
854
855
static void check_limits_pbs(uint64_t in_preload_buff_size)
856
{
1757.3.1 by Andrew Hutchings
Hacky quick fix for mtaylor's problem:
857
  global_system_variables.preload_buff_size= (32*1024L);
1757.2.4 by Monty Taylor
Next step.
858
  if (in_preload_buff_size < 1024 || in_preload_buff_size > 1024*1024*1024L)
859
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
860
    cout << _("Error: Invalid Value for preload_buff_size");
1757.2.4 by Monty Taylor
Next step.
861
    exit(-1);
862
  }
863
  global_system_variables.preload_buff_size= in_preload_buff_size;
864
}
865
866
static void check_limits_qabs(uint32_t in_query_alloc_block_size)
867
{
1757.3.1 by Andrew Hutchings
Hacky quick fix for mtaylor's problem:
868
  global_system_variables.query_alloc_block_size= QUERY_ALLOC_BLOCK_SIZE;
1757.2.4 by Monty Taylor
Next step.
869
  if (in_query_alloc_block_size < 1024)
870
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
871
    cout << _("Error: Invalid Value for query_alloc_block_size");
1757.2.4 by Monty Taylor
Next step.
872
    exit(-1);
873
  }
1757.2.10 by Monty Taylor
Fix max_heap_table_size setting issue.
874
  in_query_alloc_block_size-= in_query_alloc_block_size % 1024;
875
  global_system_variables.query_alloc_block_size= in_query_alloc_block_size;
1757.2.4 by Monty Taylor
Next step.
876
}
877
878
static void check_limits_qps(uint32_t in_query_prealloc_size)
879
{
1757.3.1 by Andrew Hutchings
Hacky quick fix for mtaylor's problem:
880
  global_system_variables.query_prealloc_size= QUERY_ALLOC_PREALLOC_SIZE;
1757.2.4 by Monty Taylor
Next step.
881
  if (in_query_prealloc_size < QUERY_ALLOC_PREALLOC_SIZE)
882
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
883
    cout << _("Error: Invalid Value for query_prealloc_size");
1757.2.4 by Monty Taylor
Next step.
884
    exit(-1);
885
  }
1757.2.10 by Monty Taylor
Fix max_heap_table_size setting issue.
886
  in_query_prealloc_size-= in_query_prealloc_size % 1024;
887
  global_system_variables.query_prealloc_size= in_query_prealloc_size;
1757.2.4 by Monty Taylor
Next step.
888
}
889
890
static void check_limits_rabs(size_t in_range_alloc_block_size)
891
{
1757.3.1 by Andrew Hutchings
Hacky quick fix for mtaylor's problem:
892
  global_system_variables.range_alloc_block_size= RANGE_ALLOC_BLOCK_SIZE;
1757.2.4 by Monty Taylor
Next step.
893
  if (in_range_alloc_block_size < RANGE_ALLOC_BLOCK_SIZE)
894
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
895
    cout << _("Error: Invalid Value for range_alloc_block_size");
1757.2.4 by Monty Taylor
Next step.
896
    exit(-1);
897
  }
1757.2.10 by Monty Taylor
Fix max_heap_table_size setting issue.
898
  in_range_alloc_block_size-= in_range_alloc_block_size % 1024;
899
  global_system_variables.range_alloc_block_size= in_range_alloc_block_size;
1757.2.4 by Monty Taylor
Next step.
900
}
901
902
static void check_limits_read_buffer_size(int32_t in_read_buff_size)
903
{
1757.3.1 by Andrew Hutchings
Hacky quick fix for mtaylor's problem:
904
  global_system_variables.read_buff_size= (128*1024L);
1757.2.4 by Monty Taylor
Next step.
905
  if (in_read_buff_size < IO_SIZE*2 || in_read_buff_size > INT32_MAX)
906
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
907
    cout << _("Error: Invalid Value for read_buff_size");
1757.2.4 by Monty Taylor
Next step.
908
    exit(-1);
909
  }
1757.2.10 by Monty Taylor
Fix max_heap_table_size setting issue.
910
  in_read_buff_size-= in_read_buff_size % IO_SIZE;
911
  global_system_variables.read_buff_size= in_read_buff_size;
1757.2.4 by Monty Taylor
Next step.
912
}
913
914
static void check_limits_read_rnd_buffer_size(uint32_t in_read_rnd_buff_size)
915
{
1757.3.1 by Andrew Hutchings
Hacky quick fix for mtaylor's problem:
916
  global_system_variables.read_rnd_buff_size= (256*1024L);
1757.2.4 by Monty Taylor
Next step.
917
  if (in_read_rnd_buff_size < 64 || in_read_rnd_buff_size > UINT32_MAX)
918
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
919
    cout << _("Error: Invalid Value for read_rnd_buff_size");
1757.2.4 by Monty Taylor
Next step.
920
    exit(-1);
921
  }
1757.2.10 by Monty Taylor
Fix max_heap_table_size setting issue.
922
  global_system_variables.read_rnd_buff_size= in_read_rnd_buff_size;
1757.2.4 by Monty Taylor
Next step.
923
}
924
925
static void check_limits_sort_buffer_size(size_t in_sortbuff_size)
926
{
1757.3.1 by Andrew Hutchings
Hacky quick fix for mtaylor's problem:
927
  global_system_variables.sortbuff_size= MAX_SORT_MEMORY;
1757.2.4 by Monty Taylor
Next step.
928
  if ((uint32_t)in_sortbuff_size < MIN_SORT_MEMORY)
929
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
930
    cout << _("Error: Invalid Value for sort_buff_size");
1757.2.4 by Monty Taylor
Next step.
931
    exit(-1);
932
  }
933
  global_system_variables.sortbuff_size= in_sortbuff_size;
934
}
935
936
static void check_limits_tdc(uint32_t in_table_def_size)
937
{
1757.3.1 by Andrew Hutchings
Hacky quick fix for mtaylor's problem:
938
  table_def_size= 128;
1757.2.4 by Monty Taylor
Next step.
939
  if (in_table_def_size < 1 || in_table_def_size > 512*1024L)
940
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
941
    cout << _("Error: Invalid Value for table_def_size");
1757.2.4 by Monty Taylor
Next step.
942
    exit(-1);
943
  }
944
  table_def_size= in_table_def_size;
945
}
946
947
static void check_limits_toc(uint32_t in_table_cache_size)
948
{
1757.3.1 by Andrew Hutchings
Hacky quick fix for mtaylor's problem:
949
  table_cache_size= TABLE_OPEN_CACHE_DEFAULT;
1757.2.4 by Monty Taylor
Next step.
950
  if (in_table_cache_size < TABLE_OPEN_CACHE_MIN || in_table_cache_size > 512*1024L)
951
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
952
    cout << _("Error: Invalid Value for table_cache_size");
1757.2.4 by Monty Taylor
Next step.
953
    exit(-1);
954
  }
955
  table_cache_size= in_table_cache_size;
956
}
957
958
static void check_limits_tlwt(uint64_t in_table_lock_wait_timeout)
959
{
1757.3.1 by Andrew Hutchings
Hacky quick fix for mtaylor's problem:
960
  table_lock_wait_timeout= 50;
1757.2.4 by Monty Taylor
Next step.
961
  if (in_table_lock_wait_timeout < 1 || in_table_lock_wait_timeout > 1024*1024*1024)
962
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
963
    cout << _("Error: Invalid Value for table_lock_wait_timeout");
1757.2.4 by Monty Taylor
Next step.
964
    exit(-1);
965
  }
966
  table_lock_wait_timeout= in_table_lock_wait_timeout;
967
}
968
969
static void check_limits_thread_stack(uint32_t in_my_thread_stack_size)
970
{
971
  my_thread_stack_size= in_my_thread_stack_size - (in_my_thread_stack_size % 1024);
972
}
973
974
static void check_limits_tmp_table_size(uint64_t in_tmp_table_size)
975
{
1757.3.1 by Andrew Hutchings
Hacky quick fix for mtaylor's problem:
976
  global_system_variables.tmp_table_size= 16*1024*1024L;
1757.2.4 by Monty Taylor
Next step.
977
  if (in_tmp_table_size < 1024 || in_tmp_table_size > MAX_MEM_TABLE_SIZE)
978
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
979
    cout << _("Error: Invalid Value for table_lock_wait_timeout");
1757.2.4 by Monty Taylor
Next step.
980
    exit(-1);
981
  }
982
  global_system_variables.tmp_table_size= in_tmp_table_size;
983
}
984
1802.14.1 by Joseph Daly
add variable for gpb size
985
static void check_limits_transaction_message_threshold(size_t in_transaction_message_threshold)
986
{
2132.3.1 by Andrew Hutchings
Make transaction_message_threshold a read-only global variable instead of a per-session variable
987
  transaction_message_threshold= 1024*1024;
1802.14.1 by Joseph Daly
add variable for gpb size
988
  if ((int64_t) in_transaction_message_threshold < 128*1024 || (int64_t)in_transaction_message_threshold > 1024*1024)
989
  {
2068.4.1 by Andrew Hutchings
Fix intl domain
990
    cout << _("Error: Invalid Value for transaction_message_threshold valid values are between 131072 - 1048576 bytes");
1802.14.1 by Joseph Daly
add variable for gpb size
991
    exit(-1);
992
  }
2132.3.1 by Andrew Hutchings
Make transaction_message_threshold a read-only global variable instead of a per-session variable
993
  transaction_message_threshold= in_transaction_message_threshold;
1802.14.1 by Joseph Daly
add variable for gpb size
994
}
995
1776.4.3 by Monty Taylor
Add config-dir option.
996
static void process_defaults_files()
997
{
2246.4.1 by Olaf van der Spek
Use BOOST_FOREACH
998
	BOOST_FOREACH(vector<string>::reference iter, defaults_file_list)
1776.4.3 by Monty Taylor
Add config-dir option.
999
  {
2246.4.1 by Olaf van der Spek
Use BOOST_FOREACH
1000
    fs::path file_location= iter;
1776.4.6 by Monty Taylor
Made config files work with a hack - need to go back in and properly deal
1001
1813.2.15 by Monty Taylor
migrated config-dir.
1002
    ifstream input_defaults_file(file_location.file_string().c_str());
2224.1.1 by Olaf van der Spek
Finish removing XID cache
1003
2318.5.31 by Olaf van der Spek
Refactor
1004
    po::parsed_options file_parsed= dpo::parse_config_file(input_defaults_file, full_options, true);
1005
    vector<string> file_unknown= po::collect_unrecognized(file_parsed.options, po::include_positional);
1776.4.6 by Monty Taylor
Made config files work with a hack - need to go back in and properly deal
1006
2318.5.31 by Olaf van der Spek
Refactor
1007
    for (vector<string>::iterator it= file_unknown.begin(); it != file_unknown.end(); ++it)
1776.4.6 by Monty Taylor
Made config files work with a hack - need to go back in and properly deal
1008
    {
2318.5.31 by Olaf van der Spek
Refactor
1009
      string new_unknown_opt("--" + *it);
1776.4.6 by Monty Taylor
Made config files work with a hack - need to go back in and properly deal
1010
      ++it;
2246.4.1 by Olaf van der Spek
Use BOOST_FOREACH
1011
      if (it == file_unknown.end())
1012
				break;
2318.5.31 by Olaf van der Spek
Refactor
1013
      if (*it != "true")
1014
        new_unknown_opt += "=" + *it;
1776.4.6 by Monty Taylor
Made config files work with a hack - need to go back in and properly deal
1015
      unknown_options.push_back(new_unknown_opt);
1016
    }
1017
    store(file_parsed, vm);
1776.4.3 by Monty Taylor
Add config-dir option.
1018
  }
1019
}
1020
2318.5.31 by Olaf van der Spek
Refactor
1021
static void compose_defaults_file_list(const vector<string>& in_options)
1776.4.3 by Monty Taylor
Add config-dir option.
1022
{
2318.5.31 by Olaf van der Spek
Refactor
1023
	BOOST_FOREACH(const string& it, in_options)
1776.4.3 by Monty Taylor
Add config-dir option.
1024
  {
2246.4.1 by Olaf van der Spek
Use BOOST_FOREACH
1025
    fs::path p(it);
1883.2.2 by Andrew Hutchings
Error if a defaults-file is missing
1026
    if (fs::is_regular_file(p))
2246.4.1 by Olaf van der Spek
Use BOOST_FOREACH
1027
      defaults_file_list.push_back(it);
1883.2.2 by Andrew Hutchings
Error if a defaults-file is missing
1028
    else
1029
    {
2246.4.1 by Olaf van der Spek
Use BOOST_FOREACH
1030
      errmsg_printf(error::ERROR, _("Defaults file '%s' not found\n"), it.c_str());
1883.2.2 by Andrew Hutchings
Error if a defaults-file is missing
1031
      unireg_abort(1);
1032
    }
1776.4.3 by Monty Taylor
Add config-dir option.
1033
  }
1034
}
1757.2.4 by Monty Taylor
Next step.
1035
2131.10.7 by Stewart Smith
partition the initialisation of variables and command line options into two phases: the first being the simple one (that we can get out the --daemon option for) and the second being loading plugins, pidfile setup etc. This makes --daemon do the pidfile correctly.
1036
int init_basic_variables(int argc, char **argv)
1 by brian
clean slate
1037
{
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
1038
  umask(((~internal::my_umask) & 0666));
2034.2.4 by Brian Aker
Further encapsulation for DECIMAL.
1039
  decimal_zero.set_zero(); // set decimal_zero constant;
1 by brian
clean slate
1040
  tzset();			// Set tzname
1041
2318.5.31 by Olaf van der Spek
Refactor
1042
  time_t curr_time= time(NULL);
685.3.4 by Toru Maesaka
Fixed the issues pointed out by Jay's code review
1043
  if (curr_time == (time_t)-1)
685.3.2 by Toru Maesaka
Removed my_time() and added error checking
1044
    return 1;
1045
298 by Brian Aker
ulong conversion.
1046
  max_system_variables.pseudo_thread_id= UINT32_MAX;
685.3.4 by Toru Maesaka
Fixed the issues pointed out by Jay's code review
1047
  server_start_time= flush_status_time= curr_time;
1 by brian
clean slate
1048
574.2.1 by ysano
Rename mysql to drizzle.
1049
  drizzle_init_variables();
1 by brian
clean slate
1050
1794.3.4 by Monty Taylor
Fixed plugin dir sequencing
1051
  find_plugin_dir(argv[0]);
1 by brian
clean slate
1052
2183.1.2 by Monty Taylor
A slew of tiny meaningless changes.
1053
  char ret_hostname[FN_REFLEN];
1054
  if (gethostname(ret_hostname,sizeof(ret_hostname)) < 0)
1 by brian
clean slate
1055
  {
2318.5.31 by Olaf van der Spek
Refactor
1056
    errmsg_printf(error::WARN, _("gethostname failed, using '%s' as hostname"), getServerHostname().c_str());
1813.2.2 by Monty Taylor
Replaced pid-file with fs::path.
1057
    pid_file= "drizzle";
1 by brian
clean slate
1058
  }
1059
  else
1813.2.2 by Monty Taylor
Replaced pid-file with fs::path.
1060
  {
2318.5.31 by Olaf van der Spek
Refactor
1061
    g_hostname= ret_hostname;
2183.1.2 by Monty Taylor
A slew of tiny meaningless changes.
1062
    pid_file= getServerHostname();
1813.2.2 by Monty Taylor
Replaced pid-file with fs::path.
1063
  }
1064
  pid_file.replace_extension(".pid");
1 by brian
clean slate
1065
1813.2.15 by Monty Taylor
migrated config-dir.
1066
  system_config_dir /= "drizzle";
1757.2.4 by Monty Taylor
Next step.
1067
1794.3.1 by Monty Taylor
Rearranged option processing.
1068
  config_options.add_options()
1757.5.1 by Andrew Hutchings
Rework the boolean options so that true-by-default options change to --disable-option.
1069
  ("help,?", po::value<bool>(&opt_help)->default_value(false)->zero_tokens(),
2068.4.1 by Andrew Hutchings
Fix intl domain
1070
  _("Display this help and exit."))
2131.10.1 by Stewart Smith
add a very simple --daemon or -d option to drizzled using the exact same code as memcached to start as a daemon.
1071
  ("daemon,d", po::value<bool>(&opt_daemon)->default_value(false)->zero_tokens(),
1072
  _("Run as a daemon."))
1794.3.1 by Monty Taylor
Rearranged option processing.
1073
  ("no-defaults", po::value<bool>()->default_value(false)->zero_tokens(),
2068.4.1 by Andrew Hutchings
Fix intl domain
1074
  _("Configuration file defaults are not used if no-defaults is set"))
1794.3.1 by Monty Taylor
Rearranged option processing.
1075
  ("defaults-file", po::value<vector<string> >()->composing()->notifier(&compose_defaults_file_list),
2068.4.1 by Andrew Hutchings
Fix intl domain
1076
  _("Configuration file to use"))
1813.2.15 by Monty Taylor
migrated config-dir.
1077
  ("config-dir", po::value<fs::path>(&system_config_dir),
2068.4.1 by Andrew Hutchings
Fix intl domain
1078
  _("Base location for config files"))
1813.2.7 by Monty Taylor
Migrated plugin_dir to fs::path.
1079
  ("plugin-dir", po::value<fs::path>(&plugin_dir)->notifier(&notify_plugin_dir),
2068.4.1 by Andrew Hutchings
Fix intl domain
1080
  _("Directory for plugins."))
1794.3.1 by Monty Taylor
Rearranged option processing.
1081
  ;
1082
1083
  plugin_load_options.add_options()
1084
  ("plugin-add", po::value<vector<string> >()->composing()->notifier(&compose_plugin_add),
2068.4.1 by Andrew Hutchings
Fix intl domain
1085
  _("Optional comma separated list of plugins to load at startup in addition "
1794.3.1 by Monty Taylor
Rearranged option processing.
1086
     "to the default list of plugins. "
2224.1.1 by Olaf van der Spek
Finish removing XID cache
1087
     "[for example: --plugin_add=crc32,logger_gearman]"))
1794.3.1 by Monty Taylor
Rearranged option processing.
1088
  ("plugin-remove", po::value<vector<string> >()->composing()->notifier(&compose_plugin_remove),
2068.4.1 by Andrew Hutchings
Fix intl domain
1089
  _("Optional comma separated list of plugins to not load at startup. Effectively "
1794.3.1 by Monty Taylor
Rearranged option processing.
1090
     "removes a plugin from the list of plugins to be loaded. "
1091
     "[for example: --plugin_remove=crc32,logger_gearman]"))
1092
  ("plugin-load", po::value<string>()->notifier(&notify_plugin_load)->default_value(PANDORA_PLUGIN_LIST),
2068.4.1 by Andrew Hutchings
Fix intl domain
1093
  _("Optional comma separated list of plugins to load at starup instead of "
1794.3.1 by Monty Taylor
Rearranged option processing.
1094
     "the default plugin load list. "
1095
     "[for example: --plugin_load=crc32,logger_gearman]"))
1096
  ;
1097
1098
  long_options.add_options()
1757.2.4 by Monty Taylor
Next step.
1099
  ("auto-increment-increment", po::value<uint64_t>(&global_system_variables.auto_increment_increment)->default_value(1)->notifier(&check_limits_aii),
2068.4.1 by Andrew Hutchings
Fix intl domain
1100
  _("Auto-increment columns are incremented by this"))
1757.2.4 by Monty Taylor
Next step.
1101
  ("auto-increment-offset", po::value<uint64_t>(&global_system_variables.auto_increment_offset)->default_value(1)->notifier(&check_limits_aio),
2068.4.1 by Andrew Hutchings
Fix intl domain
1102
  _("Offset added to Auto-increment columns. Used when auto-increment-increment != 1"))
1813.2.4 by Monty Taylor
Set basedir directly from po.
1103
  ("basedir,b", po::value<fs::path>(&basedir),
2068.4.1 by Andrew Hutchings
Fix intl domain
1104
  _("Path to installation directory. All paths are usually resolved "
1757.2.4 by Monty Taylor
Next step.
1105
     "relative to this."))
1106
  ("chroot,r", po::value<string>(),
2068.4.1 by Andrew Hutchings
Fix intl domain
1107
  _("Chroot drizzled daemon during startup."))
1757.2.4 by Monty Taylor
Next step.
1108
  ("collation-server", po::value<string>(),
2224.1.1 by Olaf van der Spek
Finish removing XID cache
1109
  _("Set the default collation."))
1757.2.4 by Monty Taylor
Next step.
1110
  ("completion-type", po::value<uint32_t>(&global_system_variables.completion_type)->default_value(0)->notifier(&check_limits_completion_type),
2068.4.1 by Andrew Hutchings
Fix intl domain
1111
  _("Default completion type."))
1112
  ("core-file",  _("Write core on errors."))
2318.5.30 by Olaf van der Spek
Refactor
1113
  ("datadir", po::value<fs::path>(&getMutableDataHome()),
2068.4.1 by Andrew Hutchings
Fix intl domain
1114
  _("Path to the database root."))
1757.2.4 by Monty Taylor
Next step.
1115
  ("default-storage-engine", po::value<string>(),
2068.4.1 by Andrew Hutchings
Fix intl domain
1116
  _("Set the default storage engine for tables."))
1757.2.4 by Monty Taylor
Next step.
1117
  ("default-time-zone", po::value<string>(),
2068.4.1 by Andrew Hutchings
Fix intl domain
1118
  _("Set the default time zone."))
1757.2.4 by Monty Taylor
Next step.
1119
  ("exit-info,T", po::value<long>(),
2068.4.1 by Andrew Hutchings
Fix intl domain
1120
  _("Used for debugging;  Use at your own risk!"))
1757.5.1 by Andrew Hutchings
Rework the boolean options so that true-by-default options change to --disable-option.
1121
  ("gdb", po::value<bool>(&opt_debugging)->default_value(false)->zero_tokens(),
2068.4.1 by Andrew Hutchings
Fix intl domain
1122
  _("Set up signals usable for debugging"))
1757.2.4 by Monty Taylor
Next step.
1123
  ("lc-time-name", po::value<string>(),
2068.4.1 by Andrew Hutchings
Fix intl domain
1124
  _("Set the language used for the month names and the days of the week."))
1816.2.3 by Monty Taylor
Fixed some more ICC warnings. How did I get started on this this morning?
1125
  ("log-warnings,W", po::value<bool>(&global_system_variables.log_warnings)->default_value(false)->zero_tokens(),
2224.1.1 by Olaf van der Spek
Finish removing XID cache
1126
  _("Log some not critical warnings to the log file."))
1813.2.5 by Monty Taylor
Use pid-file directly from variables map.
1127
  ("pid-file", po::value<fs::path>(&pid_file),
2068.4.1 by Andrew Hutchings
Fix intl domain
1128
  _("Pid file used by drizzled."))
1757.2.4 by Monty Taylor
Next step.
1129
  ("port-open-timeout", po::value<uint32_t>(&drizzled_bind_timeout)->default_value(0),
2068.4.1 by Andrew Hutchings
Fix intl domain
1130
  _("Maximum time in seconds to wait for the port to become free. "))
1938.3.1 by David Shrewsbury
Add --replicate-query option.
1131
  ("replicate-query", po::value<bool>(&global_system_variables.replicate_query)->default_value(false)->zero_tokens(),
2068.4.1 by Andrew Hutchings
Fix intl domain
1132
  _("Include the SQL query in replicated protobuf messages."))
1813.2.10 by Monty Taylor
Expand secure-file-priv once at startup rather than on each path check.
1133
  ("secure-file-priv", po::value<fs::path>(&secure_file_priv)->notifier(expand_secure_file_priv),
2068.4.1 by Andrew Hutchings
Fix intl domain
1134
  _("Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files "
1757.2.4 by Monty Taylor
Next step.
1135
     "within specified directory"))
1136
  ("server-id", po::value<uint32_t>(&server_id)->default_value(0),
2068.4.1 by Andrew Hutchings
Fix intl domain
1137
  _("Uniquely identifies the server instance in the community of "
1757.2.4 by Monty Taylor
Next step.
1138
     "replication partners."))
2224.1.1 by Olaf van der Spek
Finish removing XID cache
1139
  ("skip-stack-trace",
2068.4.1 by Andrew Hutchings
Fix intl domain
1140
  _("Don't print a stack trace on failure."))
1757.5.1 by Andrew Hutchings
Rework the boolean options so that true-by-default options change to --disable-option.
1141
  ("symbolic-links,s", po::value<bool>(&internal::my_use_symdir)->default_value(IF_PURIFY(false,true))->zero_tokens(),
2068.4.1 by Andrew Hutchings
Fix intl domain
1142
  _("Enable symbolic link support."))
1757.5.1 by Andrew Hutchings
Rework the boolean options so that true-by-default options change to --disable-option.
1143
  ("timed-mutexes", po::value<bool>(&internal::timed_mutexes)->default_value(false)->zero_tokens(),
2068.4.1 by Andrew Hutchings
Fix intl domain
1144
  _("Specify whether to time mutexes (only InnoDB mutexes are currently "
2224.1.1 by Olaf van der Spek
Finish removing XID cache
1145
     "supported)"))
1757.2.4 by Monty Taylor
Next step.
1146
  ("tmpdir,t", po::value<string>(),
2068.4.1 by Andrew Hutchings
Fix intl domain
1147
  _("Path for temporary files."))
1757.2.4 by Monty Taylor
Next step.
1148
  ("transaction-isolation", po::value<string>(),
2068.4.1 by Andrew Hutchings
Fix intl domain
1149
  _("Default transaction isolation level."))
2132.3.1 by Andrew Hutchings
Make transaction_message_threshold a read-only global variable instead of a per-session variable
1150
  ("transaction-message-threshold", po::value<size_t>(&transaction_message_threshold)->default_value(1024*1024)->notifier(&check_limits_transaction_message_threshold),
2068.4.1 by Andrew Hutchings
Fix intl domain
1151
  _("Max message size written to transaction log, valid values 131072 - 1048576 bytes."))
1757.2.4 by Monty Taylor
Next step.
1152
  ("user,u", po::value<string>(),
2224.1.1 by Olaf van der Spek
Finish removing XID cache
1153
  _("Run drizzled daemon as user."))
1154
  ("version,V",
2068.4.1 by Andrew Hutchings
Fix intl domain
1155
  _("Output version information and exit."))
1863.1.7 by Monty Taylor
Add a constrained_value class which allows us to set compile-time
1156
  ("back-log", po::value<back_log_constraints>(&back_log),
2068.4.1 by Andrew Hutchings
Fix intl domain
1157
  _("The number of outstanding connection requests Drizzle can have. This "
1757.2.4 by Monty Taylor
Next step.
1158
     "comes into play when the main Drizzle thread gets very many connection "
1159
     "requests in a very short time."))
2224.1.1 by Olaf van der Spek
Finish removing XID cache
1160
  ("bulk-insert-buffer-size",
1757.2.4 by Monty Taylor
Next step.
1161
  po::value<uint64_t>(&global_system_variables.bulk_insert_buff_size)->default_value(8192*1024),
2068.4.1 by Andrew Hutchings
Fix intl domain
1162
  _("Size of tree cache used in bulk insert optimization. Note that this is "
1757.2.4 by Monty Taylor
Next step.
1163
     "a limit per thread!"))
1164
  ("div-precision-increment",  po::value<uint32_t>(&global_system_variables.div_precincrement)->default_value(4)->notifier(&check_limits_dpi),
2068.4.1 by Andrew Hutchings
Fix intl domain
1165
  _("Precision of the result of '/' operator will be increased on that "
1757.2.4 by Monty Taylor
Next step.
1166
     "value."))
1167
  ("group-concat-max-len", po::value<uint64_t>(&global_system_variables.group_concat_max_len)->default_value(1024)->notifier(&check_limits_gcml),
2068.4.1 by Andrew Hutchings
Fix intl domain
1168
  _("The maximum length of the result of function  group_concat."))
1757.2.4 by Monty Taylor
Next step.
1169
  ("join-buffer-size", po::value<uint64_t>(&global_system_variables.join_buff_size)->default_value(128*1024L)->notifier(&check_limits_join_buffer_size),
2068.4.1 by Andrew Hutchings
Fix intl domain
1170
  _("The size of the buffer that is used for full joins."))
1796.4.9 by Andrew Hutchings
Add join cache global constraint
1171
  ("join-heap-threshold",
1172
  po::value<uint64_t>()->default_value(0),
2068.4.1 by Andrew Hutchings
Fix intl domain
1173
  _("A global cap on the amount of memory that can be allocated by session join buffers (0 means unlimited)"))
1877.1.3 by Andrew Hutchings
Make default max_packet_size 64MB as 1MB doesn't seem really sane for text/blob columns
1174
  ("max-allowed-packet", po::value<uint32_t>(&global_system_variables.max_allowed_packet)->default_value(64*1024*1024L)->notifier(&check_limits_map),
2068.4.1 by Andrew Hutchings
Fix intl domain
1175
  _("Max packetlength to send/receive from to server."))
1757.2.4 by Monty Taylor
Next step.
1176
  ("max-error-count", po::value<uint64_t>(&global_system_variables.max_error_count)->default_value(DEFAULT_ERROR_COUNT)->notifier(&check_limits_max_err_cnt),
2068.4.1 by Andrew Hutchings
Fix intl domain
1177
  _("Max number of errors/warnings to store for a statement."))
1757.2.4 by Monty Taylor
Next step.
1178
  ("max-heap-table-size", po::value<uint64_t>(&global_system_variables.max_heap_table_size)->default_value(16*1024*1024L)->notifier(&check_limits_mhts),
2068.4.1 by Andrew Hutchings
Fix intl domain
1179
  _("Don't allow creation of heap tables bigger than this."))
2246.4.6 by Olaf van der Spek
Remove some unnecessary drizzled::
1180
  ("max-join-size", po::value<ha_rows>(&global_system_variables.max_join_size)->default_value(INT32_MAX)->notifier(&check_limits_max_join_size),
2068.4.1 by Andrew Hutchings
Fix intl domain
1181
  _("Joins that are probably going to read more than max_join_size records "
1757.2.4 by Monty Taylor
Next step.
1182
     "return an error."))
1183
  ("max-length-for-sort-data", po::value<uint64_t>(&global_system_variables.max_length_for_sort_data)->default_value(1024)->notifier(&check_limits_mlfsd),
2068.4.1 by Andrew Hutchings
Fix intl domain
1184
  _("Max number of bytes in sorted records."))
1757.2.4 by Monty Taylor
Next step.
1185
  ("max-seeks-for-key", po::value<uint64_t>(&global_system_variables.max_seeks_for_key)->default_value(ULONG_MAX)->notifier(&check_limits_msfk),
2068.4.1 by Andrew Hutchings
Fix intl domain
1186
  _("Limit assumed max number of seeks when looking up rows based on a key"))
2224.1.1 by Olaf van der Spek
Finish removing XID cache
1187
  ("max-sort-length", po::value<size_t>(&global_system_variables.max_sort_length)->default_value(1024)->notifier(&check_limits_max_sort_length),
2068.4.1 by Andrew Hutchings
Fix intl domain
1188
  _("The number of bytes to use when sorting BLOB or TEXT values "
1757.2.4 by Monty Taylor
Next step.
1189
     "(only the first max_sort_length bytes of each value are used; the "
1190
     "rest are ignored)."))
1813.2.9 by Monty Taylor
Made data_home be fs::path natively.
1191
  ("max-write-lock-count", po::value<uint64_t>(&max_write_lock_count)->default_value(UINT64_MAX),
2068.4.1 by Andrew Hutchings
Fix intl domain
1192
  _("After this many write locks, allow some read locks to run in between."))
1757.2.4 by Monty Taylor
Next step.
1193
  ("min-examined-row-limit", po::value<uint64_t>(&global_system_variables.min_examined_row_limit)->default_value(0)->notifier(&check_limits_merl),
2068.4.1 by Andrew Hutchings
Fix intl domain
1194
  _("Don't log queries which examine less than min_examined_row_limit "
1757.2.4 by Monty Taylor
Next step.
1195
     "rows to file."))
1757.5.1 by Andrew Hutchings
Rework the boolean options so that true-by-default options change to --disable-option.
1196
  ("disable-optimizer-prune",
2068.4.1 by Andrew Hutchings
Fix intl domain
1197
  _("Do not apply any heuristic(s) during query optimization to prune, "
1757.5.1 by Andrew Hutchings
Rework the boolean options so that true-by-default options change to --disable-option.
1198
     "thus perform an exhaustive search from the optimizer search space."))
1757.2.4 by Monty Taylor
Next step.
1199
  ("optimizer-search-depth", po::value<uint32_t>(&global_system_variables.optimizer_search_depth)->default_value(0)->notifier(&check_limits_osd),
2068.4.1 by Andrew Hutchings
Fix intl domain
1200
  _("Maximum depth of search performed by the query optimizer. Values "
1757.2.4 by Monty Taylor
Next step.
1201
     "larger than the number of relations in a query result in better query "
1202
     "plans, but take longer to compile a query. Smaller values than the "
1203
     "number of tables in a relation result in faster optimization, but may "
1204
     "produce very bad query plans. If set to 0, the system will "
1205
     "automatically pick a reasonable value; if set to MAX_TABLES+2, the "
1206
     "optimizer will switch to the original find_best (used for "
1207
     "testing/comparison)."))
1208
  ("preload-buffer-size", po::value<uint64_t>(&global_system_variables.preload_buff_size)->default_value(32*1024L)->notifier(&check_limits_pbs),
2068.4.1 by Andrew Hutchings
Fix intl domain
1209
  _("The size of the buffer that is allocated when preloading indexes"))
2224.1.1 by Olaf van der Spek
Finish removing XID cache
1210
  ("query-alloc-block-size",
1757.2.4 by Monty Taylor
Next step.
1211
  po::value<uint32_t>(&global_system_variables.query_alloc_block_size)->default_value(QUERY_ALLOC_BLOCK_SIZE)->notifier(&check_limits_qabs),
2068.4.1 by Andrew Hutchings
Fix intl domain
1212
  _("Allocation block size for query parsing and execution"))
1757.2.4 by Monty Taylor
Next step.
1213
  ("query-prealloc-size",
1214
  po::value<uint32_t>(&global_system_variables.query_prealloc_size)->default_value(QUERY_ALLOC_PREALLOC_SIZE)->notifier(&check_limits_qps),
2068.4.1 by Andrew Hutchings
Fix intl domain
1215
  _("Persistent buffer for query parsing and execution"))
1757.2.4 by Monty Taylor
Next step.
1216
  ("range-alloc-block-size",
1217
  po::value<size_t>(&global_system_variables.range_alloc_block_size)->default_value(RANGE_ALLOC_BLOCK_SIZE)->notifier(&check_limits_rabs),
2068.4.1 by Andrew Hutchings
Fix intl domain
1218
  _("Allocation block size for storing ranges during optimization"))
1757.2.4 by Monty Taylor
Next step.
1219
  ("read-buffer-size",
1220
  po::value<uint32_t>(&global_system_variables.read_buff_size)->default_value(128*1024L)->notifier(&check_limits_read_buffer_size),
2068.4.1 by Andrew Hutchings
Fix intl domain
1221
  _("Each thread that does a sequential scan allocates a buffer of this "
1757.2.4 by Monty Taylor
Next step.
1222
      "size for each table it scans. If you do many sequential scans, you may "
1223
      "want to increase this value."))
1796.4.11 by Andrew Hutchings
Add global constraint on read buffer
1224
  ("read-buffer-threshold",
1225
  po::value<uint64_t>()->default_value(0),
2068.4.1 by Andrew Hutchings
Fix intl domain
1226
  _("A global cap on the size of read-buffer-size (0 means unlimited)"))
1757.2.4 by Monty Taylor
Next step.
1227
  ("read-rnd-buffer-size",
1228
  po::value<uint32_t>(&global_system_variables.read_rnd_buff_size)->default_value(256*1024L)->notifier(&check_limits_read_rnd_buffer_size),
2068.4.1 by Andrew Hutchings
Fix intl domain
1229
  _("When reading rows in sorted order after a sort, the rows are read "
1757.2.4 by Monty Taylor
Next step.
1230
     "through this buffer to avoid a disk seeks. If not set, then it's set "
1231
     "to the value of record_buffer."))
1796.4.10 by Andrew Hutchings
Add global constraint for --read-rnd-buffer-size
1232
  ("read-rnd-threshold",
1233
  po::value<uint64_t>()->default_value(0),
2068.4.1 by Andrew Hutchings
Fix intl domain
1234
  _("A global cap on the size of read-rnd-buffer-size (0 means unlimited)"))
1757.2.4 by Monty Taylor
Next step.
1235
  ("scheduler", po::value<string>(),
2068.4.1 by Andrew Hutchings
Fix intl domain
1236
  _("Select scheduler to be used (by default multi-thread)."))
1757.2.4 by Monty Taylor
Next step.
1237
  ("sort-buffer-size",
1238
  po::value<size_t>(&global_system_variables.sortbuff_size)->default_value(MAX_SORT_MEMORY)->notifier(&check_limits_sort_buffer_size),
2068.4.1 by Andrew Hutchings
Fix intl domain
1239
  _("Each thread that needs to do a sort allocates a buffer of this size."))
1796.4.1 by Andrew Hutchings
Add initial template work and test
1240
  ("sort-heap-threshold",
1796.4.8 by Andrew Hutchings
Change default setting
1241
  po::value<uint64_t>()->default_value(0),
2068.4.1 by Andrew Hutchings
Fix intl domain
1242
  _("A global cap on the amount of memory that can be allocated by session sort buffers (0 means unlimited)"))
1757.2.4 by Monty Taylor
Next step.
1243
  ("table-definition-cache", po::value<size_t>(&table_def_size)->default_value(128)->notifier(&check_limits_tdc),
2068.4.1 by Andrew Hutchings
Fix intl domain
1244
  _("The number of cached table definitions."))
1757.2.4 by Monty Taylor
Next step.
1245
  ("table-open-cache", po::value<uint64_t>(&table_cache_size)->default_value(TABLE_OPEN_CACHE_DEFAULT)->notifier(&check_limits_toc),
2068.4.1 by Andrew Hutchings
Fix intl domain
1246
  _("The number of cached open tables."))
1757.2.4 by Monty Taylor
Next step.
1247
  ("table-lock-wait-timeout", po::value<uint64_t>(&table_lock_wait_timeout)->default_value(50)->notifier(&check_limits_tlwt),
2068.4.1 by Andrew Hutchings
Fix intl domain
1248
  _("Timeout in seconds to wait for a table level lock before returning an "
1757.2.4 by Monty Taylor
Next step.
1249
     "error. Used only if the connection has active cursors."))
1250
  ("thread-stack", po::value<size_t>(&my_thread_stack_size)->default_value(DEFAULT_THREAD_STACK)->notifier(&check_limits_thread_stack),
2068.4.1 by Andrew Hutchings
Fix intl domain
1251
  _("The stack size for each thread."))
2224.1.1 by Olaf van der Spek
Finish removing XID cache
1252
  ("tmp-table-size",
1757.2.4 by Monty Taylor
Next step.
1253
  po::value<uint64_t>(&global_system_variables.tmp_table_size)->default_value(16*1024*1024L)->notifier(&check_limits_tmp_table_size),
2068.4.1 by Andrew Hutchings
Fix intl domain
1254
  _("If an internal in-memory temporary table exceeds this size, Drizzle will"
1757.2.4 by Monty Taylor
Next step.
1255
     " automatically convert it to an on-disk MyISAM table."))
2187.2.3 by Brian Aker
This cleans up the the error message system by providing for the ability to
1256
  ("verbose", po::value<std::string>()->default_value(error::verbose_string())->notifier(&error::check_verbosity),
2215.3.2 by Andrew Hutchings
Make mysql_protocol Listening message INFO level.
1257
  _("The verbosity of messages from drizzled.  Possible values are INSPECT, INFO, WARN or ERROR"))
1757.2.4 by Monty Taylor
Next step.
1258
  ;
1259
1794.3.1 by Monty Taylor
Rearranged option processing.
1260
  full_options.add(long_options);
1261
  full_options.add(plugin_load_options);
1262
1263
  initial_options.add(config_options);
1264
  initial_options.add(plugin_load_options);
1265
1798.2.3 by Monty Taylor
Concatenate paths differently for pid-file.
1266
  int style = po::command_line_style::default_style & ~po::command_line_style::allow_guessing;
1794.3.1 by Monty Taylor
Rearranged option processing.
1267
  /* Get options about where config files and the like are */
1793.3.1 by Andrew Hutchings
Disable boost:po allow_guessing which was making some wrong assumptions
1268
  po::parsed_options parsed= po::command_line_parser(argc, argv).style(style).
1794.3.7 by Monty Taylor
It turns out anything the extra_parser returns a value for gets consumed,
1269
    options(initial_options).allow_unregistered().run();
1757.2.6 by Monty Taylor
We've gotten further. Now things sometimes work, but some things aren't
1270
  unknown_options=
1757.2.4 by Monty Taylor
Next step.
1271
    po::collect_unrecognized(parsed.options, po::include_positional);
1272
1757.2.14 by Monty Taylor
Added in exception handling around duplicate options. Should fix for real.
1273
  try
1274
  {
1275
    po::store(parsed, vm);
1276
  }
1966.3.1 by Monty Taylor
Use std::exception instead of catch(...)
1277
  catch (std::exception&)
1757.2.14 by Monty Taylor
Added in exception handling around duplicate options. Should fix for real.
1278
  {
2126.3.3 by Brian Aker
Merge in error message rework. Many error messages are fixed in this patch.
1279
    errmsg_printf(error::ERROR, _("Duplicate entry for command line option\n"));
1757.2.14 by Monty Taylor
Added in exception handling around duplicate options. Should fix for real.
1280
    unireg_abort(1);
1281
  }
1282
1776.4.3 by Monty Taylor
Add config-dir option.
1283
  if (not vm["no-defaults"].as<bool>())
1757.2.4 by Monty Taylor
Next step.
1284
  {
1938.2.1 by Monty Taylor
Actually set default paths appropriately.
1285
    fs::path system_config_file_drizzle(system_config_dir);
1286
    system_config_file_drizzle /= "drizzled.cnf";
2318.5.30 by Olaf van der Spek
Refactor
1287
    defaults_file_list.insert(defaults_file_list.begin(), system_config_file_drizzle.file_string());
1879.3.1 by Monty Taylor
Removed some stupid extra path manipulations.
1288
1289
    fs::path config_conf_d_location(system_config_dir);
1290
    config_conf_d_location /= "conf.d";
1291
1292
    CachedDirectory config_conf_d(config_conf_d_location.file_string());
1293
    if (not config_conf_d.fail())
1776.4.4 by Monty Taylor
Added code to run-parts a conf.d dir.
1294
    {
2246.4.1 by Olaf van der Spek
Use BOOST_FOREACH
1295
			BOOST_FOREACH(CachedDirectory::Entries::const_reference iter, config_conf_d.getEntries())
1776.4.4 by Monty Taylor
Added code to run-parts a conf.d dir.
1296
      {
2246.4.1 by Olaf van der Spek
Use BOOST_FOREACH
1297
        string file_entry(iter->filename);
2318.5.30 by Olaf van der Spek
Refactor
1298
        if (not file_entry.empty() && file_entry != "." && file_entry != "..")
1299
          defaults_file_list.push_back((config_conf_d_location / file_entry).file_string());
1776.4.4 by Monty Taylor
Added code to run-parts a conf.d dir.
1300
      }
1301
    }
1302
  }
1303
1794.3.1 by Monty Taylor
Rearranged option processing.
1304
  /* TODO: here is where we should add a process_env_vars */
1305
1794.3.3 by Monty Taylor
Add an extra notify (grumble)
1306
  /* We need a notify here so that plugin_init will work properly */
1863.1.7 by Monty Taylor
Add a constrained_value class which allows us to set compile-time
1307
  try
1308
  {
1309
    po::notify(vm);
1310
  }
1311
  catch (po::validation_error &err)
1312
  {
2318.5.30 by Olaf van der Spek
Refactor
1313
    errmsg_printf(error::ERROR, _("%s: %s.\nUse --help to get a list of available options\n"), internal::my_progname, err.what());
1863.1.7 by Monty Taylor
Add a constrained_value class which allows us to set compile-time
1314
    unireg_abort(1);
1315
  }
1883.2.1 by Andrew Hutchings
The --defaults-file option was processed after a list of options files was processed, so lets change this
1316
1317
  process_defaults_files();
1318
1319
  /* Process with notify a second time because a config file may contain
1320
     plugin loader options */
1321
1322
  try
1323
  {
1324
    po::notify(vm);
1325
  }
1326
  catch (po::validation_error &err)
1327
  {
2318.5.30 by Olaf van der Spek
Refactor
1328
    errmsg_printf(error::ERROR, _("%s: %s.\nUse --help to get a list of available options\n"), internal::my_progname, err.what());
1883.2.1 by Andrew Hutchings
The --defaults-file option was processed after a list of options files was processed, so lets change this
1329
    unireg_abort(1);
1330
  }
1331
2131.10.7 by Stewart Smith
partition the initialisation of variables and command line options into two phases: the first being the simple one (that we can get out the --daemon option for) and the second being loading plugins, pidfile setup etc. This makes --daemon do the pidfile correctly.
1332
  return 0;
1333
}
1334
1335
int init_remaining_variables(module::Registry &plugins)
1336
{
1337
  int style = po::command_line_style::default_style & ~po::command_line_style::allow_guessing;
1338
1339
  current_pid= getpid();		/* Save for later ref */
1340
1794.3.1 by Monty Taylor
Rearranged option processing.
1341
  /* At this point, we've read all the options we need to read from files and
1342
     collected most of them into unknown options - now let's load everything
1343
  */
1344
1345
  if (plugin_init(plugins, plugin_options))
1346
  {
2126.3.3 by Brian Aker
Merge in error message rework. Many error messages are fixed in this patch.
1347
    errmsg_printf(error::ERROR, _("Failed to initialize plugins\n"));
1794.3.1 by Monty Taylor
Rearranged option processing.
1348
    unireg_abort(1);
1349
  }
1350
1351
  full_options.add(plugin_options);
1352
1353
  vector<string> final_unknown_options;
1354
  try
1355
  {
1356
    po::parsed_options final_parsed=
1798.2.1 by Monty Taylor
Merged in options fixes.
1357
      po::command_line_parser(unknown_options).style(style).
1926.2.1 by Monty Taylor
Add better boolean parsing and size suffix parsing.
1358
      options(full_options).extra_parser(dpo::parse_size_arg).run();
1794.3.1 by Monty Taylor
Rearranged option processing.
1359
1360
    final_unknown_options=
1361
      po::collect_unrecognized(final_parsed.options, po::include_positional);
1362
1363
    po::store(final_parsed, vm);
1364
1365
  }
1863.1.7 by Monty Taylor
Add a constrained_value class which allows us to set compile-time
1366
  catch (po::validation_error &err)
1367
  {
2126.3.3 by Brian Aker
Merge in error message rework. Many error messages are fixed in this patch.
1368
    errmsg_printf(error::ERROR,
1863.1.7 by Monty Taylor
Add a constrained_value class which allows us to set compile-time
1369
                  _("%s: %s.\n"
1370
                    "Use --help to get a list of available options\n"),
1371
                  internal::my_progname, err.what());
1372
    unireg_abort(1);
1373
  }
1794.3.1 by Monty Taylor
Rearranged option processing.
1374
  catch (po::invalid_command_line_syntax &err)
1375
  {
2126.3.3 by Brian Aker
Merge in error message rework. Many error messages are fixed in this patch.
1376
    errmsg_printf(error::ERROR,
1794.3.1 by Monty Taylor
Rearranged option processing.
1377
                  _("%s: %s.\n"
1378
                    "Use --help to get a list of available options\n"),
1379
                  internal::my_progname, err.what());
1380
    unireg_abort(1);
1381
  }
1382
  catch (po::unknown_option &err)
1383
  {
2126.3.3 by Brian Aker
Merge in error message rework. Many error messages are fixed in this patch.
1384
    errmsg_printf(error::ERROR,
1794.3.1 by Monty Taylor
Rearranged option processing.
1385
                  _("%s\nUse --help to get a list of available options\n"),
1386
                  err.what());
1387
    unireg_abort(1);
1388
  }
1757.2.4 by Monty Taylor
Next step.
1389
1863.1.7 by Monty Taylor
Add a constrained_value class which allows us to set compile-time
1390
  try
1391
  {
1392
    po::notify(vm);
1393
  }
1394
  catch (po::validation_error &err)
1395
  {
2224.1.1 by Olaf van der Spek
Finish removing XID cache
1396
    errmsg_printf(error::ERROR,
1863.1.7 by Monty Taylor
Add a constrained_value class which allows us to set compile-time
1397
                  _("%s: %s.\n"
1398
                    "Use --help to get a list of available options\n"),
1399
                  internal::my_progname, err.what());
1400
    unireg_abort(1);
1401
  }
1794.3.6 by Monty Taylor
Call po::notify _after_ get_options. Doh.
1402
1757.2.6 by Monty Taylor
We've gotten further. Now things sometimes work, but some things aren't
1403
  get_options();
1 by brian
clean slate
1404
1757.5.1 by Andrew Hutchings
Rework the boolean options so that true-by-default options change to --disable-option.
1405
  /* Inverted Booleans */
1406
2252.1.28 by Olaf van der Spek
Refactor Program Options usage
1407
  global_system_variables.optimizer_prune_level= not vm.count("disable-optimizer-prune");
1757.5.1 by Andrew Hutchings
Rework the boolean options so that true-by-default options change to --disable-option.
1408
2245.2.1 by Clint Byrum
Determine if --help was called by using the boolean rather than the count
1409
  if (! vm["help"].as<bool>())
1655.1.1 by Andrew Hutchings
1. Move message handler hook earier so that errors during init_commit_variables do not segfault
1410
  {
1776.1.1 by Monty Taylor
Allow root user to use --help.
1411
    if ((user_info= check_user(drizzled_user)))
1412
    {
1413
      set_user(drizzled_user, user_info);
1414
    }
1655.1.1 by Andrew Hutchings
1. Move message handler hook earier so that errors during init_commit_variables do not segfault
1415
  }
1416
1794.3.4 by Monty Taylor
Fixed plugin dir sequencing
1417
  fix_paths();
1655.1.1 by Andrew Hutchings
1. Move message handler hook earier so that errors during init_commit_variables do not segfault
1418
909 by Brian Aker
Remove the need for unireg init
1419
  init_time();				/* Init time-functions (read zone) */
1420
2318.6.77 by Olaf van der Spek
Refactor
1421
  item_create_init();
1878.3.1 by Monty Taylor
Split set_var.* into sys_var.* and set_var.*
1422
  if (sys_var_init())
1 by brian
clean slate
1423
    return 1;
813.1.2 by Jay Pipes
First function cleanup for temporal handling: YEAR()
1424
  /* Creates static regex matching for temporal values */
2363.1.1 by Brian Aker
Fix memory leak in temporal and json server.
1425
  if (not init_temporal_formats())
813.1.2 by Jay Pipes
First function cleanup for temporal handling: YEAR()
1426
    return 1;
1085.3.6 by Monty Taylor
Removed a problematic section that's pointless.
1427
1428
  if (!(default_charset_info=
1429
        get_charset_by_csname(default_character_set_name, MY_CS_PRIMARY)))
1 by brian
clean slate
1430
  {
2126.3.3 by Brian Aker
Merge in error message rework. Many error messages are fixed in this patch.
1431
    errmsg_printf(error::ERROR, _("Error getting default charset"));
1085.3.6 by Monty Taylor
Removed a problematic section that's pointless.
1432
    return 1;                           // Eof of the list
1 by brian
clean slate
1433
  }
1434
1794.3.2 by Andrew Hutchings
Re-enabled scheduler option.
1435
  if (vm.count("scheduler"))
1436
    opt_scheduler= vm["scheduler"].as<string>().c_str();
1437
1 by brian
clean slate
1438
  if (default_collation_name)
1439
  {
2254 by Brian Aker
Shift CHARSET_INFO to charset_info_st
1440
    const charset_info_st * const default_collation= get_charset_by_name(default_collation_name);
1273.13.38 by Brian Aker
Add in new show work.
1441
    if (not default_collation)
1 by brian
clean slate
1442
    {
2126.3.3 by Brian Aker
Merge in error message rework. Many error messages are fixed in this patch.
1443
      errmsg_printf(error::ERROR, _(ER(ER_UNKNOWN_COLLATION)), default_collation_name);
1 by brian
clean slate
1444
      return 1;
1445
    }
1273.13.38 by Brian Aker
Add in new show work.
1446
    if (not my_charset_same(default_charset_info, default_collation))
1 by brian
clean slate
1447
    {
2126.3.3 by Brian Aker
Merge in error message rework. Many error messages are fixed in this patch.
1448
      errmsg_printf(error::ERROR, _(ER(ER_COLLATION_CHARSET_MISMATCH)),
1273.13.38 by Brian Aker
Add in new show work.
1449
                    default_collation_name,
1450
                    default_charset_info->csname);
1 by brian
clean slate
1451
      return 1;
1452
    }
1453
    default_charset_info= default_collation;
1454
  }
1455
  /* Set collactions that depends on the default collation */
1456
  global_system_variables.collation_server=	 default_charset_info;
1457
1273.13.38 by Brian Aker
Add in new show work.
1458
  if (not (character_set_filesystem=
1309.2.15 by Brian Aker
Small cleanup around alter table.
1459
           get_charset_by_csname(character_set_filesystem_name, MY_CS_PRIMARY)))
1743.4.1 by LinuxJedi
Make sure unireg_abort shows the reason for the fail.
1460
  {
2126.3.3 by Brian Aker
Merge in error message rework. Many error messages are fixed in this patch.
1461
    errmsg_printf(error::ERROR, _("Error setting collation"));
1 by brian
clean slate
1462
    return 1;
1743.4.1 by LinuxJedi
Make sure unireg_abort shows the reason for the fail.
1463
  }
1 by brian
clean slate
1464
  global_system_variables.character_set_filesystem= character_set_filesystem;
1465
1466
  if (!(my_default_lc_time_names=
1467
        my_locale_by_name(lc_time_names_name)))
1468
  {
2126.3.3 by Brian Aker
Merge in error message rework. Many error messages are fixed in this patch.
1469
    errmsg_printf(error::ERROR, _("Unknown locale: '%s'"), lc_time_names_name);
1 by brian
clean slate
1470
    return 1;
1471
  }
1472
  global_system_variables.lc_time_names= my_default_lc_time_names;
236.1.40 by Monty Taylor
A few meaningless changes.
1473
1039.1.5 by Brian Aker
Remove lower case filename bits (aka we just lock into the most compatible
1474
  /* Reset table_alias_charset */
224.2.1 by Brian Aker
First pass for table name issue across platforms.
1475
  table_alias_charset= files_charset_info;
1 by brian
clean slate
1476
1477
  return 0;
1478
}
1479
1480
2318.6.57 by Olaf van der Spek
Refactor
1481
void init_server_components(module::Registry &plugins)
1 by brian
clean slate
1482
{
1483
  /*
1484
    We need to call each of these following functions to ensure that
1485
    all things are initialized so that unireg_abort() doesn't fail
1486
  */
1877.2.9 by Brian Aker
Adding cache.h for definition.
1487
1488
  // Resize the definition Cache at startup
2275.3.1 by Olaf van der Spek
Remove table::Cache::singleton()
1489
  table::Cache::rehash(table_def_size);
2275.3.6 by Olaf van der Spek
Definition Cache
1490
  definition::Cache::rehash(table_def_size);
1910.2.14 by Brian Aker
Check simple cache performance hit.
1491
  message::Cache::singleton().rehash(table_def_size);
1 by brian
clean slate
1492
1493
  setup_fpu();
1494
1495
  /* Allow storage engine to give real error messages */
1271.7.9 by Tim Penhey
Almost there.
1496
  ha_init_errors();
1 by brian
clean slate
1497
1802.8.3 by Monty Taylor
Remove help-extended.
1498
  if (opt_help)
1 by brian
clean slate
1499
    unireg_abort(0);
1500
1794.3.5 by Monty Taylor
Fixed temporoary dir sequencing.
1501
  if (plugin_finalize(plugins))
1502
  {
1503
    unireg_abort(1);
1504
  }
1672.2.1 by Monty Taylor
Fixed plugin option processing. Now we pre-load the modules registering
1505
2318.2.16 by Olaf van der Spek
Refactor
1506
  if (plugin::Scheduler::setPlugin(opt_scheduler))
1507
  {
1508
      errmsg_printf(error::ERROR, _("No scheduler found, cannot continue!\n"));
994.2.2 by Monty Taylor
Store a Registry of SchedulerFactories and set one of them at startup for better error messages earlier.
1509
      unireg_abort(1);
1510
  }
1511
1 by brian
clean slate
1512
  /*
971.1.22 by Monty Taylor
Moved storage engine initialization to init methods.
1513
    This is entirely for legacy. We will create a new "disk based" engine and a
1115.1.3 by Brian Aker
Remove final bits of "myisam" specific from drizzled.cc
1514
    "memory" engine which will be configurable longterm.
971.1.22 by Monty Taylor
Moved storage engine initialization to init methods.
1515
  */
2318.2.16 by Olaf van der Spek
Refactor
1516
  myisam_engine= plugin::StorageEngine::findByName("MyISAM");
1517
  heap_engine= plugin::StorageEngine::findByName("MEMORY");
971.1.22 by Monty Taylor
Moved storage engine initialization to init methods.
1518
1519
  /*
1 by brian
clean slate
1520
    Check that the default storage engine is actually available.
1521
  */
1522
  if (default_storage_engine_str)
1523
  {
2318.2.16 by Olaf van der Spek
Refactor
1524
    plugin::StorageEngine *engine= plugin::StorageEngine::findByName(default_storage_engine_str);
1095.3.32 by Stewart Smith
misc codestyle fixes. usually around if ( and associated conditions
1525
    if (engine == NULL)
971.1.21 by Monty Taylor
Store StorageEngine in system variables, rather than storage engine plugin.
1526
    {
2318.2.16 by Olaf van der Spek
Refactor
1527
      errmsg_printf(error::ERROR, _("Unknown/unsupported storage engine: %s\n"), default_storage_engine_str);
1273.1.20 by Jay Pipes
Remove StorageEngine::start_consitent_snapshot() and StorageEngine::enable(), disable() and is_enabled(). Unused.
1528
      unireg_abort(1);
1529
    }
1530
    global_system_variables.storage_engine= engine;
1 by brian
clean slate
1531
  }
1532
1720.5.3 by Monty Taylor
Removed a HASH in xa_resource_manager. It's not actually used, but I left it
1533
  if (plugin::XaResourceManager::recoverAllXids())
1 by brian
clean slate
1534
  {
1743.4.1 by LinuxJedi
Make sure unireg_abort shows the reason for the fail.
1535
    /* This function alredy generates error messages */
1 by brian
clean slate
1536
    unireg_abort(1);
1537
  }
1538
1539
  init_update_queries();
1540
}
1541
1542
1543
/****************************************************************************
1544
  Handle start options
1545
******************************************************************************/
1546
575.4.4 by Yoshinori Sano
Rename mysql to drizzle.
1547
enum options_drizzled
1 by brian
clean slate
1548
{
1067.1.4 by Stewart Smith
remove unused log-isam server option
1549
  OPT_SOCKET=256,
2224.1.1 by Olaf van der Spek
Finish removing XID cache
1550
  OPT_BIND_ADDRESS,
1115.1.2 by Brian Aker
Taylor the defaults for MyISAM for its "tmp" behavior.
1551
  OPT_PID_FILE,
2224.1.1 by Olaf van der Spek
Finish removing XID cache
1552
  OPT_STORAGE_ENGINE,
867 by Brian Aker
Remove dead options.
1553
  OPT_INIT_FILE,
1 by brian
clean slate
1554
  OPT_WANT_CORE,
867 by Brian Aker
Remove dead options.
1555
  OPT_MEMLOCK,
614 by Brian Aker
Remove filtering (wrong layer, belongs in plugin).
1556
  OPT_SERVER_ID,
867 by Brian Aker
Remove dead options.
1557
  OPT_TC_HEURISTIC_RECOVER,
1 by brian
clean slate
1558
  OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_COMPLETION_TYPE,
1559
  OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS,
867 by Brian Aker
Remove dead options.
1560
  OPT_DO_PSTACK,
1561
  OPT_LOCAL_INFILE,
798.2.18 by Brian Aker
Remove dead COM for BINLOG/REGISTER.
1562
  OPT_BACK_LOG,
956 by Brian Aker
Remove dead options.
1563
  OPT_JOIN_BUFF_SIZE,
1564
  OPT_MAX_ALLOWED_PACKET,
1 by brian
clean slate
1565
  OPT_MAX_HEP_TABLE_SIZE,
245 by Brian Aker
Removed dead variables.
1566
  OPT_MAX_JOIN_SIZE,
956 by Brian Aker
Remove dead options.
1567
  OPT_MAX_SORT_LENGTH,
1 by brian
clean slate
1568
  OPT_MAX_SEEKS_FOR_KEY, OPT_MAX_TMP_TABLES, OPT_MAX_USER_CONNECTIONS,
1569
  OPT_MAX_LENGTH_FOR_SORT_DATA,
1570
  OPT_MAX_WRITE_LOCK_COUNT, OPT_BULK_INSERT_BUFFER_SIZE,
1571
  OPT_MAX_ERROR_COUNT, OPT_MULTI_RANGE_COUNT, OPT_MYISAM_DATA_POINTER_SIZE,
1572
  OPT_MYISAM_BLOCK_SIZE, OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE,
1573
  OPT_MYISAM_MAX_SORT_FILE_SIZE, OPT_MYISAM_SORT_BUFFER_SIZE,
1574
  OPT_MYISAM_USE_MMAP, OPT_MYISAM_REPAIR_THREADS,
971.3.60 by Eric Day
Moved connect_timeout, net_*_timeout, and retry_count to plugin.
1575
  OPT_NET_BUFFER_LENGTH,
1 by brian
clean slate
1576
  OPT_PRELOAD_BUFFER_SIZE,
245 by Brian Aker
Removed dead variables.
1577
  OPT_RECORD_BUFFER,
867 by Brian Aker
Remove dead options.
1578
  OPT_RECORD_RND_BUFFER, OPT_DIV_PRECINCREMENT,
1579
  OPT_DEBUGGING,
1 by brian
clean slate
1580
  OPT_SORT_BUFFER, OPT_TABLE_OPEN_CACHE, OPT_TABLE_DEF_CACHE,
1581
  OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK,
1582
  OPT_WAIT_TIMEOUT,
80.2.1 by mark
remove handling of suspicious UDFs
1583
  OPT_RANGE_ALLOC_BLOCK_SIZE,
1 by brian
clean slate
1584
  OPT_QUERY_ALLOC_BLOCK_SIZE, OPT_QUERY_PREALLOC_SIZE,
1585
  OPT_TRANS_ALLOC_BLOCK_SIZE, OPT_TRANS_PREALLOC_SIZE,
1586
  OPT_OLD_ALTER_TABLE,
1587
  OPT_GROUP_CONCAT_MAX_LEN,
1588
  OPT_DEFAULT_COLLATION,
1589
  OPT_CHARACTER_SET_FILESYSTEM,
1590
  OPT_LC_TIME_NAMES,
1591
  OPT_INIT_CONNECT,
1592
  OPT_DEFAULT_TIME_ZONE,
1593
  OPT_OPTIMIZER_SEARCH_DEPTH,
868 by Brian Aker
Adding Multi-threaded Scheduler into the system.
1594
  OPT_SCHEDULER,
994.2.2 by Monty Taylor
Store a Registry of SchedulerFactories and set one of them at startup for better error messages earlier.
1595
  OPT_PROTOCOL,
1 by brian
clean slate
1596
  OPT_OPTIMIZER_PRUNE_LEVEL,
1597
  OPT_AUTO_INCREMENT, OPT_AUTO_INCREMENT_OFFSET,
1598
  OPT_ENABLE_LARGE_PAGES,
1599
  OPT_TIMED_MUTEXES,
1600
  OPT_TABLE_LOCK_WAIT_TIMEOUT,
1192.3.7 by Monty Taylor
Added code necessary for building plugins dynamically.
1601
  OPT_PLUGIN_ADD,
1283.1.5 by Monty Taylor
Added --plugin-remove option, which prunes plugins from the list of plugins
1602
  OPT_PLUGIN_REMOVE,
1 by brian
clean slate
1603
  OPT_PLUGIN_LOAD,
1604
  OPT_PLUGIN_DIR,
1605
  OPT_PORT_OPEN_TIMEOUT,
1606
  OPT_SECURE_FILE_PRIV,
1743.3.2 by LinuxJedi
Make --print-defaults ack as old behaviour for the defaults list at the end of --help because this is still needed in drizzled for dtr. Killing 2 birds with one stone.
1607
  OPT_MIN_EXAMINED_ROW_LIMIT,
1608
  OPT_PRINT_DEFAULTS
1 by brian
clean slate
1609
};
1610
1611
1410.3.4 by Djellel E. Difallah
update references to old my_'s
1612
struct option my_long_options[] =
1 by brian
clean slate
1613
{
1743.3.2 by LinuxJedi
Make --print-defaults ack as old behaviour for the defaults list at the end of --help because this is still needed in drizzled for dtr. Killing 2 birds with one stone.
1614
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1615
  {"help", '?', N_("Display this help and exit."),
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1616
   (char**) &opt_help, NULL, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
1 by brian
clean slate
1617
   0, 0},
2131.10.1 by Stewart Smith
add a very simple --daemon or -d option to drizzled using the exact same code as memcached to start as a daemon.
1618
  {"daemon", 'd', N_("Run as daemon."),
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1619
   (char**) &opt_daemon, NULL, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
2131.10.1 by Stewart Smith
add a very simple --daemon or -d option to drizzled using the exact same code as memcached to start as a daemon.
1620
   0, 0},
1 by brian
clean slate
1621
  {"auto-increment-increment", OPT_AUTO_INCREMENT,
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1622
   N_("Auto-increment columns are incremented by this"),
77.1.77 by Monty Taylor
A crapton more warning cleanups (I turned on more warnings)
1623
   (char**) &global_system_variables.auto_increment_increment,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1624
   NULL, 0, GET_ULL,
1816.2.4 by Monty Taylor
Cleaned up a bunch more warnings.
1625
   OPT_ARG, 1, 1, INT64_MAX, 0, 1, 0 },
1 by brian
clean slate
1626
  {"auto-increment-offset", OPT_AUTO_INCREMENT_OFFSET,
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1627
   N_("Offset added to Auto-increment columns. Used when "
1628
      "auto-increment-increment != 1"),
77.1.77 by Monty Taylor
A crapton more warning cleanups (I turned on more warnings)
1629
   (char**) &global_system_variables.auto_increment_offset,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1630
   NULL, 0, GET_ULL, OPT_ARG,
1816.2.4 by Monty Taylor
Cleaned up a bunch more warnings.
1631
   1, 1, INT64_MAX, 0, 1, 0 },
1 by brian
clean slate
1632
  {"basedir", 'b',
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1633
   N_("Path to installation directory. All paths are usually resolved "
1634
      "relative to this."),
1813.2.1 by Monty Taylor
Migrated --basedir to feed a path.
1635
   NULL, NULL, 0, GET_STR, REQUIRED_ARG,
1 by brian
clean slate
1636
   0, 0, 0, 0, 0, 0},
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1637
  {"chroot", 'r',
575.4.4 by Yoshinori Sano
Rename mysql to drizzle.
1638
   N_("Chroot drizzled daemon during startup."),
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1639
   (char**) &drizzled_chroot, NULL, 0, GET_STR, REQUIRED_ARG,
1 by brian
clean slate
1640
   0, 0, 0, 0, 0, 0},
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1641
  {"collation-server", OPT_DEFAULT_COLLATION,
1642
   N_("Set the default collation."),
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1643
   (char**) &default_collation_name, NULL,
1 by brian
clean slate
1644
   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1645
  {"completion-type", OPT_COMPLETION_TYPE,
1646
   N_("Default completion type."),
77.1.77 by Monty Taylor
A crapton more warning cleanups (I turned on more warnings)
1647
   (char**) &global_system_variables.completion_type,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1648
   NULL, 0, GET_UINT,
1 by brian
clean slate
1649
   REQUIRED_ARG, 0, 0, 2, 0, 1, 0},
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1650
  {"core-file", OPT_WANT_CORE,
1651
   N_("Write core on errors."),
1652
   0, 0, 0, GET_NO_ARG,
1 by brian
clean slate
1653
   NO_ARG, 0, 0, 0, 0, 0, 0},
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1654
  {"datadir", 'h',
1655
   N_("Path to the database root."),
1786.3.1 by Monty Taylor
Initial working local catalog.
1656
   NULL, NULL, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1 by brian
clean slate
1657
  /* See how it's handled in get_one_option() */
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1658
  {"exit-info", 'T',
1659
   N_("Used for debugging;  Use at your own risk!"),
1660
   0, 0, 0, GET_LONG, OPT_ARG, 0, 0, 0, 0, 0, 0},
1 by brian
clean slate
1661
  /* We must always support the next option to make scripts like mysqltest
1662
     easier to do */
1663
  {"gdb", OPT_DEBUGGING,
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1664
   N_("Set up signals usable for debugging"),
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1665
   (char**) &opt_debugging, NULL,
1 by brian
clean slate
1666
   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1667
  {"log-warnings", 'W',
1668
   N_("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)
1669
   (char**) &global_system_variables.log_warnings,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1670
   NULL, 0, GET_BOOL, OPT_ARG, 1, 0, 0,
1 by brian
clean slate
1671
   0, 0, 0},
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1672
  {"pid-file", OPT_PID_FILE,
1776.5.1 by Vijay Samuel
Merge removed the -h short form for --datadir and replaced safe_mysqld with drizzled in help message of --pid-file
1673
   N_("Pid file used by drizzled."),
1813.2.2 by Monty Taylor
Replaced pid-file with fs::path.
1674
   NULL, NULL, 0, GET_STR,
1 by brian
clean slate
1675
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1676
  {"port-open-timeout", OPT_PORT_OPEN_TIMEOUT,
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1677
   N_("Maximum time in seconds to wait for the port to become free. "
1678
      "(Default: no wait)"),
971.6.7 by Eric Day
Reworked listen interface to not require binding of TCP ports.
1679
   (char**) &drizzled_bind_timeout,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1680
   NULL, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1 by brian
clean slate
1681
  {"secure-file-priv", OPT_SECURE_FILE_PRIV,
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1682
   N_("Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files "
1683
      "within specified directory"),
1813.2.6 by Monty Taylor
Made secure_file_priv be an fs::path from the beginning.
1684
   NULL, NULL, 0,
1 by brian
clean slate
1685
   GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1686
  {"server-id",	OPT_SERVER_ID,
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1687
   N_("Uniquely identifies the server instance in the community of "
1688
      "replication partners."),
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1689
   (char**) &server_id, NULL, 0, GET_UINT32, REQUIRED_ARG, 0, 0, 0,
1 by brian
clean slate
1690
   0, 0, 0},
1691
  {"skip-stack-trace", OPT_SKIP_STACK_TRACE,
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1692
   N_("Don't print a stack trace on failure."),
1693
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
1 by brian
clean slate
1694
   0, 0, 0, 0},
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1695
  {"symbolic-links", 's',
1696
   N_("Enable symbolic link support."),
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1697
   (char**) &internal::my_use_symdir, NULL, 0, GET_BOOL, NO_ARG,
1 by brian
clean slate
1698
   /*
1699
     The system call realpath() produces warnings under valgrind and
1700
     purify. These are not suppressed: instead we disable symlinks
1701
     option if compiled with valgrind support.
1702
   */
1703
   IF_PURIFY(0,1), 0, 0, 0, 0, 0},
1704
  {"timed_mutexes", OPT_TIMED_MUTEXES,
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1705
   N_("Specify whether to time mutexes (only InnoDB mutexes are currently "
1706
      "supported)"),
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1707
   (char**) &internal::timed_mutexes, NULL, 0, GET_BOOL, NO_ARG, 0,
1 by brian
clean slate
1708
    0, 0, 0, 0, 0},
1709
  {"transaction-isolation", OPT_TX_ISOLATION,
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1710
   N_("Default transaction isolation level."),
1711
   0, 0, 0, GET_STR, REQUIRED_ARG, 0,
1 by brian
clean slate
1712
   0, 0, 0, 0, 0},
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1713
  {"user", 'u',
574.2.1 by ysano
Rename mysql to drizzle.
1714
   N_("Run drizzled daemon as user."),
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1715
   0, 0, 0, GET_STR, REQUIRED_ARG,
1 by brian
clean slate
1716
   0, 0, 0, 0, 0, 0},
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1717
  {"back_log", OPT_BACK_LOG,
575.4.4 by Yoshinori Sano
Rename mysql to drizzle.
1718
   N_("The number of outstanding connection requests Drizzle can have. This "
1719
      "comes into play when the main Drizzle thread gets very many connection "
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1720
      "requests in a very short time."),
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1721
    (char**) &back_log, NULL, 0, GET_UINT,
1 by brian
clean slate
1722
    REQUIRED_ARG, 50, 1, 65535, 0, 1, 0 },
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1723
  { "bulk_insert_buffer_size", OPT_BULK_INSERT_BUFFER_SIZE,
672.1.3 by Andrew Hutchings
Minor string fixes (mainly US English spelling and typos)
1724
    N_("Size of tree cache used in bulk insert optimization. Note that this is "
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1725
       "a limit per thread!"),
1726
    (char**) &global_system_variables.bulk_insert_buff_size,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1727
    NULL,
619 by Brian Aker
Removed ulong methods from vars.
1728
    0, GET_ULL, REQUIRED_ARG, 8192*1024, 0, ULONG_MAX, 0, 1, 0},
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1729
  { "div_precision_increment", OPT_DIV_PRECINCREMENT,
1730
   N_("Precision of the result of '/' operator will be increased on that "
1731
      "value."),
77.1.77 by Monty Taylor
A crapton more warning cleanups (I turned on more warnings)
1732
   (char**) &global_system_variables.div_precincrement,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1733
   NULL, 0, GET_UINT,
1 by brian
clean slate
1734
   REQUIRED_ARG, 4, 0, DECIMAL_MAX_SCALE, 0, 0, 0},
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1735
  { "join_buffer_size", OPT_JOIN_BUFF_SIZE,
1736
    N_("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)
1737
   (char**) &global_system_variables.join_buff_size,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1738
   NULL, 0, GET_UINT64,
1 by brian
clean slate
1739
   REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ULONG_MAX,
1740
   MALLOC_OVERHEAD, IO_SIZE, 0},
1741
  {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1742
   N_("Max packetlength to send/receive from to server."),
77.1.77 by Monty Taylor
A crapton more warning cleanups (I turned on more warnings)
1743
   (char**) &global_system_variables.max_allowed_packet,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1744
   NULL, 0, GET_UINT32,
1877.1.3 by Andrew Hutchings
Make default max_packet_size 64MB as 1MB doesn't seem really sane for text/blob columns
1745
   REQUIRED_ARG, 64*1024*1024L, 1024, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
1 by brian
clean slate
1746
  {"max_heap_table_size", OPT_MAX_HEP_TABLE_SIZE,
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1747
   N_("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)
1748
   (char**) &global_system_variables.max_heap_table_size,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1749
   NULL, 0, GET_ULL,
1816.2.4 by Monty Taylor
Cleaned up a bunch more warnings.
1750
   REQUIRED_ARG, 16*1024*1024L, 16384, (int64_t)MAX_MEM_TABLE_SIZE,
1 by brian
clean slate
1751
   MALLOC_OVERHEAD, 1024, 0},
1752
  {"max_join_size", OPT_MAX_JOIN_SIZE,
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1753
   N_("Joins that are probably going to read more than max_join_size records "
1754
      "return an error."),
77.1.77 by Monty Taylor
A crapton more warning cleanups (I turned on more warnings)
1755
   (char**) &global_system_variables.max_join_size,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1756
   NULL, 0, GET_HA_ROWS, REQUIRED_ARG,
365.2.8 by Monty Taylor
More MAX macros.
1757
   INT32_MAX, 1, INT32_MAX, 0, 1, 0},
312.1.12 by Monty Taylor
Fixed a syntax oops.
1758
  {"max_length_for_sort_data", OPT_MAX_LENGTH_FOR_SORT_DATA,
1759
   N_("Max number of bytes in sorted records."),
1760
   (char**) &global_system_variables.max_length_for_sort_data,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1761
   NULL, 0, GET_ULL,
312.1.12 by Monty Taylor
Fixed a syntax oops.
1762
   REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0},
1 by brian
clean slate
1763
  { "max_seeks_for_key", OPT_MAX_SEEKS_FOR_KEY,
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1764
    N_("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)
1765
    (char**) &global_system_variables.max_seeks_for_key,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1766
    NULL, 0, GET_UINT64,
1 by brian
clean slate
1767
    REQUIRED_ARG, ULONG_MAX, 1, ULONG_MAX, 0, 1, 0 },
1768
  {"max_sort_length", OPT_MAX_SORT_LENGTH,
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1769
   N_("The number of bytes to use when sorting BLOB or TEXT values "
1770
      "(only the first max_sort_length bytes of each value are used; the "
1771
      "rest are ignored)."),
77.1.77 by Monty Taylor
A crapton more warning cleanups (I turned on more warnings)
1772
   (char**) &global_system_variables.max_sort_length,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1773
   NULL, 0, GET_SIZE,
1 by brian
clean slate
1774
   REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0},
1775
  {"max_write_lock_count", OPT_MAX_WRITE_LOCK_COUNT,
312.1.15 by Monty Taylor
Finished marking strings in drizzled.cc.
1776
   N_("After this many write locks, allow some read locks to run in between."),
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1777
   (char**) &max_write_lock_count, NULL, 0, GET_ULL,
1 by brian
clean slate
1778
   REQUIRED_ARG, ULONG_MAX, 1, ULONG_MAX, 0, 1, 0},
1779
  {"min_examined_row_limit", OPT_MIN_EXAMINED_ROW_LIMIT,
312.1.15 by Monty Taylor
Finished marking strings in drizzled.cc.
1780
   N_("Don't log queries which examine less than min_examined_row_limit "
1781
      "rows to file."),
77.1.77 by Monty Taylor
A crapton more warning cleanups (I turned on more warnings)
1782
   (char**) &global_system_variables.min_examined_row_limit,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1783
   NULL, 0, GET_ULL,
312.1.12 by Monty Taylor
Fixed a syntax oops.
1784
   REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1L, 0},
1 by brian
clean slate
1785
  {"optimizer_prune_level", OPT_OPTIMIZER_PRUNE_LEVEL,
619 by Brian Aker
Removed ulong methods from vars.
1786
    N_("Controls the heuristic(s) applied during query optimization to prune "
1787
       "less-promising partial plans from the optimizer search space. Meaning: "
1788
       "false - do not apply any heuristic, thus perform exhaustive search; "
1789
       "true - prune plans based on number of retrieved rows."),
1790
    (char**) &global_system_variables.optimizer_prune_level,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1791
    NULL,
619 by Brian Aker
Removed ulong methods from vars.
1792
    0, GET_BOOL, OPT_ARG, 1, 0, 1, 0, 1, 0},
1 by brian
clean slate
1793
  {"optimizer_search_depth", OPT_OPTIMIZER_SEARCH_DEPTH,
312.1.15 by Monty Taylor
Finished marking strings in drizzled.cc.
1794
   N_("Maximum depth of search performed by the query optimizer. Values "
1795
      "larger than the number of relations in a query result in better query "
1796
      "plans, but take longer to compile a query. Smaller values than the "
1797
      "number of tables in a relation result in faster optimization, but may "
1798
      "produce very bad query plans. If set to 0, the system will "
1799
      "automatically pick a reasonable value; if set to MAX_TABLES+2, the "
1800
      "optimizer will switch to the original find_best (used for "
1801
      "testing/comparison)."),
77.1.77 by Monty Taylor
A crapton more warning cleanups (I turned on more warnings)
1802
   (char**) &global_system_variables.optimizer_search_depth,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1803
   NULL,
1108.6.44 by Padraig O'Sullivan
Set the default value for optimizer_search_depth to 0.
1804
   0, GET_UINT, OPT_ARG, 0, 0, MAX_TABLES+2, 0, 1, 0},
1 by brian
clean slate
1805
  {"plugin_dir", OPT_PLUGIN_DIR,
312.1.15 by Monty Taylor
Finished marking strings in drizzled.cc.
1806
   N_("Directory for plugins."),
1794.3.4 by Monty Taylor
Fixed plugin dir sequencing
1807
   NULL, NULL, 0,
1 by brian
clean slate
1808
   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1192.3.7 by Monty Taylor
Added code necessary for building plugins dynamically.
1809
  {"plugin_add", OPT_PLUGIN_ADD,
1810
   N_("Optional comma separated list of plugins to load at startup in addition "
1811
      "to the default list of plugins. "
1812
      "[for example: --plugin_add=crc32,logger_gearman]"),
1776.4.1 by Monty Taylor
Migrates the creation of the plugin lists to have program_options directly
1813
   NULL, NULL, 0,
1192.3.7 by Monty Taylor
Added code necessary for building plugins dynamically.
1814
   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1283.1.5 by Monty Taylor
Added --plugin-remove option, which prunes plugins from the list of plugins
1815
  {"plugin_remove", OPT_PLUGIN_ADD,
1816
   N_("Optional comma separated list of plugins to not load at startup. Effectively "
1817
      "removes a plugin from the list of plugins to be loaded. "
1818
      "[for example: --plugin_remove=crc32,logger_gearman]"),
1776.4.1 by Monty Taylor
Migrates the creation of the plugin lists to have program_options directly
1819
   NULL, NULL, 0,
1283.1.5 by Monty Taylor
Added --plugin-remove option, which prunes plugins from the list of plugins
1820
   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1 by brian
clean slate
1821
  {"plugin_load", OPT_PLUGIN_LOAD,
1192.3.7 by Monty Taylor
Added code necessary for building plugins dynamically.
1822
   N_("Optional comma separated list of plugins to load at starup instead of "
1823
      "the default plugin load list. "
992.1.21 by Monty Taylor
First pass at replacing plugin.m4.
1824
      "[for example: --plugin_load=crc32,logger_gearman]"),
1776.4.1 by Monty Taylor
Migrates the creation of the plugin lists to have program_options directly
1825
   NULL, NULL, 0,
1 by brian
clean slate
1826
   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1827
  {"preload_buffer_size", OPT_PRELOAD_BUFFER_SIZE,
312.1.15 by Monty Taylor
Finished marking strings in drizzled.cc.
1828
   N_("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)
1829
   (char**) &global_system_variables.preload_buff_size,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1830
   NULL, 0, GET_ULL,
1 by brian
clean slate
1831
   REQUIRED_ARG, 32*1024L, 1024, 1024*1024*1024L, 0, 1, 0},
1832
  {"query_alloc_block_size", OPT_QUERY_ALLOC_BLOCK_SIZE,
312.1.15 by Monty Taylor
Finished marking strings in drizzled.cc.
1833
   N_("Allocation block size for query parsing and execution"),
77.1.77 by Monty Taylor
A crapton more warning cleanups (I turned on more warnings)
1834
   (char**) &global_system_variables.query_alloc_block_size,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1835
   NULL, 0, GET_UINT,
1 by brian
clean slate
1836
   REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ULONG_MAX, 0, 1024, 0},
1837
  {"query_prealloc_size", OPT_QUERY_PREALLOC_SIZE,
312.1.15 by Monty Taylor
Finished marking strings in drizzled.cc.
1838
   N_("Persistent buffer for query parsing and execution"),
77.1.77 by Monty Taylor
A crapton more warning cleanups (I turned on more warnings)
1839
   (char**) &global_system_variables.query_prealloc_size,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1840
   NULL, 0, GET_UINT,
1 by brian
clean slate
1841
   REQUIRED_ARG, QUERY_ALLOC_PREALLOC_SIZE, QUERY_ALLOC_PREALLOC_SIZE,
1842
   ULONG_MAX, 0, 1024, 0},
1843
  {"range_alloc_block_size", OPT_RANGE_ALLOC_BLOCK_SIZE,
312.1.15 by Monty Taylor
Finished marking strings in drizzled.cc.
1844
   N_("Allocation block size for storing ranges during optimization"),
77.1.77 by Monty Taylor
A crapton more warning cleanups (I turned on more warnings)
1845
   (char**) &global_system_variables.range_alloc_block_size,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1846
   NULL, 0, GET_SIZE,
1816.2.4 by Monty Taylor
Cleaned up a bunch more warnings.
1847
   REQUIRED_ARG, RANGE_ALLOC_BLOCK_SIZE, RANGE_ALLOC_BLOCK_SIZE, (int64_t)SIZE_MAX,
1 by brian
clean slate
1848
   0, 1024, 0},
1849
  {"read_buffer_size", OPT_RECORD_BUFFER,
619 by Brian Aker
Removed ulong methods from vars.
1850
    N_("Each thread that does a sequential scan allocates a buffer of this "
1851
       "size for each table it scans. If you do many sequential scans, you may "
1852
       "want to increase this value."),
1853
    (char**) &global_system_variables.read_buff_size,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1854
    NULL,0, GET_UINT, REQUIRED_ARG,
619 by Brian Aker
Removed ulong methods from vars.
1855
    128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, INT32_MAX, MALLOC_OVERHEAD, IO_SIZE,
1856
    0},
1 by brian
clean slate
1857
  {"read_rnd_buffer_size", OPT_RECORD_RND_BUFFER,
312.1.15 by Monty Taylor
Finished marking strings in drizzled.cc.
1858
   N_("When reading rows in sorted order after a sort, the rows are read "
1859
      "through this buffer to avoid a disk seeks. If not set, then it's set "
1860
      "to the value of record_buffer."),
77.1.77 by Monty Taylor
A crapton more warning cleanups (I turned on more warnings)
1861
   (char**) &global_system_variables.read_rnd_buff_size,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1862
   NULL, 0,
619 by Brian Aker
Removed ulong methods from vars.
1863
   GET_UINT, REQUIRED_ARG, 256*1024L, 64 /*IO_SIZE*2+MALLOC_OVERHEAD*/ ,
1864
   UINT32_MAX, MALLOC_OVERHEAD, 1 /* Small lower limit to be able to test MRR */, 0},
1034.1.6 by Brian Aker
Increase the default sort buffer size.
1865
  /* x8 compared to MySQL's x2. We have UTF8 to consider. */
1 by brian
clean slate
1866
  {"sort_buffer_size", OPT_SORT_BUFFER,
312.1.15 by Monty Taylor
Finished marking strings in drizzled.cc.
1867
   N_("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)
1868
   (char**) &global_system_variables.sortbuff_size,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1869
   NULL, 0, GET_SIZE, REQUIRED_ARG,
1816.2.4 by Monty Taylor
Cleaned up a bunch more warnings.
1870
   MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*8, (int64_t)SIZE_MAX,
1 by brian
clean slate
1871
   MALLOC_OVERHEAD, 1, 0},
1872
  {"table_definition_cache", OPT_TABLE_DEF_CACHE,
312.1.15 by Monty Taylor
Finished marking strings in drizzled.cc.
1873
   N_("The number of cached table definitions."),
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1874
   (char**) &table_def_size, NULL,
1226.1.3 by Brian Aker
Possible solution for hash/rehash.
1875
   0, GET_SIZE, REQUIRED_ARG, 128, 1, 512*1024L, 0, 1, 0},
1 by brian
clean slate
1876
  {"table_open_cache", OPT_TABLE_OPEN_CACHE,
312.1.15 by Monty Taylor
Finished marking strings in drizzled.cc.
1877
   N_("The number of cached open tables."),
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1878
   (char**) &table_cache_size, NULL, 0, GET_UINT64,
1313.1.19 by Stewart Smith
TABLE_OPEN_CACHE_MIN should be used instead of unused.
1879
   REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, TABLE_OPEN_CACHE_MIN, 512*1024L, 0, 1, 0},
1 by brian
clean slate
1880
  {"table_lock_wait_timeout", OPT_TABLE_LOCK_WAIT_TIMEOUT,
312.1.15 by Monty Taylor
Finished marking strings in drizzled.cc.
1881
   N_("Timeout in seconds to wait for a table level lock before returning an "
1882
      "error. Used only if the connection has active cursors."),
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1883
   (char**) &table_lock_wait_timeout, NULL,
622.1.1 by Brian Aker
32bit fixes around vars
1884
   0, GET_ULL, REQUIRED_ARG, 50, 1, 1024 * 1024 * 1024, 0, 1, 0},
1 by brian
clean slate
1885
  {"thread_stack", OPT_THREAD_STACK,
312.1.15 by Monty Taylor
Finished marking strings in drizzled.cc.
1886
   N_("The stack size for each thread."),
1887
   (char**) &my_thread_stack_size,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1888
   NULL, 0, GET_SIZE,
312.1.15 by Monty Taylor
Finished marking strings in drizzled.cc.
1889
   REQUIRED_ARG,DEFAULT_THREAD_STACK,
1816.2.4 by Monty Taylor
Cleaned up a bunch more warnings.
1890
   UINT32_C(1024*512), (int64_t)SIZE_MAX, 0, 1024, 0},
1 by brian
clean slate
1891
  {"tmp_table_size", OPT_TMP_TABLE_SIZE,
672.1.3 by Andrew Hutchings
Minor string fixes (mainly US English spelling and typos)
1892
   N_("If an internal in-memory temporary table exceeds this size, Drizzle will"
312.1.15 by Monty Taylor
Finished marking strings in drizzled.cc.
1893
      " 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)
1894
   (char**) &global_system_variables.tmp_table_size,
2318.2.5 by Olaf van der Spek
Set unused u_max_value to NULL
1895
   NULL, 0, GET_ULL,
1816.2.4 by Monty Taylor
Cleaned up a bunch more warnings.
1896
   REQUIRED_ARG, 16*1024*1024L, 1024, (int64_t)MAX_MEM_TABLE_SIZE, 0, 1, 0},
1 by brian
clean slate
1897
  {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
1898
};
1899
2318.2.28 by Olaf van der Spek
Refactor
1900
static void print_version()
1 by brian
clean slate
1901
{
1902
  /*
1903
    Note: the instance manager keys off the string 'Ver' so it can find the
575.4.4 by Yoshinori Sano
Rename mysql to drizzle.
1904
    version from the output of 'drizzled --version', so don't change it!
1 by brian
clean slate
1905
  */
2318.2.28 by Olaf van der Spek
Refactor
1906
  printf("%s  Ver %s for %s-%s on %s (%s)\n", internal::my_progname,
1907
	 PANDORA_RELEASE_VERSION, HOST_VENDOR, HOST_OS, HOST_CPU, COMPILATION_COMMENT);
1 by brian
clean slate
1908
}
1909
2318.2.28 by Olaf van der Spek
Refactor
1910
static void usage()
1 by brian
clean slate
1911
{
862 by Brian Aker
Remove charset directory code.
1912
  if (!(default_charset_info= get_charset_by_csname(default_character_set_name, MY_CS_PRIMARY)))
1 by brian
clean slate
1913
    exit(1);
1914
  if (!default_collation_name)
2318.2.28 by Olaf van der Spek
Refactor
1915
    default_collation_name= default_charset_info->name;
1 by brian
clean slate
1916
  print_version();
656.1.27 by Monty Taylor
Fixed the mysqld in the drizzle.cnf thing.
1917
  puts(_("Copyright (C) 2008 Sun Microsystems\n"
312.1.11 by Monty Taylor
Added some strings from drizzled.cc.
1918
         "This software comes with ABSOLUTELY NO WARRANTY. "
1919
         "This is free software,\n"
1920
         "and you are welcome to modify and redistribute it under the GPL "
1743.3.2 by LinuxJedi
Make --print-defaults ack as old behaviour for the defaults list at the end of --help because this is still needed in drizzled for dtr. Killing 2 birds with one stone.
1921
         "license\n\n"));
1 by brian
clean slate
1922
2224.1.1 by Olaf van der Spek
Finish removing XID cache
1923
1757.2.3 by Monty Taylor
Made printing of --help work via program_options from the core. Removed
1924
  printf(_("Usage: %s [OPTIONS]\n"), internal::my_progname);
1925
1757.2.6 by Monty Taylor
We've gotten further. Now things sometimes work, but some things aren't
1926
  po::options_description all_options("Drizzled Options");
1794.3.1 by Monty Taylor
Rearranged option processing.
1927
  all_options.add(config_options);
1928
  all_options.add(plugin_load_options);
1757.2.6 by Monty Taylor
We've gotten further. Now things sometimes work, but some things aren't
1929
  all_options.add(long_options);
1930
  all_options.add(plugin_options);
1931
  cout << all_options << endl;
1743.3.2 by LinuxJedi
Make --print-defaults ack as old behaviour for the defaults list at the end of --help because this is still needed in drizzled for dtr. Killing 2 birds with one stone.
1932
1 by brian
clean slate
1933
}
1934
1935
/**
575.4.4 by Yoshinori Sano
Rename mysql to drizzle.
1936
  Initialize all Drizzle global variables to default values.
1 by brian
clean slate
1937
1938
  We don't need to set numeric variables refered to in my_long_options
1939
  as these are initialized by my_getopt.
1940
1941
  @note
1942
    The reason to set a lot of global variables to zero is to allow one to
1943
    restart the embedded server with a clean environment
1944
    It's also needed on some exotic platforms where global variables are
1945
    not set to 0 when a program starts.
1946
1947
    We don't need to set numeric variables refered to in my_long_options
1948
    as these are initialized by my_getopt.
1949
*/
1950
2318.2.28 by Olaf van der Spek
Refactor
1951
static void drizzle_init_variables()
1 by brian
clean slate
1952
{
1953
  /* Things reset to zero */
1954
  opt_tc_log_file= (char *)"tc.log";      // no hostname in tc_log file name !
1955
  cleanup_done= 0;
1089.6.1 by Padraig O'Sullivan
Converted the test_flags variable from a uint32_t to std::bitset.
1956
  dropping_tables= ha_open_options=0;
2104.3.3 by Brian Aker
Cleanup test flags for debug options on server startup
1957
  getDebug().reset();
952 by Brian Aker
Remove bad variables.
1958
  wake_thread=0;
909 by Brian Aker
Remove the need for unireg init
1959
  abort_loop= select_thread_in_use= false;
2114.3.2 by Brian Aker
Encapsulate the condition we use to being a per-session case.
1960
  shutdown_in_progress= 0;
971.3.12 by Eric Day
Started abstracting Protocol, removed init_connect, init_file.
1961
  drizzled_user= drizzled_chroot= 0;
1537.2.1 by Joe Daly
add statistics_variables.h
1962
  memset(&current_global_counters, 0, sizeof(current_global_counters));
1005.2.6 by Monty Taylor
Re-added bitset<> as a replacement for Bitmap<>
1963
  key_map_full.set();
1 by brian
clean slate
1964
1965
  /* Character sets */
1966
  system_charset_info= &my_charset_utf8_general_ci;
1967
  files_charset_info= &my_charset_utf8_general_ci;
1968
  table_alias_charset= &my_charset_bin;
1969
  character_set_filesystem= &my_charset_bin;
1970
1971
  /* Things with default values that are not zero */
818 by Brian Aker
Found a few bits to be deleted (around binlog).
1972
  session_startup_options= (OPTION_AUTO_IS_NULL | OPTION_SQL_NOTES);
2318.2.28 by Olaf van der Spek
Refactor
1973
  global_thread_id= 1;
2282.1.2 by Olaf van der Spek
Session Cache
1974
  session::Cache::getCache().clear();
1 by brian
clean slate
1975
1976
  /* Set default values for some option variables */
971.1.21 by Monty Taylor
Store StorageEngine in system variables, rather than storage engine plugin.
1977
  global_system_variables.storage_engine= NULL;
1 by brian
clean slate
1978
  global_system_variables.tx_isolation= ISO_REPEATABLE_READ;
151 by Brian Aker
Ulonglong to uint64_t
1979
  global_system_variables.select_limit= (uint64_t) HA_POS_ERROR;
1980
  max_system_variables.select_limit=    (uint64_t) HA_POS_ERROR;
1981
  global_system_variables.max_join_size= (uint64_t) HA_POS_ERROR;
1982
  max_system_variables.max_join_size=   (uint64_t) HA_POS_ERROR;
1757.2.9 by Monty Taylor
Set all of the max_system_variables values explicitly.
1983
  max_system_variables.auto_increment_increment= UINT64_MAX;
1984
  max_system_variables.auto_increment_offset= UINT64_MAX;
1985
  max_system_variables.completion_type= 2;
1816.2.3 by Monty Taylor
Fixed some more ICC warnings. How did I get started on this this morning?
1986
  max_system_variables.log_warnings= true;
1757.2.9 by Monty Taylor
Set all of the max_system_variables values explicitly.
1987
  max_system_variables.bulk_insert_buff_size= ULONG_MAX;
1988
  max_system_variables.div_precincrement= DECIMAL_MAX_SCALE;
1989
  max_system_variables.group_concat_max_len= ULONG_MAX;
1990
  max_system_variables.join_buff_size= ULONG_MAX;
1991
  max_system_variables.max_allowed_packet= 1024L*1024L*1024L;
1992
  max_system_variables.max_error_count= 65535;
1993
  max_system_variables.max_heap_table_size= MAX_MEM_TABLE_SIZE;
1994
  max_system_variables.max_join_size= INT32_MAX;
1995
  max_system_variables.max_length_for_sort_data= 8192*1024L;
1996
  max_system_variables.max_seeks_for_key= ULONG_MAX;
1997
  max_system_variables.max_sort_length= 8192*1024L;
1998
  max_system_variables.min_examined_row_limit= ULONG_MAX;
1999
  max_system_variables.optimizer_prune_level= 1;
2000
  max_system_variables.optimizer_search_depth= MAX_TABLES+2;
2001
  max_system_variables.preload_buff_size= 1024*1024*1024L;
2002
  max_system_variables.query_alloc_block_size= UINT32_MAX;
2003
  max_system_variables.query_prealloc_size= UINT32_MAX;
2004
  max_system_variables.range_alloc_block_size= SIZE_MAX;
2005
  max_system_variables.read_buff_size= INT32_MAX;
2006
  max_system_variables.read_rnd_buff_size= UINT32_MAX;
2007
  max_system_variables.sortbuff_size= SIZE_MAX;
2008
  max_system_variables.tmp_table_size= MAX_MEM_TABLE_SIZE;
2009
1 by brian
clean slate
2010
  /* Variables that depends on compile options */
2011
#ifdef HAVE_BROKEN_REALPATH
2012
  have_symlink=SHOW_OPTION_NO;
2013
#else
2014
  have_symlink=SHOW_OPTION_YES;
2015
#endif
2016
}
2017
2018
2019
/**
2020
  @todo
1271.5.3 by Tim Penhey
change the include files
2021
  - FIXME add EXIT_TOO_MANY_ARGUMENTS to "drizzled/error.h" and return that code?
1 by brian
clean slate
2022
*/
1757.2.6 by Monty Taylor
We've gotten further. Now things sometimes work, but some things aren't
2023
static void get_options()
1 by brian
clean slate
2024
{
2318.5.30 by Olaf van der Spek
Refactor
2025
  setDataHomeCatalog(getDataHome() / "local");
1757.2.6 by Monty Taylor
We've gotten further. Now things sometimes work, but some things aren't
2026
2027
  if (vm.count("user"))
2028
  {
2029
    if (! drizzled_user || ! strcmp(drizzled_user, vm["user"].as<string>().c_str()))
2030
      drizzled_user= (char *)vm["user"].as<string>().c_str();
2031
2032
    else
2126.3.3 by Brian Aker
Merge in error message rework. Many error messages are fixed in this patch.
2033
      errmsg_printf(error::WARN, _("Ignoring user change to '%s' because the user was "
1757.2.6 by Monty Taylor
We've gotten further. Now things sometimes work, but some things aren't
2034
                                       "set to '%s' earlier on the command line\n"),
2035
                    vm["user"].as<string>().c_str(), drizzled_user);
2036
  }
2037
2038
  if (vm.count("version"))
2039
  {
2040
    print_version();
2041
    exit(0);
2042
  }
2043
1796.4.1 by Andrew Hutchings
Add initial template work and test
2044
  if (vm.count("sort-heap-threshold"))
2045
  {
1796.4.21 by Andrew Hutchings
Fix breakage on 32bit boxes
2046
    if ((vm["sort-heap-threshold"].as<uint64_t>() > 0) and
2224.1.1 by Olaf van der Spek
Finish removing XID cache
2047
      (vm["sort-heap-threshold"].as<uint64_t>() <
1796.4.8 by Andrew Hutchings
Change default setting
2048
      global_system_variables.sortbuff_size))
2049
    {
2068.4.1 by Andrew Hutchings
Fix intl domain
2050
      cout << _("Error: sort-heap-threshold cannot be less than sort-buffer-size") << endl;
1796.4.8 by Andrew Hutchings
Change default setting
2051
      exit(-1);
2052
    }
2053
1796.4.1 by Andrew Hutchings
Add initial template work and test
2054
    global_sort_buffer.setMaxSize(vm["sort-heap-threshold"].as<uint64_t>());
2055
  }
2056
1796.4.9 by Andrew Hutchings
Add join cache global constraint
2057
  if (vm.count("join-heap-threshold"))
2058
  {
1796.4.21 by Andrew Hutchings
Fix breakage on 32bit boxes
2059
    if ((vm["join-heap-threshold"].as<uint64_t>() > 0) and
2060
      (vm["join-heap-threshold"].as<uint64_t>() <
1796.4.9 by Andrew Hutchings
Add join cache global constraint
2061
      global_system_variables.join_buff_size))
2062
    {
2068.4.1 by Andrew Hutchings
Fix intl domain
2063
      cout << _("Error: join-heap-threshold cannot be less than join-buffer-size") << endl;
1796.4.9 by Andrew Hutchings
Add join cache global constraint
2064
      exit(-1);
2065
    }
2066
2067
    global_join_buffer.setMaxSize(vm["join-heap-threshold"].as<uint64_t>());
2068
  }
2069
1796.4.10 by Andrew Hutchings
Add global constraint for --read-rnd-buffer-size
2070
  if (vm.count("read-rnd-threshold"))
2071
  {
1796.4.21 by Andrew Hutchings
Fix breakage on 32bit boxes
2072
    if ((vm["read-rnd-threshold"].as<uint64_t>() > 0) and
2073
      (vm["read-rnd-threshold"].as<uint64_t>() <
1796.4.10 by Andrew Hutchings
Add global constraint for --read-rnd-buffer-size
2074
      global_system_variables.read_rnd_buff_size))
2075
    {
2068.4.1 by Andrew Hutchings
Fix intl domain
2076
      cout << _("Error: read-rnd-threshold cannot be less than read-rnd-buffer-size") << endl;
1796.4.10 by Andrew Hutchings
Add global constraint for --read-rnd-buffer-size
2077
      exit(-1);
2078
    }
2079
2080
    global_read_rnd_buffer.setMaxSize(vm["read-rnd-threshold"].as<uint64_t>());
2081
  }
2082
1796.4.11 by Andrew Hutchings
Add global constraint on read buffer
2083
  if (vm.count("read-buffer-threshold"))
2084
  {
1796.4.21 by Andrew Hutchings
Fix breakage on 32bit boxes
2085
    if ((vm["read-buffer-threshold"].as<uint64_t>() > 0) and
2086
      (vm["read-buffer-threshold"].as<uint64_t>() <
1796.4.11 by Andrew Hutchings
Add global constraint on read buffer
2087
      global_system_variables.read_buff_size))
2088
    {
2068.4.1 by Andrew Hutchings
Fix intl domain
2089
      cout << _("Error: read-buffer-threshold cannot be less than read-buffer-size") << endl;
1796.4.11 by Andrew Hutchings
Add global constraint on read buffer
2090
      exit(-1);
2091
    }
2092
2093
    global_read_buffer.setMaxSize(vm["read-buffer-threshold"].as<uint64_t>());
2094
  }
2095
1757.2.6 by Monty Taylor
We've gotten further. Now things sometimes work, but some things aren't
2096
  if (vm.count("exit-info"))
2097
  {
2098
    if (vm["exit-info"].as<long>())
2099
    {
2104.3.3 by Brian Aker
Cleanup test flags for debug options on server startup
2100
      getDebug().set((uint32_t) vm["exit-info"].as<long>());
1757.2.6 by Monty Taylor
We've gotten further. Now things sometimes work, but some things aren't
2101
    }
2102
  }
2103
2104
  if (vm.count("want-core"))
2105
  {
2104.3.3 by Brian Aker
Cleanup test flags for debug options on server startup
2106
    getDebug().set(debug::CORE_ON_SIGNAL);
1757.2.6 by Monty Taylor
We've gotten further. Now things sometimes work, but some things aren't
2107
  }
2108
2109
  if (vm.count("skip-stack-trace"))
2110
  {
2104.3.3 by Brian Aker
Cleanup test flags for debug options on server startup
2111
    getDebug().set(debug::NO_STACKTRACE);
1757.2.6 by Monty Taylor
We've gotten further. Now things sometimes work, but some things aren't
2112
  }
2113
2114
  if (vm.count("skip-symlinks"))
2115
  {
2116
    internal::my_use_symdir=0;
2117
  }
2118
2119
  if (vm.count("transaction-isolation"))
2120
  {
2151.5.1 by Olaf van der Spek
Make class of TYPELIB
2121
    int type= tx_isolation_typelib.find_type_or_exit(vm["transaction-isolation"].as<string>().c_str(), "transaction-isolation");
2122
    global_system_variables.tx_isolation= type - 1;
1757.2.6 by Monty Taylor
We've gotten further. Now things sometimes work, but some things aren't
2123
  }
2124
1757.2.12 by Monty Taylor
Fixed plugin loading.
2125
  /* @TODO Make this all strings */
1757.2.13 by Monty Taylor
Fixed temp_Table test.
2126
  if (vm.count("default-storage-engine"))
2127
  {
2318.2.3 by Olaf van der Spek
Refactor
2128
    default_storage_engine_str= vm["default-storage-engine"].as<string>().c_str();
1757.2.13 by Monty Taylor
Fixed temp_Table test.
2129
  }
1 by brian
clean slate
2130
2131
2132
#if defined(HAVE_BROKEN_REALPATH)
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
2133
  internal::my_use_symdir=0;
2134
  internal::my_disable_symlinks=1;
1 by brian
clean slate
2135
  have_symlink=SHOW_OPTION_NO;
2136
#else
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
2137
  if (!internal::my_use_symdir)
1 by brian
clean slate
2138
  {
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
2139
    internal::my_disable_symlinks=1;
1 by brian
clean slate
2140
    have_symlink=SHOW_OPTION_DISABLED;
2141
  }
2142
#endif
2143
  if (opt_debugging)
2144
  {
2145
    /* Allow break with SIGINT, no core or stack trace */
2104.3.3 by Brian Aker
Cleanup test flags for debug options on server startup
2146
    getDebug().set(debug::ALLOW_SIGINT);
2147
    getDebug().set(debug::NO_STACKTRACE);
2148
    getDebug().reset(debug::CORE_ON_SIGNAL);
1 by brian
clean slate
2149
  }
2150
574.2.1 by ysano
Rename mysql to drizzle.
2151
  if (drizzled_chroot)
2152
    set_root(drizzled_chroot);
1 by brian
clean slate
2153
2154
  /*
2155
    Set some global variables from the global_system_variables
2156
    In most cases the global variables will not be used
2157
  */
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
2158
  internal::my_default_record_cache_size=global_system_variables.read_buff_size;
1 by brian
clean slate
2159
}
2160
2161
1794.3.4 by Monty Taylor
Fixed plugin dir sequencing
2162
static void fix_paths()
1 by brian
clean slate
2163
{
1813.2.2 by Monty Taylor
Replaced pid-file with fs::path.
2164
  fs::path pid_file_path(pid_file);
1798.2.3 by Monty Taylor
Concatenate paths differently for pid-file.
2165
  if (pid_file_path.root_path().string() == "")
2166
  {
1813.2.9 by Monty Taylor
Made data_home be fs::path natively.
2167
    pid_file_path= getDataHome();
1813.2.2 by Monty Taylor
Replaced pid-file with fs::path.
2168
    pid_file_path /= pid_file;
1798.2.3 by Monty Taylor
Concatenate paths differently for pid-file.
2169
  }
1926.2.2 by Monty Taylor
Make sure we pop the pid-file path out to an absolute path in fix_paths,
2170
  pid_file= fs::system_complete(pid_file_path);
1192.3.7 by Monty Taylor
Added code necessary for building plugins dynamically.
2171
1802.8.3 by Monty Taylor
Remove help-extended.
2172
  if (not opt_help)
680 by Brian Aker
Remove locks around temp tables for searching tmp directory path.
2173
  {
2246.3.3 by Olaf van der Spek
new() doesn't return NULL
2174
    const char *tmp_string= getenv("TMPDIR");
680 by Brian Aker
Remove locks around temp tables for searching tmp directory path.
2175
    struct stat buf;
1757.2.11 by Monty Taylor
Fixed tmpdir and secure-file-priv.
2176
    drizzle_tmpdir.clear();
2177
2178
    if (vm.count("tmpdir"))
1556.1.1 by Brian Aker
Updates for moving temporary directory.
2179
    {
1757.2.11 by Monty Taylor
Fixed tmpdir and secure-file-priv.
2180
      drizzle_tmpdir.append(vm["tmpdir"].as<string>());
1556.1.1 by Brian Aker
Updates for moving temporary directory.
2181
    }
680 by Brian Aker
Remove locks around temp tables for searching tmp directory path.
2182
    else if (tmp_string == NULL)
1556.1.1 by Brian Aker
Updates for moving temporary directory.
2183
    {
1813.2.9 by Monty Taylor
Made data_home be fs::path natively.
2184
      drizzle_tmpdir.append(getDataHome().file_string());
1757.2.11 by Monty Taylor
Fixed tmpdir and secure-file-priv.
2185
      drizzle_tmpdir.push_back(FN_LIBCHAR);
2186
      drizzle_tmpdir.append(GLOBAL_TEMPORARY_EXT);
1556.1.1 by Brian Aker
Updates for moving temporary directory.
2187
    }
680 by Brian Aker
Remove locks around temp tables for searching tmp directory path.
2188
    else
1556.1.1 by Brian Aker
Updates for moving temporary directory.
2189
    {
2190
      drizzle_tmpdir.append(tmp_string);
2191
    }
2192
1794.3.5 by Monty Taylor
Fixed temporoary dir sequencing.
2193
    drizzle_tmpdir= fs::path(fs::system_complete(fs::path(drizzle_tmpdir))).file_string();
1556.1.1 by Brian Aker
Updates for moving temporary directory.
2194
    assert(drizzle_tmpdir.size());
2195
2196
    if (mkdir(drizzle_tmpdir.c_str(), 0777) == -1)
2197
    {
2198
      if (errno != EEXIST)
2199
      {
2126.3.3 by Brian Aker
Merge in error message rework. Many error messages are fixed in this patch.
2200
        errmsg_printf(error::ERROR, _("There was an error creating the '%s' part of the path '%s'.  Please check the path exists and is writable.\n"), fs::path(drizzle_tmpdir).leaf().c_str(), drizzle_tmpdir.c_str());
1556.1.1 by Brian Aker
Updates for moving temporary directory.
2201
        exit(1);
2202
      }
2203
    }
2204
2318.6.65 by Olaf van der Spek
Refactor
2205
    if (stat(drizzle_tmpdir.c_str(), &buf) || not S_ISDIR(buf.st_mode))
1556.1.1 by Brian Aker
Updates for moving temporary directory.
2206
    {
2126.3.3 by Brian Aker
Merge in error message rework. Many error messages are fixed in this patch.
2207
      errmsg_printf(error::ERROR, _("There was an error opening the path '%s', please check the path exists and is writable.\n"), drizzle_tmpdir.c_str());
680 by Brian Aker
Remove locks around temp tables for searching tmp directory path.
2208
      exit(1);
2209
    }
2210
  }
2211
1 by brian
clean slate
2212
}
2213
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
2214
} /* namespace drizzled */
2215