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 |
*
|
|
4 |
* Copyright (C) 2008 Sun Microsystems
|
|
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 |
||
1241.9.36
by Monty Taylor
ZOMG. I deleted drizzled/server_includes.h. |
20 |
#include "config.h" |
798.2.28
by Brian Aker
More pulling of code... master_pos function code removed. |
21 |
#include <drizzled/configmake.h> |
942.2.5
by Brian Aker
Fix, again, the thread lock issues for unlink_session |
22 |
#include <drizzled/atomics.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. |
23 |
|
24 |
#include <netdb.h> |
|
1241.9.47
by Monty Taylor
Add sys/types.cc to drizzled to fix freebsd. |
25 |
#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. |
26 |
#include <netinet/tcp.h> |
1208.1.1
by Monty Taylor
Fixed FreeBSD build issues. |
27 |
#include <netinet/in.h> |
520.6.5
by Monty Taylor
Removed signal.h from common_includes. |
28 |
#include <signal.h> |
1241.9.59
by Monty Taylor
Removed the first mystrings header. |
29 |
#include <limits.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. |
30 |
|
1241.9.64
by Monty Taylor
Moved remaining non-public portions of mysys and mystrings to drizzled/internal. |
31 |
#include "drizzled/internal/my_sys.h" |
32 |
#include "drizzled/internal/my_bit.h" |
|
1241.9.57
by Monty Taylor
Oy. Bigger change than I normally like - but this stuff is all intertwined. |
33 |
#include <drizzled/my_hash.h> |
549
by Monty Taylor
Took gettext.h out of header files. |
34 |
#include <drizzled/error.h> |
722.4.1
by Mark Atwood
integrate errmsg plugin into sql_print_* functions |
35 |
#include <drizzled/errmsg_print.h> |
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. |
36 |
#include <drizzled/tztime.h> |
575.4.7
by Monty Taylor
More header cleanup. |
37 |
#include <drizzled/sql_base.h> |
38 |
#include <drizzled/show.h> |
|
39 |
#include <drizzled/sql_parse.h> |
|
584.4.7
by Monty Taylor
Removed a big bank of includes from item.h. |
40 |
#include <drizzled/item/cmpfunc.h> |
584.1.15
by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes. |
41 |
#include <drizzled/session.h> |
42 |
#include <drizzled/item/create.h> |
|
670.2.4
by Monty Taylor
Removed more stuff from the headers. |
43 |
#include <drizzled/unireg.h> |
813.1.2
by Jay Pipes
First function cleanup for temporal handling: YEAR() |
44 |
#include "drizzled/temporal_format.h" /* For init_temporal_formats() */ |
1130.1.12
by Monty Taylor
Moved service stuff into plugin/ |
45 |
#include "drizzled/plugin/listen.h" |
46 |
#include "drizzled/plugin/error_message.h" |
|
971.6.5
by Eric Day
Merged trunk. |
47 |
#include "drizzled/plugin/client.h" |
1130.1.3
by Monty Taylor
Merged up with trunk. |
48 |
#include "drizzled/plugin/scheduler.h" |
1273.1.30
by Jay Pipes
* Completes the blueprint for splitting the XA Resource Manager |
49 |
#include "drizzled/plugin/xa_resource_manager.h" |
50 |
#include "drizzled/plugin/monitored_in_transaction.h" |
|
1405.6.1
by Jay Pipes
This patch adds the following functionality: |
51 |
#include "drizzled/replication_services.h" /* For ReplicationServices::evaluateRegisteredPlugins() */ |
1126.10.18
by Padraig O'Sullivan
Various small build fixes for when dtrace is enabled. |
52 |
#include "drizzled/probes.h" |
1241.9.17
by Monty Taylor
Removed more bits from server_includes. |
53 |
#include "drizzled/session_list.h" |
1241.9.57
by Monty Taylor
Oy. Bigger change than I normally like - but this stuff is all intertwined. |
54 |
#include "drizzled/charset.h" |
1241.9.62
by Monty Taylor
Removed plugin/myisam/myisam.h from session.h |
55 |
#include "plugin/myisam/myisam.h" |
1300.5.2
by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then |
56 |
#include "drizzled/drizzled.h" |
1
by brian
clean slate |
57 |
|
1089.1.3
by Brian Aker
Fix protobuf to release memory. Add in assert() for wrong column usage. Fix |
58 |
#include <google/protobuf/stubs/common.h> |
59 |
||
481.1.15
by Monty Taylor
Removed time.h and sys/time.h from global.h. |
60 |
#if TIME_WITH_SYS_TIME
|
61 |
# include <sys/time.h>
|
|
62 |
# include <time.h>
|
|
63 |
#else
|
|
64 |
# if HAVE_SYS_TIME_H
|
|
65 |
# include <sys/time.h>
|
|
66 |
# else
|
|
67 |
# include <time.h>
|
|
68 |
# endif
|
|
69 |
#endif
|
|
70 |
||
1
by brian
clean slate |
71 |
#ifdef HAVE_SYS_PRCTL_H
|
72 |
#include <sys/prctl.h> |
|
73 |
#endif
|
|
1241.9.1
by Monty Taylor
Removed global.h. Fixed all the headers. |
74 |
#include <sys/socket.h> |
1
by brian
clean slate |
75 |
|
76 |
||
77 |
#include <errno.h> |
|
78 |
#include <sys/stat.h> |
|
1410.3.4
by Djellel E. Difallah
update references to old my_'s |
79 |
#include "drizzled/option.h" |
1
by brian
clean slate |
80 |
#ifdef HAVE_SYSENT_H
|
81 |
#include <sysent.h> |
|
82 |
#endif
|
|
83 |
#include <pwd.h> // For getpwent |
|
84 |
#include <grp.h> |
|
85 |
||
86 |
#ifdef HAVE_SELECT_H
|
|
87 |
# include <select.h>
|
|
88 |
#endif
|
|
89 |
||
90 |
#ifdef HAVE_SYS_SELECT_H
|
|
91 |
#include <sys/select.h> |
|
92 |
#endif
|
|
93 |
||
94 |
#include <sys/utsname.h> |
|
95 |
||
96 |
#ifdef HAVE_SYS_MMAN_H
|
|
97 |
#include <sys/mman.h> |
|
98 |
#endif
|
|
99 |
||
100 |
#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H)
|
|
101 |
#include <ieeefp.h> |
|
102 |
#endif /* __FreeBSD__ && HAVE_IEEEFP_H */ |
|
103 |
||
104 |
#ifdef HAVE_FPU_CONTROL_H
|
|
105 |
#include <fpu_control.h> |
|
106 |
#endif
|
|
107 |
||
108 |
#ifdef HAVE_SYS_FPU_H
|
|
109 |
/* for IRIX to use set_fpc_csr() */
|
|
110 |
#include <sys/fpu.h> |
|
111 |
#endif
|
|
112 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
113 |
#include "drizzled/internal/my_pthread.h" // For thr_setconcurency() |
114 |
||
115 |
#include <drizzled/gettext.h> |
|
116 |
||
117 |
||
118 |
#ifdef HAVE_purify
|
|
119 |
#define IF_PURIFY(A,B) (A)
|
|
120 |
#else
|
|
121 |
#define IF_PURIFY(A,B) (B)
|
|
122 |
#endif
|
|
123 |
||
124 |
#define MAX_MEM_TABLE_SIZE SIZE_MAX
|
|
125 |
||
126 |
using namespace std; |
|
127 |
||
128 |
namespace drizzled |
|
129 |
{
|
|
130 |
||
131 |
#define mysqld_charset &my_charset_utf8_general_ci
|
|
1
by brian
clean slate |
132 |
inline void setup_fpu() |
133 |
{
|
|
134 |
#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H)
|
|
135 |
/*
|
|
136 |
We can't handle floating point exceptions with threads, so disable
|
|
137 |
this on freebsd.
|
|
138 |
Don't fall for overflow, underflow,divide-by-zero or loss of precision
|
|
139 |
*/
|
|
140 |
#if defined(__i386__)
|
|
141 |
fpsetmask(~(FP_X_INV | FP_X_DNML | FP_X_OFL | FP_X_UFL | FP_X_DZ | |
|
142 |
FP_X_IMP)); |
|
143 |
#else
|
|
144 |
fpsetmask(~(FP_X_INV | FP_X_OFL | FP_X_UFL | FP_X_DZ | |
|
145 |
FP_X_IMP)); |
|
146 |
#endif /* __i386__ */ |
|
147 |
#endif /* __FreeBSD__ && HAVE_IEEEFP_H */ |
|
148 |
||
149 |
/*
|
|
150 |
x86 (32-bit) requires FPU precision to be explicitly set to 64 bit for
|
|
151 |
portable results of floating point operations
|
|
152 |
*/
|
|
153 |
#if defined(__i386__) && defined(HAVE_FPU_CONTROL_H) && defined(_FPU_DOUBLE)
|
|
154 |
fpu_control_t cw; |
|
155 |
_FPU_GETCW(cw); |
|
156 |
cw= (cw & ~_FPU_EXTENDED) | _FPU_DOUBLE; |
|
157 |
_FPU_SETCW(cw); |
|
158 |
#endif /* __i386__ && HAVE_FPU_CONTROL_H && _FPU_DOUBLE */ |
|
159 |
}
|
|
160 |
||
161 |
#ifdef SOLARIS
|
|
162 |
extern "C" int gethostname(char *name, int namelen); |
|
163 |
#endif
|
|
164 |
||
165 |
/* Constants */
|
|
166 |
static const char *tc_heuristic_recover_names[]= |
|
167 |
{
|
|
461
by Monty Taylor
Removed NullS. bu-bye. |
168 |
"COMMIT", "ROLLBACK", NULL |
1
by brian
clean slate |
169 |
};
|
170 |
static TYPELIB tc_heuristic_recover_typelib= |
|
171 |
{
|
|
172 |
array_elements(tc_heuristic_recover_names)-1,"", |
|
173 |
tc_heuristic_recover_names, NULL |
|
174 |
};
|
|
175 |
||
1089.9.1
by Jay Pipes
Removes a bunch of dead code and unused variables in drizzled.cc and server_includes.h |
176 |
const char *first_keyword= "first"; |
722.1.3
by Monty Taylor
Cleaned up a few build things. |
177 |
const char * const DRIZZLE_CONFIG_NAME= "drizzled"; |
1
by brian
clean slate |
178 |
#define GET_HA_ROWS GET_ULL
|
179 |
||
1241.9.57
by Monty Taylor
Oy. Bigger change than I normally like - but this stuff is all intertwined. |
180 |
const char *tx_isolation_names[] = |
181 |
{ "READ-UNCOMMITTED", "READ-COMMITTED", "REPEATABLE-READ", "SERIALIZABLE", |
|
182 |
NULL}; |
|
183 |
||
184 |
TYPELIB tx_isolation_typelib= {array_elements(tx_isolation_names)-1,"", |
|
185 |
tx_isolation_names, NULL}; |
|
186 |
||
1
by brian
clean slate |
187 |
/*
|
188 |
Used with --help for detailed option
|
|
189 |
*/
|
|
1300.5.2
by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then |
190 |
bool opt_help= false; |
191 |
bool opt_help_extended= false; |
|
1
by brian
clean slate |
192 |
|
193 |
arg_cmp_func Arg_comparator::comparator_matrix[5][2] = |
|
194 |
{{&Arg_comparator::compare_string, &Arg_comparator::compare_e_string}, |
|
195 |
{&Arg_comparator::compare_real, &Arg_comparator::compare_e_real}, |
|
196 |
{&Arg_comparator::compare_int_signed, &Arg_comparator::compare_e_int}, |
|
197 |
{&Arg_comparator::compare_row, &Arg_comparator::compare_e_row}, |
|
1122.2.13
by Monty Taylor
Header cleanup. |
198 |
{&Arg_comparator::compare_decimal, &Arg_comparator::compare_e_decimal}}; |
1
by brian
clean slate |
199 |
|
200 |
/* static variables */
|
|
201 |
||
722.4.1
by Mark Atwood
integrate errmsg plugin into sql_print_* functions |
202 |
static bool opt_debugging= 0; |
566
by Brian Aker
Clean up dead thead code. |
203 |
static uint32_t wake_thread; |
1300.5.2
by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then |
204 |
static char *drizzled_chroot; |
971.3.12
by Eric Day
Started abstracting Protocol, removed init_connect, init_file. |
205 |
static char *language_ptr; |
1085.3.4
by Monty Taylor
pandora-build v0.8 |
206 |
static const char *default_character_set_name; |
207 |
static const char *character_set_filesystem_name; |
|
1
by brian
clean slate |
208 |
static char *lc_time_names_name; |
236.1.40
by Monty Taylor
A few meaningless changes. |
209 |
static char *default_collation_name; |
1
by brian
clean slate |
210 |
static char *default_storage_engine_str; |
1085.3.4
by Monty Taylor
pandora-build v0.8 |
211 |
static const char *compiled_default_collation_name= "utf8_general_ci"; |
1
by brian
clean slate |
212 |
|
213 |
/* Global variables */
|
|
214 |
||
1300.5.2
by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then |
215 |
bool volatile ready_to_exit; |
216 |
char *drizzled_user; |
|
217 |
bool volatile select_thread_in_use; |
|
1
by brian
clean slate |
218 |
bool volatile abort_loop; |
219 |
bool volatile shutdown_in_progress; |
|
855
by Brian Aker
Refactor reset of status. |
220 |
uint32_t max_used_connections; |
994.2.2
by Monty Taylor
Store a Registry of SchedulerFactories and set one of them at startup for better error messages earlier. |
221 |
const string opt_scheduler_default("multi_thread"); |
222 |
char *opt_scheduler= NULL; |
|
223 |
||
629.2.7
by Monty Taylor
Fixed a couple of memory buffer size issues. |
224 |
size_t my_thread_stack_size= 65536; |
225 |
||
1
by brian
clean slate |
226 |
/*
|
1130.1.4
by Monty Taylor
Moved StorageEngine into plugin namespace. |
227 |
Legacy global plugin::StorageEngine. These will be removed (please do not add more).
|
1
by brian
clean slate |
228 |
*/
|
1130.1.4
by Monty Taylor
Moved StorageEngine into plugin namespace. |
229 |
plugin::StorageEngine *heap_engine; |
230 |
plugin::StorageEngine *myisam_engine; |
|
1
by brian
clean slate |
231 |
|
232 |
char* opt_secure_file_priv= 0; |
|
233 |
||
1300.5.2
by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then |
234 |
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. |
235 |
|
971.6.7
by Eric Day
Reworked listen interface to not require binding of TCP ports. |
236 |
uint32_t drizzled_bind_timeout; |
1089.6.2
by Padraig O'Sullivan
Modified the size of the test_flags bitset to be 12 bits instead of 32. No |
237 |
std::bitset<12> test_flags; |
1089.6.1
by Padraig O'Sullivan
Converted the test_flags variable from a uint32_t to std::bitset. |
238 |
uint32_t dropping_tables, ha_open_options; |
482
by Brian Aker
Remove uint. |
239 |
uint32_t tc_heuristic_recover= 0; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
240 |
uint64_t session_startup_options; |
626
by Brian Aker
More of the same (ulong/64) |
241 |
uint32_t back_log; |
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. |
242 |
uint32_t server_id; |
622.1.1
by Brian Aker
32bit fixes around vars |
243 |
uint64_t table_cache_size; |
1226.1.3
by Brian Aker
Possible solution for hash/rehash. |
244 |
size_t table_def_size; |
625
by Brian Aker
ulong/64 bit straighten out. |
245 |
uint64_t aborted_threads; |
246 |
uint64_t aborted_connects; |
|
622.1.1
by Brian Aker
32bit fixes around vars |
247 |
uint64_t max_connect_errors; |
1093.1.57
by Jay Pipes
Merge and resolved conflicts for Monty's plugins/slots reorganization |
248 |
uint32_t global_thread_id= 1UL; |
606
by Brian Aker
Remove dead lex structure and clean up use of pid_t |
249 |
pid_t current_pid; |
1
by brian
clean slate |
250 |
|
1241.9.33
by Monty Taylor
Moved most of the global vars to set_var where they belong. |
251 |
extern const double log_10[309]; |
252 |
||
1
by brian
clean slate |
253 |
const double log_10[] = { |
254 |
1e000, 1e001, 1e002, 1e003, 1e004, 1e005, 1e006, 1e007, 1e008, 1e009, |
|
255 |
1e010, 1e011, 1e012, 1e013, 1e014, 1e015, 1e016, 1e017, 1e018, 1e019, |
|
256 |
1e020, 1e021, 1e022, 1e023, 1e024, 1e025, 1e026, 1e027, 1e028, 1e029, |
|
257 |
1e030, 1e031, 1e032, 1e033, 1e034, 1e035, 1e036, 1e037, 1e038, 1e039, |
|
258 |
1e040, 1e041, 1e042, 1e043, 1e044, 1e045, 1e046, 1e047, 1e048, 1e049, |
|
259 |
1e050, 1e051, 1e052, 1e053, 1e054, 1e055, 1e056, 1e057, 1e058, 1e059, |
|
260 |
1e060, 1e061, 1e062, 1e063, 1e064, 1e065, 1e066, 1e067, 1e068, 1e069, |
|
261 |
1e070, 1e071, 1e072, 1e073, 1e074, 1e075, 1e076, 1e077, 1e078, 1e079, |
|
262 |
1e080, 1e081, 1e082, 1e083, 1e084, 1e085, 1e086, 1e087, 1e088, 1e089, |
|
263 |
1e090, 1e091, 1e092, 1e093, 1e094, 1e095, 1e096, 1e097, 1e098, 1e099, |
|
264 |
1e100, 1e101, 1e102, 1e103, 1e104, 1e105, 1e106, 1e107, 1e108, 1e109, |
|
265 |
1e110, 1e111, 1e112, 1e113, 1e114, 1e115, 1e116, 1e117, 1e118, 1e119, |
|
266 |
1e120, 1e121, 1e122, 1e123, 1e124, 1e125, 1e126, 1e127, 1e128, 1e129, |
|
267 |
1e130, 1e131, 1e132, 1e133, 1e134, 1e135, 1e136, 1e137, 1e138, 1e139, |
|
268 |
1e140, 1e141, 1e142, 1e143, 1e144, 1e145, 1e146, 1e147, 1e148, 1e149, |
|
269 |
1e150, 1e151, 1e152, 1e153, 1e154, 1e155, 1e156, 1e157, 1e158, 1e159, |
|
270 |
1e160, 1e161, 1e162, 1e163, 1e164, 1e165, 1e166, 1e167, 1e168, 1e169, |
|
271 |
1e170, 1e171, 1e172, 1e173, 1e174, 1e175, 1e176, 1e177, 1e178, 1e179, |
|
272 |
1e180, 1e181, 1e182, 1e183, 1e184, 1e185, 1e186, 1e187, 1e188, 1e189, |
|
273 |
1e190, 1e191, 1e192, 1e193, 1e194, 1e195, 1e196, 1e197, 1e198, 1e199, |
|
274 |
1e200, 1e201, 1e202, 1e203, 1e204, 1e205, 1e206, 1e207, 1e208, 1e209, |
|
275 |
1e210, 1e211, 1e212, 1e213, 1e214, 1e215, 1e216, 1e217, 1e218, 1e219, |
|
276 |
1e220, 1e221, 1e222, 1e223, 1e224, 1e225, 1e226, 1e227, 1e228, 1e229, |
|
277 |
1e230, 1e231, 1e232, 1e233, 1e234, 1e235, 1e236, 1e237, 1e238, 1e239, |
|
278 |
1e240, 1e241, 1e242, 1e243, 1e244, 1e245, 1e246, 1e247, 1e248, 1e249, |
|
279 |
1e250, 1e251, 1e252, 1e253, 1e254, 1e255, 1e256, 1e257, 1e258, 1e259, |
|
280 |
1e260, 1e261, 1e262, 1e263, 1e264, 1e265, 1e266, 1e267, 1e268, 1e269, |
|
281 |
1e270, 1e271, 1e272, 1e273, 1e274, 1e275, 1e276, 1e277, 1e278, 1e279, |
|
282 |
1e280, 1e281, 1e282, 1e283, 1e284, 1e285, 1e286, 1e287, 1e288, 1e289, |
|
283 |
1e290, 1e291, 1e292, 1e293, 1e294, 1e295, 1e296, 1e297, 1e298, 1e299, |
|
284 |
1e300, 1e301, 1e302, 1e303, 1e304, 1e305, 1e306, 1e307, 1e308 |
|
285 |
};
|
|
286 |
||
855
by Brian Aker
Refactor reset of status. |
287 |
time_t server_start_time; |
288 |
time_t flush_status_time; |
|
1
by brian
clean slate |
289 |
|
575.4.1
by ysano
Rename mysql to drizzle. |
290 |
char drizzle_home[FN_REFLEN], pidfile_name[FN_REFLEN], system_time_zone[30]; |
1
by brian
clean slate |
291 |
char *default_tz_name; |
722.4.1
by Mark Atwood
integrate errmsg plugin into sql_print_* functions |
292 |
char glob_hostname[FN_REFLEN]; |
1300.5.3
by Monty Taylor
Removed drizzle_ prefix from some things that don't need it since they're |
293 |
char data_home_real[FN_REFLEN], |
856
by Brian Aker
Remove dead code around charset variable/directory. |
294 |
language[FN_REFLEN], |
295 |
*opt_tc_log_file; |
|
1300.5.3
by Monty Taylor
Removed drizzle_ prefix from some things that don't need it since they're |
296 |
char data_home_real_unpacked[FN_REFLEN]; |
982.1.11
by Padraig O'Sullivan
Reverted my changes for replacing Bitmap<> for the moment. Going to fix up |
297 |
const key_map key_map_empty(0); |
298 |
key_map key_map_full(0); // Will be initialized later |
|
1
by brian
clean slate |
299 |
|
1300.5.3
by Monty Taylor
Removed drizzle_ prefix from some things that don't need it since they're |
300 |
uint32_t data_home_len; |
301 |
char data_home_buff[2], *data_home=data_home_real; |
|
680
by Brian Aker
Remove locks around temp tables for searching tmp directory path. |
302 |
char *drizzle_tmpdir= NULL; |
303 |
char *opt_drizzle_tmpdir= NULL; |
|
1
by brian
clean slate |
304 |
|
305 |
/** name of reference on left espression in rewritten IN subquery */
|
|
306 |
const char *in_left_expr_name= "<left expr>"; |
|
307 |
/** name of additional condition */
|
|
308 |
const char *in_additional_cond= "<IN COND>"; |
|
309 |
const char *in_having_cond= "<IN HAVING>"; |
|
310 |
||
311 |
my_decimal decimal_zero; |
|
312 |
/* classes for comparation parsing/processing */
|
|
313 |
||
314 |
FILE *stderror_file=0; |
|
315 |
||
316 |
struct system_variables global_system_variables; |
|
317 |
struct system_variables max_system_variables; |
|
318 |
struct system_status_var global_status_var; |
|
319 |
||
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
320 |
const CHARSET_INFO *system_charset_info, *files_charset_info ; |
942.2.1
by Brian Aker
Dead option |
321 |
const CHARSET_INFO *table_alias_charset; |
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
322 |
const CHARSET_INFO *character_set_filesystem; |
1
by brian
clean slate |
323 |
|
324 |
MY_LOCALE *my_default_lc_time_names; |
|
325 |
||
177.3.1
by mark
remove ifdef HAVE_DLOPEN, make configure require dlopen() |
326 |
SHOW_COMP_OPTION have_symlink; |
1
by brian
clean slate |
327 |
|
328 |
/* Thread specific variables */
|
|
329 |
||
670.2.1
by Monty Taylor
Moved pthread keys |
330 |
pthread_key_t THR_Mem_root; |
520.6.7
by Monty Taylor
Moved a bunch of crap out of common_includes. |
331 |
pthread_key_t THR_Session; |
1046.1.2
by Brian Aker
Comments on LOCK_open |
332 |
pthread_mutex_t LOCK_create_db; |
333 |
pthread_mutex_t LOCK_open; |
|
334 |
pthread_mutex_t LOCK_thread_count; |
|
335 |
pthread_mutex_t LOCK_status; |
|
336 |
pthread_mutex_t LOCK_global_read_lock; |
|
337 |
pthread_mutex_t LOCK_global_system_variables; |
|
1
by brian
clean slate |
338 |
|
658
by Brian Aker
Part removal of my_pthread.h |
339 |
pthread_rwlock_t LOCK_system_variables_hash; |
1
by brian
clean slate |
340 |
pthread_cond_t COND_refresh, COND_thread_count, COND_global_read_lock; |
341 |
pthread_t signal_thread; |
|
971.3.23
by Eric Day
May have fixed shutdown problems. |
342 |
pthread_cond_t COND_server_end; |
1
by brian
clean slate |
343 |
|
344 |
/* Static variables */
|
|
345 |
||
900
by Brian Aker
Creating signal handler plugin. |
346 |
int cleanup_done; |
574.2.1
by ysano
Rename mysql to drizzle. |
347 |
static char *drizzle_home_ptr, *pidfile_name_ptr; |
1
by brian
clean slate |
348 |
static int defaults_argc; |
349 |
static char **defaults_argv; |
|
350 |
||
1300.5.2
by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then |
351 |
passwd *user_info; |
1
by brian
clean slate |
352 |
|
353 |
/**
|
|
354 |
Number of currently active user connections. The variable is protected by
|
|
854
by Brian Aker
Removed double lock usage. |
355 |
LOCK_thread_count.
|
1
by brian
clean slate |
356 |
*/
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
357 |
atomic<uint32_t> connection_count; |
1
by brian
clean slate |
358 |
|
1046.1.8
by Brian Aker
Remove race condition around refresh (aka... multi-thread writeable global |
359 |
/**
|
360 |
Refresh value. We use to test this to find out if a refresh even has happened recently.
|
|
361 |
*/
|
|
1220.1.3
by Brian Aker
Remove atomic on refresh (go back to do it via lazy method). |
362 |
uint64_t refresh_version; /* Increments on each reload */ |
1046.1.8
by Brian Aker
Remove race condition around refresh (aka... multi-thread writeable global |
363 |
|
1
by brian
clean slate |
364 |
/* Function declarations */
|
1130.1.12
by Monty Taylor
Moved service stuff into plugin/ |
365 |
bool drizzle_rm_tmp_tables(); |
1
by brian
clean slate |
366 |
|
574.2.1
by ysano
Rename mysql to drizzle. |
367 |
static void drizzle_init_variables(void); |
1
by brian
clean slate |
368 |
static void get_options(int *argc,char **argv); |
1410.3.4
by Djellel E. Difallah
update references to old my_'s |
369 |
int drizzled_get_one_option(int, const struct option *, char *); |
1
by brian
clean slate |
370 |
static int init_thread_environment(); |
722.1.4
by Monty Taylor
Removed all the setting of DEFS everywhere. Use configmake.h to get the values |
371 |
static const char *get_relative_path(const char *path); |
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
372 |
static void fix_paths(string &progname); |
1
by brian
clean slate |
373 |
|
374 |
static void usage(void); |
|
1085.1.2
by Monty Taylor
Fixed -Wmissing-declarations |
375 |
void close_connections(void); |
376 |
||
1
by brian
clean slate |
377 |
/****************************************************************************
|
575.4.4
by Yoshinori Sano
Rename mysql to drizzle. |
378 |
** Code to end drizzled
|
1
by brian
clean slate |
379 |
****************************************************************************/
|
380 |
||
900
by Brian Aker
Creating signal handler plugin. |
381 |
void close_connections(void) |
1
by brian
clean slate |
382 |
{
|
907
by Brian Aker
Shutdown for Linux fixed. |
383 |
/* Abort listening to new connections */
|
1130.1.12
by Monty Taylor
Moved service stuff into plugin/ |
384 |
plugin::Listen::shutdown(); |
1
by brian
clean slate |
385 |
|
386 |
/* kill connection thread */
|
|
387 |
(void) pthread_mutex_lock(&LOCK_thread_count); |
|
388 |
||
389 |
while (select_thread_in_use) |
|
390 |
{
|
|
391 |
struct timespec abstime; |
|
392 |
int error; |
|
393 |
||
394 |
set_timespec(abstime, 2); |
|
482
by Brian Aker
Remove uint. |
395 |
for (uint32_t tmp=0 ; tmp < 10 && select_thread_in_use; tmp++) |
1
by brian
clean slate |
396 |
{
|
907
by Brian Aker
Shutdown for Linux fixed. |
397 |
error=pthread_cond_timedwait(&COND_thread_count,&LOCK_thread_count, &abstime); |
1
by brian
clean slate |
398 |
if (error != EINTR) |
907
by Brian Aker
Shutdown for Linux fixed. |
399 |
break; |
1
by brian
clean slate |
400 |
}
|
401 |
}
|
|
402 |
(void) pthread_mutex_unlock(&LOCK_thread_count); |
|
403 |
||
404 |
||
405 |
/*
|
|
406 |
First signal all threads that it's time to die
|
|
407 |
This will give the threads some time to gracefully abort their
|
|
408 |
statements and inform their clients that the server is about to die.
|
|
409 |
*/
|
|
410 |
||
520.1.21
by Brian Aker
THD -> Session rename |
411 |
Session *tmp; |
960.1.1
by Monty Taylor
First pass at scheduler plugin. |
412 |
|
1
by brian
clean slate |
413 |
(void) pthread_mutex_lock(&LOCK_thread_count); // For unlink from list |
414 |
||
1320.1.14
by Brian Aker
Small style issue. |
415 |
for( SessionList::iterator it= getSessionList().begin(); it != getSessionList().end(); ++it ) |
1
by brian
clean slate |
416 |
{
|
1014.7.1
by Nathan Williams
Replaced global I_List<Session> with std::vector<Session*> |
417 |
tmp= *it; |
520.1.21
by Brian Aker
THD -> Session rename |
418 |
tmp->killed= Session::KILL_CONNECTION; |
971.3.64
by Eric Day
Cleaned up Scheduler plugin, moved more code to the schedular plugins, reworked some functions to be methods in Session, removed some dead code. |
419 |
tmp->scheduler->killSession(tmp); |
1126.10.6
by Padraig O'Sullivan
Added calls to the connection start/end dtrace probes. |
420 |
DRIZZLE_CONNECTION_DONE(tmp->thread_id); |
1
by brian
clean slate |
421 |
if (tmp->mysys_var) |
422 |
{
|
|
423 |
tmp->mysys_var->abort=1; |
|
424 |
pthread_mutex_lock(&tmp->mysys_var->mutex); |
|
425 |
if (tmp->mysys_var->current_cond) |
|
426 |
{
|
|
566
by Brian Aker
Clean up dead thead code. |
427 |
pthread_mutex_lock(tmp->mysys_var->current_mutex); |
428 |
pthread_cond_broadcast(tmp->mysys_var->current_cond); |
|
429 |
pthread_mutex_unlock(tmp->mysys_var->current_mutex); |
|
1
by brian
clean slate |
430 |
}
|
431 |
pthread_mutex_unlock(&tmp->mysys_var->mutex); |
|
432 |
}
|
|
433 |
}
|
|
434 |
(void) pthread_mutex_unlock(&LOCK_thread_count); // For unlink from list |
|
435 |
||
948
by Brian Aker
Restoring code Monty deleted. |
436 |
if (connection_count) |
437 |
sleep(2); // Give threads time to die |
|
438 |
||
1
by brian
clean slate |
439 |
/*
|
440 |
Force remaining threads to die by closing the connection to the client
|
|
441 |
This will ensure that threads that are waiting for a command from the
|
|
442 |
client on a blocking read call are aborted.
|
|
443 |
*/
|
|
934.3.10
by Monty Taylor
Revert std::vector changes. dammit. |
444 |
for (;;) |
1
by brian
clean slate |
445 |
{
|
934.3.10
by Monty Taylor
Revert std::vector changes. dammit. |
446 |
(void) pthread_mutex_lock(&LOCK_thread_count); // For unlink from list |
1241.9.17
by Monty Taylor
Removed more bits from server_includes. |
447 |
if (getSessionList().empty()) |
1
by brian
clean slate |
448 |
{
|
449 |
(void) pthread_mutex_unlock(&LOCK_thread_count); |
|
450 |
break; |
|
451 |
}
|
|
1241.9.17
by Monty Taylor
Removed more bits from server_includes. |
452 |
tmp= getSessionList().front(); |
1166.4.1
by Diego Medina
* Fixed LP bug#436685 |
453 |
/* Close before unlock, avoiding crash. See LP bug#436685 */
|
454 |
tmp->client->close(); |
|
1
by brian
clean slate |
455 |
(void) pthread_mutex_unlock(&LOCK_thread_count); |
456 |
}
|
|
457 |
}
|
|
458 |
||
459 |
/**
|
|
460 |
cleanup all memory and end program nicely.
|
|
461 |
||
462 |
If SIGNALS_DONT_BREAK_READ is defined, this function is called
|
|
575.4.4
by Yoshinori Sano
Rename mysql to drizzle. |
463 |
by the main thread. To get Drizzle to shut down nicely in this case
|
1
by brian
clean slate |
464 |
(Mac OS X) we have to call exit() instead if pthread_exit().
|
465 |
||
466 |
@note
|
|
467 |
This function never returns.
|
|
468 |
*/
|
|
1022.2.2
by Monty Taylor
Small cleanup inspired by merge. |
469 |
void unireg_end(void) |
1
by brian
clean slate |
470 |
{
|
471 |
clean_up(1); |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
472 |
internal::my_thread_end(); |
1
by brian
clean slate |
473 |
#if defined(SIGNALS_DONT_BREAK_READ)
|
474 |
exit(0); |
|
475 |
#else
|
|
476 |
pthread_exit(0); // Exit is in main thread |
|
477 |
#endif
|
|
478 |
}
|
|
479 |
||
480 |
||
1022.2.2
by Monty Taylor
Small cleanup inspired by merge. |
481 |
void unireg_abort(int exit_code) |
1
by brian
clean slate |
482 |
{
|
483 |
||
484 |
if (exit_code) |
|
755.2.1
by Mark Atwood
replace sql_print_error etc with errmsg_print |
485 |
errmsg_printf(ERRMSG_LVL_ERROR, _("Aborting\n")); |
1119.1.1
by Monty Taylor
--help doesn't need --datadir to work. |
486 |
else if (opt_help || opt_help_extended) |
1
by brian
clean slate |
487 |
usage(); |
971.6.11
by Eric Day
Removed purecov messages. |
488 |
clean_up(!opt_help && (exit_code)); |
1
by brian
clean slate |
489 |
clean_up_mutexes(); |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
490 |
internal::my_end(); |
971.6.11
by Eric Day
Removed purecov messages. |
491 |
exit(exit_code); |
1
by brian
clean slate |
492 |
}
|
493 |
||
494 |
||
1300.5.2
by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then |
495 |
void clean_up(bool print_message) |
1
by brian
clean slate |
496 |
{
|
497 |
if (cleanup_done++) |
|
971.6.11
by Eric Day
Removed purecov messages. |
498 |
return; |
1
by brian
clean slate |
499 |
|
500 |
table_cache_free(); |
|
1093.6.1
by Brian Aker
Refactor TableShare has to be behind class. |
501 |
TableShare::cacheStop(); |
1
by brian
clean slate |
502 |
set_var_free(); |
503 |
free_charsets(); |
|
1228.1.3
by Monty Taylor
All of the outstanding plugin loader system cleanups: |
504 |
plugin::Registry &plugins= plugin::Registry::singleton(); |
1110.1.3
by Monty Taylor
Added ListenHandler as a member of PluginRegistry. |
505 |
plugin_shutdown(plugins); |
1
by brian
clean slate |
506 |
xid_cache_free(); |
507 |
free_status_vars(); |
|
508 |
if (defaults_argv) |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
509 |
internal::free_defaults(defaults_argv); |
680
by Brian Aker
Remove locks around temp tables for searching tmp directory path. |
510 |
free(drizzle_tmpdir); |
460
by Monty Taylor
Removed x_free calls. |
511 |
if (opt_secure_file_priv) |
512 |
free(opt_secure_file_priv); |
|
1
by brian
clean slate |
513 |
|
1089.1.3
by Brian Aker
Fix protobuf to release memory. Add in assert() for wrong column usage. Fix |
514 |
deinit_temporal_formats(); |
515 |
||
516 |
#if GOOGLE_PROTOBUF_VERSION >= 2001000
|
|
517 |
google::protobuf::ShutdownProtobufLibrary(); |
|
518 |
#endif
|
|
519 |
||
914.2.1
by Brian Aker
Cleanup pid handler. |
520 |
(void) unlink(pidfile_name); // This may not always exist |
228
by Brian Aker
First pass on socket cleanup. |
521 |
|
202.3.6
by Monty Taylor
First pass at gettexizing the error messages. |
522 |
if (print_message && server_start_time) |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
523 |
errmsg_printf(ERRMSG_LVL_INFO, _(ER(ER_SHUTDOWN_COMPLETE)),internal::my_progname); |
1
by brian
clean slate |
524 |
(void) pthread_mutex_lock(&LOCK_thread_count); |
525 |
ready_to_exit=1; |
|
526 |
/* do the broadcast inside the lock to ensure that my_end() is not called */
|
|
971.3.23
by Eric Day
May have fixed shutdown problems. |
527 |
(void) pthread_cond_broadcast(&COND_server_end); |
1
by brian
clean slate |
528 |
(void) pthread_mutex_unlock(&LOCK_thread_count); |
529 |
||
530 |
/*
|
|
531 |
The following lines may never be executed as the main thread may have
|
|
532 |
killed us
|
|
533 |
*/
|
|
534 |
} /* clean_up */ |
|
535 |
||
536 |
||
1300.5.2
by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then |
537 |
void clean_up_mutexes() |
1
by brian
clean slate |
538 |
{
|
971.3.2
by Eric Day
Renamed LOCK_drizzleclient_create_db to LOCK_create_db since this has nothing to do with drizzleclient. I think Monty accidently got this during the drizzleclient rename. |
539 |
(void) pthread_mutex_destroy(&LOCK_create_db); |
1
by brian
clean slate |
540 |
(void) pthread_mutex_destroy(&LOCK_open); |
541 |
(void) pthread_mutex_destroy(&LOCK_thread_count); |
|
542 |
(void) pthread_mutex_destroy(&LOCK_status); |
|
543 |
(void) pthread_mutex_destroy(&LOCK_global_system_variables); |
|
658
by Brian Aker
Part removal of my_pthread.h |
544 |
(void) pthread_rwlock_destroy(&LOCK_system_variables_hash); |
1
by brian
clean slate |
545 |
(void) pthread_mutex_destroy(&LOCK_global_read_lock); |
546 |
(void) pthread_cond_destroy(&COND_thread_count); |
|
971.3.23
by Eric Day
May have fixed shutdown problems. |
547 |
(void) pthread_cond_destroy(&COND_server_end); |
1
by brian
clean slate |
548 |
(void) pthread_cond_destroy(&COND_refresh); |
549 |
(void) pthread_cond_destroy(&COND_global_read_lock); |
|
550 |
}
|
|
551 |
||
552 |
||
553 |
/* Change to run as another user if started with --user */
|
|
554 |
||
1300.5.2
by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then |
555 |
passwd *check_user(const char *user) |
1
by brian
clean slate |
556 |
{
|
1300.5.2
by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then |
557 |
passwd *tmp_user_info; |
1
by brian
clean slate |
558 |
uid_t user_id= geteuid(); |
559 |
||
560 |
// Don't bother if we aren't superuser
|
|
561 |
if (user_id) |
|
562 |
{
|
|
563 |
if (user) |
|
564 |
{
|
|
565 |
/* Don't give a warning, if real user is same as given with --user */
|
|
566 |
tmp_user_info= getpwnam(user); |
|
567 |
if ((!tmp_user_info || user_id != tmp_user_info->pw_uid) && |
|
312.1.10
by Monty Taylor
Added some strings from drizzled.cc. |
568 |
global_system_variables.log_warnings) |
755.2.1
by Mark Atwood
replace sql_print_error etc with errmsg_print |
569 |
errmsg_printf(ERRMSG_LVL_WARN, _("One can only use the --user switch " |
312.1.10
by Monty Taylor
Added some strings from drizzled.cc. |
570 |
"if running as root\n")); |
1
by brian
clean slate |
571 |
}
|
572 |
return NULL; |
|
573 |
}
|
|
574 |
if (!user) |
|
575 |
{
|
|
755.2.1
by Mark Atwood
replace sql_print_error etc with errmsg_print |
576 |
errmsg_printf(ERRMSG_LVL_ERROR, _("Fatal error: Please read \"Security\" section of " |
575.4.4
by Yoshinori Sano
Rename mysql to drizzle. |
577 |
"the manual to find out how to run drizzled as root!\n")); |
228
by Brian Aker
First pass on socket cleanup. |
578 |
unireg_abort(1); |
1
by brian
clean slate |
579 |
}
|
580 |
if (!strcmp(user,"root")) |
|
581 |
return NULL; // Avoid problem with dynamic libraries |
|
582 |
||
583 |
if (!(tmp_user_info= getpwnam(user))) |
|
584 |
{
|
|
585 |
// Allow a numeric uid to be used
|
|
586 |
const char *pos; |
|
587 |
for (pos= user; my_isdigit(mysqld_charset,*pos); pos++) ; |
|
588 |
if (*pos) // Not numeric id |
|
589 |
goto err; |
|
590 |
if (!(tmp_user_info= getpwuid(atoi(user)))) |
|
591 |
goto err; |
|
592 |
}
|
|
593 |
return tmp_user_info; |
|
594 |
||
595 |
err: |
|
755.2.1
by Mark Atwood
replace sql_print_error etc with errmsg_print |
596 |
errmsg_printf(ERRMSG_LVL_ERROR, _("Fatal error: Can't change to run as user '%s' ; " |
312.1.10
by Monty Taylor
Added some strings from drizzled.cc. |
597 |
"Please check that the user exists!\n"),user); |
1
by brian
clean slate |
598 |
unireg_abort(1); |
599 |
||
600 |
#ifdef PR_SET_DUMPABLE
|
|
1089.6.1
by Padraig O'Sullivan
Converted the test_flags variable from a uint32_t to std::bitset. |
601 |
if (test_flags.test(TEST_CORE_ON_SIGNAL)) |
1
by brian
clean slate |
602 |
{
|
603 |
/* inform kernel that process is dumpable */
|
|
604 |
(void) prctl(PR_SET_DUMPABLE, 1); |
|
605 |
}
|
|
606 |
#endif
|
|
607 |
||
908.1.13
by Monty Taylor
Fix for Sun Studio 5.10. |
608 |
/* Sun Studio 5.10 doesn't like this line. 5.9 requires it */
|
908.1.14
by Monty Taylor
I never learn. |
609 |
#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x590)
|
908.1.12
by Monty Taylor
mmm. |
610 |
return NULL; |
908.1.13
by Monty Taylor
Fix for Sun Studio 5.10. |
611 |
#endif
|
908.1.12
by Monty Taylor
mmm. |
612 |
|
1
by brian
clean slate |
613 |
}
|
614 |
||
1300.5.2
by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then |
615 |
void set_user(const char *user, passwd *user_info_arg) |
1
by brian
clean slate |
616 |
{
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
617 |
assert(user_info_arg != 0); |
1
by brian
clean slate |
618 |
/*
|
619 |
We can get a SIGSEGV when calling initgroups() on some systems when NSS
|
|
620 |
is configured to use LDAP and the server is statically linked. We set
|
|
621 |
calling_initgroups as a flag to the SIGSEGV handler that is then used to
|
|
622 |
output a specific message to help the user resolve this problem.
|
|
623 |
*/
|
|
163
by Brian Aker
Merge Monty's code. |
624 |
calling_initgroups= true; |
1
by brian
clean slate |
625 |
initgroups((char*) user, user_info_arg->pw_gid); |
163
by Brian Aker
Merge Monty's code. |
626 |
calling_initgroups= false; |
1
by brian
clean slate |
627 |
if (setgid(user_info_arg->pw_gid) == -1) |
628 |
{
|
|
629 |
sql_perror("setgid"); |
|
630 |
unireg_abort(1); |
|
631 |
}
|
|
632 |
if (setuid(user_info_arg->pw_uid) == -1) |
|
633 |
{
|
|
634 |
sql_perror("setuid"); |
|
635 |
unireg_abort(1); |
|
636 |
}
|
|
637 |
}
|
|
638 |
||
639 |
||
1300.5.2
by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then |
640 |
|
1
by brian
clean slate |
641 |
/** Change root user if started with @c --chroot . */
|
642 |
static void set_root(const char *path) |
|
643 |
{
|
|
575.4.6
by Monty Taylor
Removed my_getwd. |
644 |
if ((chroot(path) == -1) || !chdir("/")) |
1
by brian
clean slate |
645 |
{
|
646 |
sql_perror("chroot"); |
|
647 |
unireg_abort(1); |
|
648 |
}
|
|
649 |
}
|
|
650 |
||
651 |
||
652 |
/*
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
653 |
Unlink session from global list of available connections and free session
|
1
by brian
clean slate |
654 |
|
655 |
SYNOPSIS
|
|
1241.9.12
by Monty Taylor
Trims more out of server_includes.h. |
656 |
Session::unlink()
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
657 |
session Thread handler
|
1
by brian
clean slate |
658 |
|
659 |
NOTES
|
|
660 |
LOCK_thread_count is locked and left locked
|
|
661 |
*/
|
|
662 |
||
1241.9.12
by Monty Taylor
Trims more out of server_includes.h. |
663 |
void Session::unlink(Session *session) |
1
by brian
clean slate |
664 |
{
|
1260.1.2
by Monty Taylor
Replaced operator overloads with methods since we can't actually usefully follow the proper semantics for the operators. |
665 |
connection_count.decrement(); |
942.2.5
by Brian Aker
Fix, again, the thread lock issues for unlink_session |
666 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
667 |
session->cleanup(); |
1
by brian
clean slate |
668 |
|
947
by Brian Aker
Merge fix |
669 |
(void) pthread_mutex_lock(&LOCK_thread_count); |
948
by Brian Aker
Restoring code Monty deleted. |
670 |
pthread_mutex_lock(&session->LOCK_delete); |
1014.7.1
by Nathan Williams
Replaced global I_List<Session> with std::vector<Session*> |
671 |
|
1241.9.17
by Monty Taylor
Removed more bits from server_includes. |
672 |
getSessionList().erase(remove(getSessionList().begin(), |
673 |
getSessionList().end(), |
|
674 |
session)); |
|
1014.7.1
by Nathan Williams
Replaced global I_List<Session> with std::vector<Session*> |
675 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
676 |
delete session; |
942.2.5
by Brian Aker
Fix, again, the thread lock issues for unlink_session |
677 |
(void) pthread_mutex_unlock(&LOCK_thread_count); |
938
by Brian Aker
Merge of Monty/Eric/Padraig |
678 |
|
853
by Brian Aker
Moved locks around (aka... unlink_session now handles its own locking). |
679 |
return; |
1
by brian
clean slate |
680 |
}
|
681 |
||
682 |
||
683 |
#ifdef THREAD_SPECIFIC_SIGPIPE
|
|
684 |
/**
|
|
685 |
||
686 |
@todo
|
|
687 |
One should have to fix that thr_alarm know about this thread too.
|
|
688 |
*/
|
|
779.1.27
by Monty Taylor
Got rid of __attribute__((unused)) and the like from the .cc files. |
689 |
extern "C" void abort_thread(int ) |
1
by brian
clean slate |
690 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
691 |
Session *session=current_session; |
692 |
if (session) |
|
693 |
session->killed= Session::KILL_CONNECTION; |
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
694 |
return;; |
1
by brian
clean slate |
695 |
}
|
696 |
#endif
|
|
697 |
||
1300.5.2
by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then |
698 |
|
1
by brian
clean slate |
699 |
#ifndef SA_RESETHAND
|
700 |
#define SA_RESETHAND 0
|
|
701 |
#endif
|
|
702 |
#ifndef SA_NODEFER
|
|
703 |
#define SA_NODEFER 0
|
|
704 |
#endif
|
|
705 |
||
706 |
||
1300.5.2
by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then |
707 |
|
708 |
||
709 |
const char *load_default_groups[]= |
|
1
by brian
clean slate |
710 |
{
|
1300.5.2
by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then |
711 |
DRIZZLE_CONFIG_NAME, "server", 0, 0 |
712 |
};
|
|
1
by brian
clean slate |
713 |
|
1273.13.73
by Brian Aker
Remove typedef and drop some dead code. |
714 |
static int show_starttime(drizzle_show_var *var, char *buff) |
1165.1.85
by Stewart Smith
make status_vars static to drizzled/drizzled.cc |
715 |
{
|
716 |
var->type= SHOW_LONG; |
|
717 |
var->value= buff; |
|
718 |
*((long *)buff)= (long) (time(NULL) - server_start_time); |
|
719 |
return 0; |
|
720 |
}
|
|
721 |
||
1273.13.73
by Brian Aker
Remove typedef and drop some dead code. |
722 |
static int show_flushstatustime(drizzle_show_var *var, char *buff) |
1165.1.85
by Stewart Smith
make status_vars static to drizzled/drizzled.cc |
723 |
{
|
724 |
var->type= SHOW_LONG; |
|
725 |
var->value= buff; |
|
726 |
*((long *)buff)= (long) (time(NULL) - flush_status_time); |
|
727 |
return 0; |
|
728 |
}
|
|
729 |
||
1345
by Brian Aker
Corrections. |
730 |
static st_show_var_func_container show_starttime_cont= { &show_starttime }; |
731 |
||
732 |
static st_show_var_func_container show_flushstatustime_cont= { &show_flushstatustime }; |
|
1165.1.85
by Stewart Smith
make status_vars static to drizzled/drizzled.cc |
733 |
|
734 |
/*
|
|
735 |
Variables shown by SHOW STATUS in alphabetical order
|
|
736 |
*/
|
|
1273.13.73
by Brian Aker
Remove typedef and drop some dead code. |
737 |
static drizzle_show_var com_status_vars[]= { |
1273.13.74
by Brian Aker
Bits of dead code/STATUS_VAR rename. |
738 |
{"admin_commands", (char*) offsetof(system_status_var, com_other), SHOW_LONG_STATUS}, |
739 |
{"alter_db", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_ALTER_DB]), SHOW_LONG_STATUS}, |
|
740 |
{"alter_table", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_ALTER_TABLE]), SHOW_LONG_STATUS}, |
|
741 |
{"analyze", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_ANALYZE]), SHOW_LONG_STATUS}, |
|
742 |
{"begin", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_BEGIN]), SHOW_LONG_STATUS}, |
|
743 |
{"change_db", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_CHANGE_DB]), SHOW_LONG_STATUS}, |
|
744 |
{"check", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_CHECK]), SHOW_LONG_STATUS}, |
|
745 |
{"checksum", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_CHECKSUM]), SHOW_LONG_STATUS}, |
|
746 |
{"commit", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_COMMIT]), SHOW_LONG_STATUS}, |
|
747 |
{"create_db", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_CREATE_DB]), SHOW_LONG_STATUS}, |
|
748 |
{"create_index", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_CREATE_INDEX]), SHOW_LONG_STATUS}, |
|
749 |
{"create_table", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_CREATE_TABLE]), SHOW_LONG_STATUS}, |
|
750 |
{"delete", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_DELETE]), SHOW_LONG_STATUS}, |
|
751 |
{"drop_db", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_DROP_DB]), SHOW_LONG_STATUS}, |
|
752 |
{"drop_index", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_DROP_INDEX]), SHOW_LONG_STATUS}, |
|
753 |
{"drop_table", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_DROP_TABLE]), SHOW_LONG_STATUS}, |
|
754 |
{"empty_query", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_EMPTY_QUERY]), SHOW_LONG_STATUS}, |
|
755 |
{"flush", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_FLUSH]), SHOW_LONG_STATUS}, |
|
756 |
{"insert", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_INSERT]), SHOW_LONG_STATUS}, |
|
757 |
{"insert_select", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_INSERT_SELECT]), SHOW_LONG_STATUS}, |
|
758 |
{"kill", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_KILL]), SHOW_LONG_STATUS}, |
|
759 |
{"load", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_LOAD]), SHOW_LONG_STATUS}, |
|
760 |
{"release_savepoint", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_RELEASE_SAVEPOINT]), SHOW_LONG_STATUS}, |
|
761 |
{"rename_table", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_RENAME_TABLE]), SHOW_LONG_STATUS}, |
|
762 |
{"replace", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_REPLACE]), SHOW_LONG_STATUS}, |
|
763 |
{"replace_select", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_REPLACE_SELECT]), SHOW_LONG_STATUS}, |
|
764 |
{"rollback", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_ROLLBACK]), SHOW_LONG_STATUS}, |
|
765 |
{"rollback_to_savepoint",(char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_ROLLBACK_TO_SAVEPOINT]), SHOW_LONG_STATUS}, |
|
766 |
{"savepoint", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_SAVEPOINT]), SHOW_LONG_STATUS}, |
|
767 |
{"select", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_SELECT]), SHOW_LONG_STATUS}, |
|
768 |
{"set_option", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_SET_OPTION]), SHOW_LONG_STATUS}, |
|
769 |
{"show_create_db", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_SHOW_CREATE_DB]), SHOW_LONG_STATUS}, |
|
770 |
{"show_create_table", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_SHOW_CREATE]), SHOW_LONG_STATUS}, |
|
771 |
{"show_errors", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_SHOW_ERRORS]), SHOW_LONG_STATUS}, |
|
772 |
{"show_warnings", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_SHOW_WARNS]), SHOW_LONG_STATUS}, |
|
773 |
{"truncate", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_TRUNCATE]), SHOW_LONG_STATUS}, |
|
774 |
{"unlock_tables", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_UNLOCK_TABLES]), SHOW_LONG_STATUS}, |
|
775 |
{"update", (char*) offsetof(system_status_var, com_stat[(uint32_t) SQLCOM_UPDATE]), SHOW_LONG_STATUS}, |
|
625
by Brian Aker
ulong/64 bit straighten out. |
776 |
{NULL, NULL, SHOW_LONGLONG} |
1
by brian
clean slate |
777 |
};
|
778 |
||
1273.13.73
by Brian Aker
Remove typedef and drop some dead code. |
779 |
static drizzle_show_var status_vars[]= { |
1165.1.85
by Stewart Smith
make status_vars static to drizzled/drizzled.cc |
780 |
{"Aborted_clients", (char*) &aborted_threads, SHOW_LONGLONG}, |
781 |
{"Aborted_connects", (char*) &aborted_connects, SHOW_LONGLONG}, |
|
1273.13.74
by Brian Aker
Bits of dead code/STATUS_VAR rename. |
782 |
{"Bytes_received", (char*) offsetof(system_status_var, bytes_received), SHOW_LONGLONG_STATUS}, |
783 |
{"Bytes_sent", (char*) offsetof(system_status_var, bytes_sent), SHOW_LONGLONG_STATUS}, |
|
1165.1.85
by Stewart Smith
make status_vars static to drizzled/drizzled.cc |
784 |
{"Connections", (char*) &global_thread_id, SHOW_INT_NOFLUSH}, |
1273.13.74
by Brian Aker
Bits of dead code/STATUS_VAR rename. |
785 |
{"Created_tmp_disk_tables", (char*) offsetof(system_status_var, created_tmp_disk_tables), SHOW_LONG_STATUS}, |
786 |
{"Created_tmp_tables", (char*) offsetof(system_status_var, created_tmp_tables), SHOW_LONG_STATUS}, |
|
1165.1.85
by Stewart Smith
make status_vars static to drizzled/drizzled.cc |
787 |
{"Flush_commands", (char*) &refresh_version, SHOW_INT_NOFLUSH}, |
1273.13.74
by Brian Aker
Bits of dead code/STATUS_VAR rename. |
788 |
{"Handler_commit", (char*) offsetof(system_status_var, ha_commit_count), SHOW_LONG_STATUS}, |
789 |
{"Handler_delete", (char*) offsetof(system_status_var, ha_delete_count), SHOW_LONG_STATUS}, |
|
790 |
{"Handler_prepare", (char*) offsetof(system_status_var, ha_prepare_count), SHOW_LONG_STATUS}, |
|
791 |
{"Handler_read_first", (char*) offsetof(system_status_var, ha_read_first_count), SHOW_LONG_STATUS}, |
|
792 |
{"Handler_read_key", (char*) offsetof(system_status_var, ha_read_key_count), SHOW_LONG_STATUS}, |
|
793 |
{"Handler_read_next", (char*) offsetof(system_status_var, ha_read_next_count), SHOW_LONG_STATUS}, |
|
794 |
{"Handler_read_prev", (char*) offsetof(system_status_var, ha_read_prev_count), SHOW_LONG_STATUS}, |
|
795 |
{"Handler_read_rnd", (char*) offsetof(system_status_var, ha_read_rnd_count), SHOW_LONG_STATUS}, |
|
796 |
{"Handler_read_rnd_next", (char*) offsetof(system_status_var, ha_read_rnd_next_count), SHOW_LONG_STATUS}, |
|
797 |
{"Handler_rollback", (char*) offsetof(system_status_var, ha_rollback_count), SHOW_LONG_STATUS}, |
|
798 |
{"Handler_savepoint", (char*) offsetof(system_status_var, ha_savepoint_count), SHOW_LONG_STATUS}, |
|
799 |
{"Handler_savepoint_rollback",(char*) offsetof(system_status_var, ha_savepoint_rollback_count), SHOW_LONG_STATUS}, |
|
800 |
{"Handler_update", (char*) offsetof(system_status_var, ha_update_count), SHOW_LONG_STATUS}, |
|
801 |
{"Handler_write", (char*) offsetof(system_status_var, ha_write_count), SHOW_LONG_STATUS}, |
|
1165.1.85
by Stewart Smith
make status_vars static to drizzled/drizzled.cc |
802 |
{"Key_blocks_not_flushed", (char*) offsetof(KEY_CACHE, global_blocks_changed), SHOW_KEY_CACHE_LONG}, |
803 |
{"Key_blocks_unused", (char*) offsetof(KEY_CACHE, blocks_unused), SHOW_KEY_CACHE_LONG}, |
|
804 |
{"Key_blocks_used", (char*) offsetof(KEY_CACHE, blocks_used), SHOW_KEY_CACHE_LONG}, |
|
805 |
{"Key_read_requests", (char*) offsetof(KEY_CACHE, global_cache_r_requests), SHOW_KEY_CACHE_LONGLONG}, |
|
806 |
{"Key_reads", (char*) offsetof(KEY_CACHE, global_cache_read), SHOW_KEY_CACHE_LONGLONG}, |
|
807 |
{"Key_write_requests", (char*) offsetof(KEY_CACHE, global_cache_w_requests), SHOW_KEY_CACHE_LONGLONG}, |
|
808 |
{"Key_writes", (char*) offsetof(KEY_CACHE, global_cache_write), SHOW_KEY_CACHE_LONGLONG}, |
|
1273.13.74
by Brian Aker
Bits of dead code/STATUS_VAR rename. |
809 |
{"Last_query_cost", (char*) offsetof(system_status_var, last_query_cost), SHOW_DOUBLE_STATUS}, |
1165.1.85
by Stewart Smith
make status_vars static to drizzled/drizzled.cc |
810 |
{"Max_used_connections", (char*) &max_used_connections, SHOW_INT}, |
1273.13.74
by Brian Aker
Bits of dead code/STATUS_VAR rename. |
811 |
{"Questions", (char*) offsetof(system_status_var, questions), SHOW_LONG_STATUS}, |
812 |
{"Select_full_join", (char*) offsetof(system_status_var, select_full_join_count), SHOW_LONG_STATUS}, |
|
813 |
{"Select_full_range_join", (char*) offsetof(system_status_var, select_full_range_join_count), SHOW_LONG_STATUS}, |
|
814 |
{"Select_range", (char*) offsetof(system_status_var, select_range_count), SHOW_LONG_STATUS}, |
|
815 |
{"Select_range_check", (char*) offsetof(system_status_var, select_range_check_count), SHOW_LONG_STATUS}, |
|
816 |
{"Select_scan", (char*) offsetof(system_status_var, select_scan_count), SHOW_LONG_STATUS}, |
|
817 |
{"Slow_queries", (char*) offsetof(system_status_var, long_query_count), SHOW_LONG_STATUS}, |
|
818 |
{"Sort_merge_passes", (char*) offsetof(system_status_var, filesort_merge_passes), SHOW_LONG_STATUS}, |
|
819 |
{"Sort_range", (char*) offsetof(system_status_var, filesort_range_count), SHOW_LONG_STATUS}, |
|
820 |
{"Sort_rows", (char*) offsetof(system_status_var, filesort_rows), SHOW_LONG_STATUS}, |
|
821 |
{"Sort_scan", (char*) offsetof(system_status_var, filesort_scan_count), SHOW_LONG_STATUS}, |
|
1165.1.85
by Stewart Smith
make status_vars static to drizzled/drizzled.cc |
822 |
{"Table_locks_immediate", (char*) &locks_immediate, SHOW_INT}, |
823 |
{"Table_locks_waited", (char*) &locks_waited, SHOW_INT}, |
|
824 |
{"Threads_connected", (char*) &connection_count, SHOW_INT}, |
|
825 |
{"Uptime", (char*) &show_starttime_cont, SHOW_FUNC}, |
|
826 |
{"Uptime_since_flush_status",(char*) &show_flushstatustime_cont, SHOW_FUNC}, |
|
827 |
{NULL, NULL, SHOW_LONGLONG} |
|
828 |
};
|
|
829 |
||
1300.5.2
by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then |
830 |
int init_common_variables(const char *conf_file_name, int argc, |
831 |
char **argv, const char **groups) |
|
1
by brian
clean slate |
832 |
{
|
685.3.4
by Toru Maesaka
Fixed the issues pointed out by Jay's code review |
833 |
time_t curr_time; |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
834 |
umask(((~internal::my_umask) & 0666)); |
1
by brian
clean slate |
835 |
my_decimal_set_zero(&decimal_zero); // set decimal_zero constant; |
836 |
tzset(); // Set tzname |
|
837 |
||
685.3.4
by Toru Maesaka
Fixed the issues pointed out by Jay's code review |
838 |
curr_time= time(NULL); |
839 |
if (curr_time == (time_t)-1) |
|
685.3.2
by Toru Maesaka
Removed my_time() and added error checking |
840 |
return 1; |
841 |
||
298
by Brian Aker
ulong conversion. |
842 |
max_system_variables.pseudo_thread_id= UINT32_MAX; |
685.3.4
by Toru Maesaka
Fixed the issues pointed out by Jay's code review |
843 |
server_start_time= flush_status_time= curr_time; |
1
by brian
clean slate |
844 |
|
845 |
if (init_thread_environment()) |
|
846 |
return 1; |
|
574.2.1
by ysano
Rename mysql to drizzle. |
847 |
drizzle_init_variables(); |
1
by brian
clean slate |
848 |
|
849 |
{
|
|
850 |
struct tm tm_tmp; |
|
851 |
localtime_r(&server_start_time,&tm_tmp); |
|
629.5.4
by Toru Maesaka
Fourth pass of replacing MySQL's strmake() with libc calls |
852 |
strncpy(system_time_zone, tzname[tm_tmp.tm_isdst != 0 ? 1 : 0], |
1
by brian
clean slate |
853 |
sizeof(system_time_zone)-1); |
854 |
||
1309.2.15
by Brian Aker
Small cleanup around alter table. |
855 |
}
|
1
by brian
clean slate |
856 |
/*
|
857 |
We set SYSTEM time zone as reasonable default and
|
|
858 |
also for failure of my_tz_init() and bootstrap mode.
|
|
859 |
If user explicitly set time zone with --default-time-zone
|
|
860 |
option we will change this value in my_tz_init().
|
|
861 |
*/
|
|
862 |
global_system_variables.time_zone= my_tz_SYSTEM; |
|
863 |
||
864 |
if (gethostname(glob_hostname,sizeof(glob_hostname)) < 0) |
|
865 |
{
|
|
629.5.4
by Toru Maesaka
Fourth pass of replacing MySQL's strmake() with libc calls |
866 |
strncpy(glob_hostname, STRING_WITH_LEN("localhost")); |
1309.2.15
by Brian Aker
Small cleanup around alter table. |
867 |
errmsg_printf(ERRMSG_LVL_WARN, _("gethostname failed, using '%s' as hostname"), |
868 |
glob_hostname); |
|
907.1.2
by Jay Pipes
Merging in old r902 temporal changes |
869 |
strncpy(pidfile_name, STRING_WITH_LEN("drizzle")); |
1
by brian
clean slate |
870 |
}
|
871 |
else
|
|
629.5.4
by Toru Maesaka
Fourth pass of replacing MySQL's strmake() with libc calls |
872 |
strncpy(pidfile_name, glob_hostname, sizeof(pidfile_name)-5); |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
873 |
strcpy(internal::fn_ext(pidfile_name),".pid"); // Add proper extension |
1
by brian
clean slate |
874 |
|
875 |
/*
|
|
876 |
Add server status variables to the dynamic list of
|
|
877 |
status variables that is shown by SHOW STATUS.
|
|
1241.10.7
by Monty Taylor
Removed some cruft. |
878 |
Later, in plugin_init, new entries could be added to that list.
|
1
by brian
clean slate |
879 |
*/
|
1273.13.76
by Brian Aker
Remove dead SHOW_ARRAY type. |
880 |
if (add_com_status_vars(com_status_vars)) |
881 |
return 1; // an error was already reported |
|
882 |
||
1
by brian
clean slate |
883 |
if (add_status_vars(status_vars)) |
884 |
return 1; // an error was already reported |
|
885 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
886 |
internal::load_defaults(conf_file_name, groups, &argc, &argv); |
1
by brian
clean slate |
887 |
defaults_argv=argv; |
888 |
defaults_argc=argc; |
|
889 |
get_options(&defaults_argc, defaults_argv); |
|
890 |
||
1222.1.15
by Brian Aker
Removed white space/removed one dumb conversion for getpid(). |
891 |
current_pid= getpid(); /* Save for later ref */ |
909
by Brian Aker
Remove the need for unireg init |
892 |
init_time(); /* Init time-functions (read zone) */ |
893 |
||
1
by brian
clean slate |
894 |
if (item_create_init()) |
895 |
return 1; |
|
896 |
if (set_var_init()) |
|
897 |
return 1; |
|
813.1.2
by Jay Pipes
First function cleanup for temporal handling: YEAR() |
898 |
/* Creates static regex matching for temporal values */
|
899 |
if (! init_temporal_formats()) |
|
900 |
return 1; |
|
1085.3.6
by Monty Taylor
Removed a problematic section that's pointless. |
901 |
|
902 |
if (!(default_charset_info= |
|
903 |
get_charset_by_csname(default_character_set_name, MY_CS_PRIMARY))) |
|
1
by brian
clean slate |
904 |
{
|
1085.3.6
by Monty Taylor
Removed a problematic section that's pointless. |
905 |
return 1; // Eof of the list |
1
by brian
clean slate |
906 |
}
|
907 |
||
908 |
if (default_collation_name) |
|
909 |
{
|
|
862
by Brian Aker
Remove charset directory code. |
910 |
const CHARSET_INFO * const default_collation= get_charset_by_name(default_collation_name); |
1273.13.38
by Brian Aker
Add in new show work. |
911 |
if (not default_collation) |
1
by brian
clean slate |
912 |
{
|
1273.13.38
by Brian Aker
Add in new show work. |
913 |
errmsg_printf(ERRMSG_LVL_ERROR, _(ER(ER_UNKNOWN_COLLATION)), default_collation_name); |
1
by brian
clean slate |
914 |
return 1; |
915 |
}
|
|
1273.13.38
by Brian Aker
Add in new show work. |
916 |
if (not my_charset_same(default_charset_info, default_collation)) |
1
by brian
clean slate |
917 |
{
|
1273.13.38
by Brian Aker
Add in new show work. |
918 |
errmsg_printf(ERRMSG_LVL_ERROR, _(ER(ER_COLLATION_CHARSET_MISMATCH)), |
919 |
default_collation_name, |
|
920 |
default_charset_info->csname); |
|
1
by brian
clean slate |
921 |
return 1; |
922 |
}
|
|
923 |
default_charset_info= default_collation; |
|
924 |
}
|
|
925 |
/* Set collactions that depends on the default collation */
|
|
926 |
global_system_variables.collation_server= default_charset_info; |
|
927 |
||
1273.13.38
by Brian Aker
Add in new show work. |
928 |
if (not (character_set_filesystem= |
1309.2.15
by Brian Aker
Small cleanup around alter table. |
929 |
get_charset_by_csname(character_set_filesystem_name, MY_CS_PRIMARY))) |
1
by brian
clean slate |
930 |
return 1; |
931 |
global_system_variables.character_set_filesystem= character_set_filesystem; |
|
932 |
||
933 |
if (!(my_default_lc_time_names= |
|
934 |
my_locale_by_name(lc_time_names_name))) |
|
935 |
{
|
|
1309.2.15
by Brian Aker
Small cleanup around alter table. |
936 |
errmsg_printf(ERRMSG_LVL_ERROR, _("Unknown locale: '%s'"), lc_time_names_name); |
1
by brian
clean slate |
937 |
return 1; |
938 |
}
|
|
939 |
global_system_variables.lc_time_names= my_default_lc_time_names; |
|
236.1.40
by Monty Taylor
A few meaningless changes. |
940 |
|
1039.1.5
by Brian Aker
Remove lower case filename bits (aka we just lock into the most compatible |
941 |
/* Reset table_alias_charset */
|
224.2.1
by Brian Aker
First pass for table name issue across platforms. |
942 |
table_alias_charset= files_charset_info; |
1
by brian
clean slate |
943 |
|
944 |
return 0; |
|
945 |
}
|
|
946 |
||
947 |
||
948 |
static int init_thread_environment() |
|
949 |
{
|
|
1273.13.1
by Brian Aker
First pass through data dictionary. |
950 |
pthread_mutexattr_t attr; |
951 |
pthread_mutexattr_init(&attr); |
|
952 |
||
975
by Brian Aker
Merge refactoring around plugin_ref |
953 |
(void) pthread_mutex_init(&LOCK_create_db, NULL); |
1
by brian
clean slate |
954 |
(void) pthread_mutex_init(&LOCK_open, NULL); |
1273.13.1
by Brian Aker
First pass through data dictionary. |
955 |
|
956 |
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); |
|
957 |
(void) pthread_mutex_init(&LOCK_thread_count, &attr); |
|
1273.13.22
by Brian Aker
Added status bits. Variables next! |
958 |
(void) pthread_mutex_init(&LOCK_global_system_variables, &attr); |
1273.13.1
by Brian Aker
First pass through data dictionary. |
959 |
|
960 |
(void) pthread_mutex_init(&LOCK_status, MY_MUTEX_INIT_FAST); |
|
658
by Brian Aker
Part removal of my_pthread.h |
961 |
(void) pthread_rwlock_init(&LOCK_system_variables_hash, NULL); |
1
by brian
clean slate |
962 |
(void) pthread_mutex_init(&LOCK_global_read_lock, MY_MUTEX_INIT_FAST); |
963 |
(void) pthread_cond_init(&COND_thread_count,NULL); |
|
971.3.23
by Eric Day
May have fixed shutdown problems. |
964 |
(void) pthread_cond_init(&COND_server_end,NULL); |
1
by brian
clean slate |
965 |
(void) pthread_cond_init(&COND_refresh,NULL); |
966 |
(void) pthread_cond_init(&COND_global_read_lock,NULL); |
|
967 |
||
1273.13.1
by Brian Aker
First pass through data dictionary. |
968 |
pthread_mutexattr_destroy(&attr); |
969 |
||
520.1.21
by Brian Aker
THD -> Session rename |
970 |
if (pthread_key_create(&THR_Session,NULL) || |
670.2.1
by Monty Taylor
Moved pthread keys |
971 |
pthread_key_create(&THR_Mem_root,NULL)) |
1
by brian
clean slate |
972 |
{
|
755.2.1
by Mark Atwood
replace sql_print_error etc with errmsg_print |
973 |
errmsg_printf(ERRMSG_LVL_ERROR, _("Can't create thread-keys")); |
1
by brian
clean slate |
974 |
return 1; |
975 |
}
|
|
976 |
return 0; |
|
977 |
}
|
|
978 |
||
979 |
||
1300.5.2
by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then |
980 |
int init_server_components(plugin::Registry &plugins) |
1
by brian
clean slate |
981 |
{
|
982 |
/*
|
|
983 |
We need to call each of these following functions to ensure that
|
|
984 |
all things are initialized so that unireg_abort() doesn't fail
|
|
985 |
*/
|
|
1093.6.1
by Brian Aker
Refactor TableShare has to be behind class. |
986 |
if (table_cache_init()) |
987 |
unireg_abort(1); |
|
1223.3.1
by Monty Taylor
Replace HASH in table_share with drizzled::hash_map |
988 |
TableShare::cacheStart(); |
1
by brian
clean slate |
989 |
|
990 |
setup_fpu(); |
|
991 |
init_thr_lock(); |
|
992 |
||
993 |
/* Setup logs */
|
|
994 |
||
995 |
if (xid_cache_init()) |
|
996 |
{
|
|
755.2.1
by Mark Atwood
replace sql_print_error etc with errmsg_print |
997 |
errmsg_printf(ERRMSG_LVL_ERROR, _("Out of memory")); |
1
by brian
clean slate |
998 |
unireg_abort(1); |
999 |
}
|
|
1000 |
||
1001 |
/* Allow storage engine to give real error messages */
|
|
1271.7.9
by Tim Penhey
Almost there. |
1002 |
ha_init_errors(); |
1
by brian
clean slate |
1003 |
|
1119.1.1
by Monty Taylor
--help doesn't need --datadir to work. |
1004 |
if (plugin_init(plugins, &defaults_argc, defaults_argv, |
1241.10.2
by Monty Taylor
Added support for embedding the drizzle version number in the plugin file. |
1005 |
((opt_help) ? true : false))) |
1
by brian
clean slate |
1006 |
{
|
1089.9.1
by Jay Pipes
Removes a bunch of dead code and unused variables in drizzled.cc and server_includes.h |
1007 |
errmsg_printf(ERRMSG_LVL_ERROR, _("Failed to initialize plugins.")); |
1
by brian
clean slate |
1008 |
unireg_abort(1); |
1009 |
}
|
|
1010 |
||
1119.1.1
by Monty Taylor
--help doesn't need --datadir to work. |
1011 |
if (opt_help || opt_help_extended) |
1
by brian
clean slate |
1012 |
unireg_abort(0); |
1013 |
||
1014 |
/* we do want to exit if there are any other unknown options */
|
|
1015 |
if (defaults_argc > 1) |
|
1016 |
{
|
|
1017 |
int ho_error; |
|
1018 |
char **tmp_argv= defaults_argv; |
|
1410.3.4
by Djellel E. Difallah
update references to old my_'s |
1019 |
struct option no_opts[]= |
1
by brian
clean slate |
1020 |
{
|
1021 |
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} |
|
1022 |
};
|
|
1023 |
/*
|
|
1024 |
We need to eat any 'loose' arguments first before we conclude
|
|
1025 |
that there are unprocessed options.
|
|
1026 |
But we need to preserve defaults_argv pointer intact for
|
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1027 |
internal::free_defaults() to work. Thus we use a copy here.
|
1
by brian
clean slate |
1028 |
*/
|
1029 |
my_getopt_skip_unknown= 0; |
|
1030 |
||
1031 |
if ((ho_error= handle_options(&defaults_argc, &tmp_argv, no_opts, |
|
575.4.4
by Yoshinori Sano
Rename mysql to drizzle. |
1032 |
drizzled_get_one_option))) |
1
by brian
clean slate |
1033 |
unireg_abort(ho_error); |
1034 |
||
1035 |
if (defaults_argc) |
|
1036 |
{
|
|
312.1.15
by Monty Taylor
Finished marking strings in drizzled.cc. |
1037 |
fprintf(stderr, |
1038 |
_("%s: Too many arguments (first extra is '%s').\n" |
|
1039 |
"Use --verbose --help to get a list of available options\n"), |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1040 |
internal::my_progname, *tmp_argv); |
1
by brian
clean slate |
1041 |
unireg_abort(1); |
1042 |
}
|
|
1043 |
}
|
|
1044 |
||
994.2.2
by Monty Taylor
Store a Registry of SchedulerFactories and set one of them at startup for better error messages earlier. |
1045 |
string scheduler_name; |
1046 |
if (opt_scheduler) |
|
1047 |
{
|
|
1048 |
scheduler_name= opt_scheduler; |
|
1049 |
}
|
|
1050 |
else
|
|
1051 |
{
|
|
1052 |
scheduler_name= opt_scheduler_default; |
|
1053 |
}
|
|
1054 |
||
1152.1.5
by Brian Aker
Remove Factory/make scheduler work like everything else. |
1055 |
if (plugin::Scheduler::setPlugin(scheduler_name)) |
994.2.2
by Monty Taylor
Store a Registry of SchedulerFactories and set one of them at startup for better error messages earlier. |
1056 |
{
|
1057 |
errmsg_printf(ERRMSG_LVL_ERROR, |
|
1058 |
_("No scheduler found, cannot continue!\n")); |
|
1059 |
unireg_abort(1); |
|
1060 |
}
|
|
1061 |
||
1
by brian
clean slate |
1062 |
/*
|
971.1.22
by Monty Taylor
Moved storage engine initialization to init methods. |
1063 |
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 |
1064 |
"memory" engine which will be configurable longterm.
|
971.1.22
by Monty Taylor
Moved storage engine initialization to init methods. |
1065 |
*/
|
1095.3.9
by Stewart Smith
refactor ha_resolve_by_name to accept std::string instead of LEX_STRING |
1066 |
const std::string myisam_engine_name("MyISAM"); |
1067 |
const std::string heap_engine_name("MEMORY"); |
|
1183.1.29
by Brian Aker
Clean up interface so that Truncate sets the propper engine when |
1068 |
myisam_engine= plugin::StorageEngine::findByName(myisam_engine_name); |
1069 |
heap_engine= plugin::StorageEngine::findByName(heap_engine_name); |
|
971.1.22
by Monty Taylor
Moved storage engine initialization to init methods. |
1070 |
|
1071 |
/*
|
|
1
by brian
clean slate |
1072 |
Check that the default storage engine is actually available.
|
1073 |
*/
|
|
1074 |
if (default_storage_engine_str) |
|
1075 |
{
|
|
1095.3.9
by Stewart Smith
refactor ha_resolve_by_name to accept std::string instead of LEX_STRING |
1076 |
const std::string name(default_storage_engine_str); |
1130.1.4
by Monty Taylor
Moved StorageEngine into plugin namespace. |
1077 |
plugin::StorageEngine *engine; |
236.1.40
by Monty Taylor
A few meaningless changes. |
1078 |
|
1183.1.29
by Brian Aker
Clean up interface so that Truncate sets the propper engine when |
1079 |
engine= plugin::StorageEngine::findByName(name); |
1095.3.32
by Stewart Smith
misc codestyle fixes. usually around if ( and associated conditions |
1080 |
if (engine == NULL) |
971.1.21
by Monty Taylor
Store StorageEngine in system variables, rather than storage engine plugin. |
1081 |
{
|
1273.1.20
by Jay Pipes
Remove StorageEngine::start_consitent_snapshot() and StorageEngine::enable(), disable() and is_enabled(). Unused. |
1082 |
errmsg_printf(ERRMSG_LVL_ERROR, _("Unknown/unsupported storage engine: %s"), |
1083 |
default_storage_engine_str); |
|
1084 |
unireg_abort(1); |
|
1085 |
}
|
|
1086 |
global_system_variables.storage_engine= engine; |
|
1
by brian
clean slate |
1087 |
}
|
1088 |
||
1273.1.30
by Jay Pipes
* Completes the blueprint for splitting the XA Resource Manager |
1089 |
if (plugin::XaResourceManager::recoverAllXids(0)) |
1
by brian
clean slate |
1090 |
{
|
1091 |
unireg_abort(1); |
|
1092 |
}
|
|
1093 |
||
1094 |
init_update_queries(); |
|
1280.1.4
by Brian Aker
Remove dead option. |
1095 |
|
51.2.1
by Patrick Galbraith
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from |
1096 |
return(0); |
1
by brian
clean slate |
1097 |
}
|
1098 |
||
1099 |
||
1100 |
/****************************************************************************
|
|
1101 |
Handle start options
|
|
1102 |
******************************************************************************/
|
|
1103 |
||
575.4.4
by Yoshinori Sano
Rename mysql to drizzle. |
1104 |
enum options_drizzled |
1
by brian
clean slate |
1105 |
{
|
1067.1.4
by Stewart Smith
remove unused log-isam server option |
1106 |
OPT_SOCKET=256, |
1115.1.2
by Brian Aker
Taylor the defaults for MyISAM for its "tmp" behavior. |
1107 |
OPT_BIND_ADDRESS, |
1108 |
OPT_PID_FILE, |
|
867
by Brian Aker
Remove dead options. |
1109 |
OPT_STORAGE_ENGINE, |
1110 |
OPT_INIT_FILE, |
|
1
by brian
clean slate |
1111 |
OPT_WANT_CORE, |
867
by Brian Aker
Remove dead options. |
1112 |
OPT_MEMLOCK, |
614
by Brian Aker
Remove filtering (wrong layer, belongs in plugin). |
1113 |
OPT_SERVER_ID, |
867
by Brian Aker
Remove dead options. |
1114 |
OPT_TC_HEURISTIC_RECOVER, |
1
by brian
clean slate |
1115 |
OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_COMPLETION_TYPE, |
1116 |
OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS, |
|
867
by Brian Aker
Remove dead options. |
1117 |
OPT_DO_PSTACK, |
1118 |
OPT_LOCAL_INFILE, |
|
798.2.18
by Brian Aker
Remove dead COM for BINLOG/REGISTER. |
1119 |
OPT_BACK_LOG, |
956
by Brian Aker
Remove dead options. |
1120 |
OPT_JOIN_BUFF_SIZE, |
1
by brian
clean slate |
1121 |
OPT_KEY_BUFFER_SIZE, OPT_KEY_CACHE_BLOCK_SIZE, |
1122 |
OPT_KEY_CACHE_DIVISION_LIMIT, OPT_KEY_CACHE_AGE_THRESHOLD, |
|
956
by Brian Aker
Remove dead options. |
1123 |
OPT_MAX_ALLOWED_PACKET, |
832.2.8
by Mark Atwood
remove sysvar max_connections |
1124 |
OPT_MAX_CONNECT_ERRORS, |
1
by brian
clean slate |
1125 |
OPT_MAX_HEP_TABLE_SIZE, |
245
by Brian Aker
Removed dead variables. |
1126 |
OPT_MAX_JOIN_SIZE, |
956
by Brian Aker
Remove dead options. |
1127 |
OPT_MAX_SORT_LENGTH, |
1
by brian
clean slate |
1128 |
OPT_MAX_SEEKS_FOR_KEY, OPT_MAX_TMP_TABLES, OPT_MAX_USER_CONNECTIONS, |
1129 |
OPT_MAX_LENGTH_FOR_SORT_DATA, |
|
1130 |
OPT_MAX_WRITE_LOCK_COUNT, OPT_BULK_INSERT_BUFFER_SIZE, |
|
1131 |
OPT_MAX_ERROR_COUNT, OPT_MULTI_RANGE_COUNT, OPT_MYISAM_DATA_POINTER_SIZE, |
|
1132 |
OPT_MYISAM_BLOCK_SIZE, OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE, |
|
1133 |
OPT_MYISAM_MAX_SORT_FILE_SIZE, OPT_MYISAM_SORT_BUFFER_SIZE, |
|
1134 |
OPT_MYISAM_USE_MMAP, OPT_MYISAM_REPAIR_THREADS, |
|
971.3.60
by Eric Day
Moved connect_timeout, net_*_timeout, and retry_count to plugin. |
1135 |
OPT_NET_BUFFER_LENGTH, |
1
by brian
clean slate |
1136 |
OPT_PRELOAD_BUFFER_SIZE, |
245
by Brian Aker
Removed dead variables. |
1137 |
OPT_RECORD_BUFFER, |
867
by Brian Aker
Remove dead options. |
1138 |
OPT_RECORD_RND_BUFFER, OPT_DIV_PRECINCREMENT, |
1139 |
OPT_DEBUGGING, |
|
1
by brian
clean slate |
1140 |
OPT_SORT_BUFFER, OPT_TABLE_OPEN_CACHE, OPT_TABLE_DEF_CACHE, |
1141 |
OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK, |
|
1142 |
OPT_WAIT_TIMEOUT, |
|
80.2.1
by mark
remove handling of suspicious UDFs |
1143 |
OPT_RANGE_ALLOC_BLOCK_SIZE, |
1
by brian
clean slate |
1144 |
OPT_QUERY_ALLOC_BLOCK_SIZE, OPT_QUERY_PREALLOC_SIZE, |
1145 |
OPT_TRANS_ALLOC_BLOCK_SIZE, OPT_TRANS_PREALLOC_SIZE, |
|
1146 |
OPT_OLD_ALTER_TABLE, |
|
1147 |
OPT_GROUP_CONCAT_MAX_LEN, |
|
1148 |
OPT_DEFAULT_COLLATION, |
|
1149 |
OPT_CHARACTER_SET_FILESYSTEM, |
|
1150 |
OPT_LC_TIME_NAMES, |
|
1151 |
OPT_INIT_CONNECT, |
|
1152 |
OPT_DEFAULT_TIME_ZONE, |
|
1153 |
OPT_OPTIMIZER_SEARCH_DEPTH, |
|
868
by Brian Aker
Adding Multi-threaded Scheduler into the system. |
1154 |
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. |
1155 |
OPT_PROTOCOL, |
1
by brian
clean slate |
1156 |
OPT_OPTIMIZER_PRUNE_LEVEL, |
1157 |
OPT_AUTO_INCREMENT, OPT_AUTO_INCREMENT_OFFSET, |
|
1158 |
OPT_ENABLE_LARGE_PAGES, |
|
1159 |
OPT_TIMED_MUTEXES, |
|
1160 |
OPT_TABLE_LOCK_WAIT_TIMEOUT, |
|
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
1161 |
OPT_PLUGIN_ADD, |
1283.1.5
by Monty Taylor
Added --plugin-remove option, which prunes plugins from the list of plugins |
1162 |
OPT_PLUGIN_REMOVE, |
1
by brian
clean slate |
1163 |
OPT_PLUGIN_LOAD, |
1164 |
OPT_PLUGIN_DIR, |
|
1165 |
OPT_PORT_OPEN_TIMEOUT, |
|
1166 |
OPT_SECURE_FILE_PRIV, |
|
1100.1.5
by Brian Aker
Remove mrr flag from options. |
1167 |
OPT_MIN_EXAMINED_ROW_LIMIT
|
1
by brian
clean slate |
1168 |
};
|
1169 |
||
1170 |
||
1410.3.4
by Djellel E. Difallah
update references to old my_'s |
1171 |
struct option my_long_options[] = |
1
by brian
clean slate |
1172 |
{
|
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1173 |
{"help", '?', N_("Display this help and exit."), |
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1174 |
(char**) &opt_help, (char**) &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, |
1
by brian
clean slate |
1175 |
0, 0}, |
1119.1.1
by Monty Taylor
--help doesn't need --datadir to work. |
1176 |
{"help-extended", '?', |
1177 |
N_("Display this help and exit after initializing plugins."), |
|
1178 |
(char**) &opt_help_extended, (char**) &opt_help_extended, |
|
1179 |
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, |
|
1
by brian
clean slate |
1180 |
{"auto-increment-increment", OPT_AUTO_INCREMENT, |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1181 |
N_("Auto-increment columns are incremented by this"), |
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1182 |
(char**) &global_system_variables.auto_increment_increment, |
819.1.1
by Toru Maesaka
Removed the 16bit limitation of auto_increment_(increment|offset) system variables |
1183 |
(char**) &max_system_variables.auto_increment_increment, 0, GET_ULL, |
1184 |
OPT_ARG, 1, 1, UINT64_MAX, 0, 1, 0 }, |
|
1
by brian
clean slate |
1185 |
{"auto-increment-offset", OPT_AUTO_INCREMENT_OFFSET, |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1186 |
N_("Offset added to Auto-increment columns. Used when " |
1187 |
"auto-increment-increment != 1"), |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1188 |
(char**) &global_system_variables.auto_increment_offset, |
819.1.1
by Toru Maesaka
Removed the 16bit limitation of auto_increment_(increment|offset) system variables |
1189 |
(char**) &max_system_variables.auto_increment_offset, 0, GET_ULL, OPT_ARG, |
1190 |
1, 1, UINT64_MAX, 0, 1, 0 }, |
|
1
by brian
clean slate |
1191 |
{"basedir", 'b', |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1192 |
N_("Path to installation directory. All paths are usually resolved " |
1193 |
"relative to this."), |
|
574.2.1
by ysano
Rename mysql to drizzle. |
1194 |
(char**) &drizzle_home_ptr, (char**) &drizzle_home_ptr, 0, GET_STR, REQUIRED_ARG, |
1
by brian
clean slate |
1195 |
0, 0, 0, 0, 0, 0}, |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1196 |
{"chroot", 'r', |
575.4.4
by Yoshinori Sano
Rename mysql to drizzle. |
1197 |
N_("Chroot drizzled daemon during startup."), |
574.2.1
by ysano
Rename mysql to drizzle. |
1198 |
(char**) &drizzled_chroot, (char**) &drizzled_chroot, 0, GET_STR, REQUIRED_ARG, |
1
by brian
clean slate |
1199 |
0, 0, 0, 0, 0, 0}, |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1200 |
{"collation-server", OPT_DEFAULT_COLLATION, |
1201 |
N_("Set the default collation."), |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1202 |
(char**) &default_collation_name, (char**) &default_collation_name, |
1
by brian
clean slate |
1203 |
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1204 |
{"completion-type", OPT_COMPLETION_TYPE, |
1205 |
N_("Default completion type."), |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1206 |
(char**) &global_system_variables.completion_type, |
619
by Brian Aker
Removed ulong methods from vars. |
1207 |
(char**) &max_system_variables.completion_type, 0, GET_UINT, |
1
by brian
clean slate |
1208 |
REQUIRED_ARG, 0, 0, 2, 0, 1, 0}, |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1209 |
{"core-file", OPT_WANT_CORE, |
1210 |
N_("Write core on errors."), |
|
1211 |
0, 0, 0, GET_NO_ARG, |
|
1
by brian
clean slate |
1212 |
NO_ARG, 0, 0, 0, 0, 0, 0}, |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1213 |
{"datadir", 'h', |
1214 |
N_("Path to the database root."), |
|
1300.5.3
by Monty Taylor
Removed drizzle_ prefix from some things that don't need it since they're |
1215 |
(char**) &data_home, |
1216 |
(char**) &data_home, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
|
1
by brian
clean slate |
1217 |
{"default-storage-engine", OPT_STORAGE_ENGINE, |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1218 |
N_("Set the default storage engine (table type) for tables."), |
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1219 |
(char**)&default_storage_engine_str, (char**)&default_storage_engine_str, |
1
by brian
clean slate |
1220 |
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1221 |
{"default-time-zone", OPT_DEFAULT_TIME_ZONE, |
1222 |
N_("Set the default time zone."), |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1223 |
(char**) &default_tz_name, (char**) &default_tz_name, |
1
by brian
clean slate |
1224 |
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, |
1225 |
/* See how it's handled in get_one_option() */
|
|
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1226 |
{"exit-info", 'T', |
1227 |
N_("Used for debugging; Use at your own risk!"), |
|
1228 |
0, 0, 0, GET_LONG, OPT_ARG, 0, 0, 0, 0, 0, 0}, |
|
1
by brian
clean slate |
1229 |
/* We must always support the next option to make scripts like mysqltest
|
1230 |
easier to do */
|
|
1231 |
{"gdb", OPT_DEBUGGING, |
|
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1232 |
N_("Set up signals usable for debugging"), |
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1233 |
(char**) &opt_debugging, (char**) &opt_debugging, |
1
by brian
clean slate |
1234 |
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, |
1235 |
{"language", 'L', |
|
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1236 |
N_("(IGNORED)"), |
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1237 |
(char**) &language_ptr, (char**) &language_ptr, 0, GET_STR, REQUIRED_ARG, |
1
by brian
clean slate |
1238 |
0, 0, 0, 0, 0, 0}, |
1239 |
{"lc-time-names", OPT_LC_TIME_NAMES, |
|
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1240 |
N_("Set the language used for the month names and the days of the week."), |
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1241 |
(char**) &lc_time_names_name, |
1242 |
(char**) &lc_time_names_name, |
|
1
by brian
clean slate |
1243 |
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1244 |
{"log-warnings", 'W', |
1245 |
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) |
1246 |
(char**) &global_system_variables.log_warnings, |
896.4.16
by Stewart Smith
for getopt, replace GET_ULONG with GET_UINT32. |
1247 |
(char**) &max_system_variables.log_warnings, 0, GET_BOOL, OPT_ARG, 1, 0, 0, |
1
by brian
clean slate |
1248 |
0, 0, 0}, |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1249 |
{"pid-file", OPT_PID_FILE, |
1250 |
N_("Pid file used by safe_mysqld."), |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1251 |
(char**) &pidfile_name_ptr, (char**) &pidfile_name_ptr, 0, GET_STR, |
1
by brian
clean slate |
1252 |
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
1253 |
{"port-open-timeout", OPT_PORT_OPEN_TIMEOUT, |
|
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1254 |
N_("Maximum time in seconds to wait for the port to become free. " |
1255 |
"(Default: no wait)"), |
|
971.6.7
by Eric Day
Reworked listen interface to not require binding of TCP ports. |
1256 |
(char**) &drizzled_bind_timeout, |
1257 |
(char**) &drizzled_bind_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
|
1
by brian
clean slate |
1258 |
{"secure-file-priv", OPT_SECURE_FILE_PRIV, |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1259 |
N_("Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files " |
1260 |
"within specified directory"), |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1261 |
(char**) &opt_secure_file_priv, (char**) &opt_secure_file_priv, 0, |
1
by brian
clean slate |
1262 |
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
1263 |
{"server-id", OPT_SERVER_ID, |
|
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1264 |
N_("Uniquely identifies the server instance in the community of " |
1265 |
"replication partners."), |
|
896.4.16
by Stewart Smith
for getopt, replace GET_ULONG with GET_UINT32. |
1266 |
(char**) &server_id, (char**) &server_id, 0, GET_UINT32, REQUIRED_ARG, 0, 0, 0, |
1
by brian
clean slate |
1267 |
0, 0, 0}, |
1268 |
{"skip-stack-trace", OPT_SKIP_STACK_TRACE, |
|
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1269 |
N_("Don't print a stack trace on failure."), |
1270 |
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, |
|
1
by brian
clean slate |
1271 |
0, 0, 0, 0}, |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1272 |
{"symbolic-links", 's', |
1273 |
N_("Enable symbolic link support."), |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1274 |
(char**) &internal::my_use_symdir, (char**) &internal::my_use_symdir, 0, GET_BOOL, NO_ARG, |
1
by brian
clean slate |
1275 |
/*
|
1276 |
The system call realpath() produces warnings under valgrind and
|
|
1277 |
purify. These are not suppressed: instead we disable symlinks
|
|
1278 |
option if compiled with valgrind support.
|
|
1279 |
*/
|
|
1280 |
IF_PURIFY(0,1), 0, 0, 0, 0, 0}, |
|
1281 |
{"timed_mutexes", OPT_TIMED_MUTEXES, |
|
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1282 |
N_("Specify whether to time mutexes (only InnoDB mutexes are currently " |
1283 |
"supported)"), |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1284 |
(char**) &internal::timed_mutexes, (char**) &internal::timed_mutexes, 0, GET_BOOL, NO_ARG, 0, |
1
by brian
clean slate |
1285 |
0, 0, 0, 0, 0}, |
1286 |
{"tmpdir", 't', |
|
680
by Brian Aker
Remove locks around temp tables for searching tmp directory path. |
1287 |
N_("Path for temporary files."), |
575.4.3
by ysano
Rename mysql to drizzle. |
1288 |
(char**) &opt_drizzle_tmpdir, |
1289 |
(char**) &opt_drizzle_tmpdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
|
1
by brian
clean slate |
1290 |
{"transaction-isolation", OPT_TX_ISOLATION, |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1291 |
N_("Default transaction isolation level."), |
1292 |
0, 0, 0, GET_STR, REQUIRED_ARG, 0, |
|
1
by brian
clean slate |
1293 |
0, 0, 0, 0, 0}, |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1294 |
{"user", 'u', |
574.2.1
by ysano
Rename mysql to drizzle. |
1295 |
N_("Run drizzled daemon as user."), |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1296 |
0, 0, 0, GET_STR, REQUIRED_ARG, |
1
by brian
clean slate |
1297 |
0, 0, 0, 0, 0, 0}, |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1298 |
{"version", 'V', |
1299 |
N_("Output version information and exit."), |
|
1300 |
0, 0, 0, GET_NO_ARG, |
|
1
by brian
clean slate |
1301 |
NO_ARG, 0, 0, 0, 0, 0, 0}, |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1302 |
{"back_log", OPT_BACK_LOG, |
575.4.4
by Yoshinori Sano
Rename mysql to drizzle. |
1303 |
N_("The number of outstanding connection requests Drizzle can have. This " |
1304 |
"comes into play when the main Drizzle thread gets very many connection "
|
|
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1305 |
"requests in a very short time."), |
626
by Brian Aker
More of the same (ulong/64) |
1306 |
(char**) &back_log, (char**) &back_log, 0, GET_UINT, |
1
by brian
clean slate |
1307 |
REQUIRED_ARG, 50, 1, 65535, 0, 1, 0 }, |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1308 |
{ "bulk_insert_buffer_size", OPT_BULK_INSERT_BUFFER_SIZE, |
672.1.3
by Andrew Hutchings
Minor string fixes (mainly US English spelling and typos) |
1309 |
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. |
1310 |
"a limit per thread!"), |
1311 |
(char**) &global_system_variables.bulk_insert_buff_size, |
|
1312 |
(char**) &max_system_variables.bulk_insert_buff_size, |
|
619
by Brian Aker
Removed ulong methods from vars. |
1313 |
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. |
1314 |
{ "div_precision_increment", OPT_DIV_PRECINCREMENT, |
1315 |
N_("Precision of the result of '/' operator will be increased on that " |
|
1316 |
"value."), |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1317 |
(char**) &global_system_variables.div_precincrement, |
619
by Brian Aker
Removed ulong methods from vars. |
1318 |
(char**) &max_system_variables.div_precincrement, 0, GET_UINT, |
1
by brian
clean slate |
1319 |
REQUIRED_ARG, 4, 0, DECIMAL_MAX_SCALE, 0, 0, 0}, |
1320 |
{ "group_concat_max_len", OPT_GROUP_CONCAT_MAX_LEN, |
|
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1321 |
N_("The maximum length of the result of function group_concat."), |
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1322 |
(char**) &global_system_variables.group_concat_max_len, |
896.4.16
by Stewart Smith
for getopt, replace GET_ULONG with GET_UINT32. |
1323 |
(char**) &max_system_variables.group_concat_max_len, 0, GET_UINT64, |
1
by brian
clean slate |
1324 |
REQUIRED_ARG, 1024, 4, ULONG_MAX, 0, 1, 0}, |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1325 |
{ "join_buffer_size", OPT_JOIN_BUFF_SIZE, |
1326 |
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) |
1327 |
(char**) &global_system_variables.join_buff_size, |
896.4.16
by Stewart Smith
for getopt, replace GET_ULONG with GET_UINT32. |
1328 |
(char**) &max_system_variables.join_buff_size, 0, GET_UINT64, |
1
by brian
clean slate |
1329 |
REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ULONG_MAX, |
1330 |
MALLOC_OVERHEAD, IO_SIZE, 0}, |
|
1331 |
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, |
|
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1332 |
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) |
1333 |
(char**) &global_system_variables.max_allowed_packet, |
896.4.16
by Stewart Smith
for getopt, replace GET_ULONG with GET_UINT32. |
1334 |
(char**) &max_system_variables.max_allowed_packet, 0, GET_UINT32, |
1
by brian
clean slate |
1335 |
REQUIRED_ARG, 1024*1024L, 1024, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0}, |
1336 |
{"max_connect_errors", OPT_MAX_CONNECT_ERRORS, |
|
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1337 |
N_("If there is more than this number of interrupted connections from a " |
1338 |
"host this host will be blocked from further connections."), |
|
896.4.16
by Stewart Smith
for getopt, replace GET_ULONG with GET_UINT32. |
1339 |
(char**) &max_connect_errors, (char**) &max_connect_errors, 0, GET_UINT64, |
312.1.12
by Monty Taylor
Fixed a syntax oops. |
1340 |
REQUIRED_ARG, MAX_CONNECT_ERRORS, 1, ULONG_MAX, 0, 1, 0}, |
1
by brian
clean slate |
1341 |
{"max_error_count", OPT_MAX_ERROR_COUNT, |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1342 |
N_("Max number of errors/warnings to store for a statement."), |
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1343 |
(char**) &global_system_variables.max_error_count, |
1344 |
(char**) &max_system_variables.max_error_count, |
|
896.4.16
by Stewart Smith
for getopt, replace GET_ULONG with GET_UINT32. |
1345 |
0, GET_UINT64, REQUIRED_ARG, DEFAULT_ERROR_COUNT, 0, 65535, 0, 1, 0}, |
1
by brian
clean slate |
1346 |
{"max_heap_table_size", OPT_MAX_HEP_TABLE_SIZE, |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1347 |
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) |
1348 |
(char**) &global_system_variables.max_heap_table_size, |
1349 |
(char**) &max_system_variables.max_heap_table_size, 0, GET_ULL, |
|
1
by brian
clean slate |
1350 |
REQUIRED_ARG, 16*1024*1024L, 16384, MAX_MEM_TABLE_SIZE, |
1351 |
MALLOC_OVERHEAD, 1024, 0}, |
|
1352 |
{"max_join_size", OPT_MAX_JOIN_SIZE, |
|
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1353 |
N_("Joins that are probably going to read more than max_join_size records " |
1354 |
"return an error."), |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1355 |
(char**) &global_system_variables.max_join_size, |
1356 |
(char**) &max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG, |
|
365.2.8
by Monty Taylor
More MAX macros. |
1357 |
INT32_MAX, 1, INT32_MAX, 0, 1, 0}, |
312.1.12
by Monty Taylor
Fixed a syntax oops. |
1358 |
{"max_length_for_sort_data", OPT_MAX_LENGTH_FOR_SORT_DATA, |
1359 |
N_("Max number of bytes in sorted records."), |
|
1360 |
(char**) &global_system_variables.max_length_for_sort_data, |
|
615
by Brian Aker
Added 32bit system variable support |
1361 |
(char**) &max_system_variables.max_length_for_sort_data, 0, GET_ULL, |
312.1.12
by Monty Taylor
Fixed a syntax oops. |
1362 |
REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0}, |
1
by brian
clean slate |
1363 |
{ "max_seeks_for_key", OPT_MAX_SEEKS_FOR_KEY, |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1364 |
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) |
1365 |
(char**) &global_system_variables.max_seeks_for_key, |
896.4.16
by Stewart Smith
for getopt, replace GET_ULONG with GET_UINT32. |
1366 |
(char**) &max_system_variables.max_seeks_for_key, 0, GET_UINT64, |
1
by brian
clean slate |
1367 |
REQUIRED_ARG, ULONG_MAX, 1, ULONG_MAX, 0, 1, 0 }, |
1368 |
{"max_sort_length", OPT_MAX_SORT_LENGTH, |
|
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1369 |
N_("The number of bytes to use when sorting BLOB or TEXT values " |
1370 |
"(only the first max_sort_length bytes of each value are used; the "
|
|
1371 |
"rest are ignored)."), |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1372 |
(char**) &global_system_variables.max_sort_length, |
937.2.9
by Stewart Smith
max_sort_length is GET_SIZE not GET_UINT. as sizeof(uint32_t)!=sizeof(size_t) on solaris sparc 64bit. |
1373 |
(char**) &max_system_variables.max_sort_length, 0, GET_SIZE, |
1
by brian
clean slate |
1374 |
REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0}, |
1375 |
{"max_write_lock_count", OPT_MAX_WRITE_LOCK_COUNT, |
|
312.1.15
by Monty Taylor
Finished marking strings in drizzled.cc. |
1376 |
N_("After this many write locks, allow some read locks to run in between."), |
622.1.1
by Brian Aker
32bit fixes around vars |
1377 |
(char**) &max_write_lock_count, (char**) &max_write_lock_count, 0, GET_ULL, |
1
by brian
clean slate |
1378 |
REQUIRED_ARG, ULONG_MAX, 1, ULONG_MAX, 0, 1, 0}, |
1379 |
{"min_examined_row_limit", OPT_MIN_EXAMINED_ROW_LIMIT, |
|
312.1.15
by Monty Taylor
Finished marking strings in drizzled.cc. |
1380 |
N_("Don't log queries which examine less than min_examined_row_limit " |
1381 |
"rows to file."), |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1382 |
(char**) &global_system_variables.min_examined_row_limit, |
619
by Brian Aker
Removed ulong methods from vars. |
1383 |
(char**) &max_system_variables.min_examined_row_limit, 0, GET_ULL, |
312.1.12
by Monty Taylor
Fixed a syntax oops. |
1384 |
REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1L, 0}, |
1
by brian
clean slate |
1385 |
{"optimizer_prune_level", OPT_OPTIMIZER_PRUNE_LEVEL, |
619
by Brian Aker
Removed ulong methods from vars. |
1386 |
N_("Controls the heuristic(s) applied during query optimization to prune " |
1387 |
"less-promising partial plans from the optimizer search space. Meaning: "
|
|
1388 |
"false - do not apply any heuristic, thus perform exhaustive search; "
|
|
1389 |
"true - prune plans based on number of retrieved rows."), |
|
1390 |
(char**) &global_system_variables.optimizer_prune_level, |
|
1391 |
(char**) &max_system_variables.optimizer_prune_level, |
|
1392 |
0, GET_BOOL, OPT_ARG, 1, 0, 1, 0, 1, 0}, |
|
1
by brian
clean slate |
1393 |
{"optimizer_search_depth", OPT_OPTIMIZER_SEARCH_DEPTH, |
312.1.15
by Monty Taylor
Finished marking strings in drizzled.cc. |
1394 |
N_("Maximum depth of search performed by the query optimizer. Values " |
1395 |
"larger than the number of relations in a query result in better query "
|
|
1396 |
"plans, but take longer to compile a query. Smaller values than the "
|
|
1397 |
"number of tables in a relation result in faster optimization, but may "
|
|
1398 |
"produce very bad query plans. If set to 0, the system will "
|
|
1399 |
"automatically pick a reasonable value; if set to MAX_TABLES+2, the "
|
|
1400 |
"optimizer will switch to the original find_best (used for "
|
|
1401 |
"testing/comparison)."), |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1402 |
(char**) &global_system_variables.optimizer_search_depth, |
1403 |
(char**) &max_system_variables.optimizer_search_depth, |
|
1108.6.44
by Padraig O'Sullivan
Set the default value for optimizer_search_depth to 0. |
1404 |
0, GET_UINT, OPT_ARG, 0, 0, MAX_TABLES+2, 0, 1, 0}, |
1
by brian
clean slate |
1405 |
{"plugin_dir", OPT_PLUGIN_DIR, |
312.1.15
by Monty Taylor
Finished marking strings in drizzled.cc. |
1406 |
N_("Directory for plugins."), |
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1407 |
(char**) &opt_plugin_dir_ptr, (char**) &opt_plugin_dir_ptr, 0, |
1
by brian
clean slate |
1408 |
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
1409 |
{"plugin_add", OPT_PLUGIN_ADD, |
1410 |
N_("Optional comma separated list of plugins to load at startup in addition " |
|
1411 |
"to the default list of plugins. "
|
|
1412 |
"[for example: --plugin_add=crc32,logger_gearman]"), |
|
1413 |
(char**) &opt_plugin_add, (char**) &opt_plugin_add, 0, |
|
1414 |
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 |
1415 |
{"plugin_remove", OPT_PLUGIN_ADD, |
1416 |
N_("Optional comma separated list of plugins to not load at startup. Effectively " |
|
1417 |
"removes a plugin from the list of plugins to be loaded. "
|
|
1418 |
"[for example: --plugin_remove=crc32,logger_gearman]"), |
|
1419 |
(char**) &opt_plugin_remove, (char**) &opt_plugin_remove, 0, |
|
1420 |
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
|
1
by brian
clean slate |
1421 |
{"plugin_load", OPT_PLUGIN_LOAD, |
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
1422 |
N_("Optional comma separated list of plugins to load at starup instead of " |
1423 |
"the default plugin load list. "
|
|
992.1.21
by Monty Taylor
First pass at replacing plugin.m4. |
1424 |
"[for example: --plugin_load=crc32,logger_gearman]"), |
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1425 |
(char**) &opt_plugin_load, (char**) &opt_plugin_load, 0, |
1
by brian
clean slate |
1426 |
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
1427 |
{"preload_buffer_size", OPT_PRELOAD_BUFFER_SIZE, |
|
312.1.15
by Monty Taylor
Finished marking strings in drizzled.cc. |
1428 |
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) |
1429 |
(char**) &global_system_variables.preload_buff_size, |
619
by Brian Aker
Removed ulong methods from vars. |
1430 |
(char**) &max_system_variables.preload_buff_size, 0, GET_ULL, |
1
by brian
clean slate |
1431 |
REQUIRED_ARG, 32*1024L, 1024, 1024*1024*1024L, 0, 1, 0}, |
1432 |
{"query_alloc_block_size", OPT_QUERY_ALLOC_BLOCK_SIZE, |
|
312.1.15
by Monty Taylor
Finished marking strings in drizzled.cc. |
1433 |
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) |
1434 |
(char**) &global_system_variables.query_alloc_block_size, |
617
by Brian Aker
ulong fixes |
1435 |
(char**) &max_system_variables.query_alloc_block_size, 0, GET_UINT, |
1
by brian
clean slate |
1436 |
REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ULONG_MAX, 0, 1024, 0}, |
1437 |
{"query_prealloc_size", OPT_QUERY_PREALLOC_SIZE, |
|
312.1.15
by Monty Taylor
Finished marking strings in drizzled.cc. |
1438 |
N_("Persistent buffer for query parsing and execution"), |
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1439 |
(char**) &global_system_variables.query_prealloc_size, |
617
by Brian Aker
ulong fixes |
1440 |
(char**) &max_system_variables.query_prealloc_size, 0, GET_UINT, |
1
by brian
clean slate |
1441 |
REQUIRED_ARG, QUERY_ALLOC_PREALLOC_SIZE, QUERY_ALLOC_PREALLOC_SIZE, |
1442 |
ULONG_MAX, 0, 1024, 0}, |
|
1443 |
{"range_alloc_block_size", OPT_RANGE_ALLOC_BLOCK_SIZE, |
|
312.1.15
by Monty Taylor
Finished marking strings in drizzled.cc. |
1444 |
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) |
1445 |
(char**) &global_system_variables.range_alloc_block_size, |
896.4.16
by Stewart Smith
for getopt, replace GET_ULONG with GET_UINT32. |
1446 |
(char**) &max_system_variables.range_alloc_block_size, 0, GET_SIZE, |
629.4.1
by Monty Taylor
First step in support size_t sys_var stuff. |
1447 |
REQUIRED_ARG, RANGE_ALLOC_BLOCK_SIZE, RANGE_ALLOC_BLOCK_SIZE, SIZE_MAX, |
1
by brian
clean slate |
1448 |
0, 1024, 0}, |
1449 |
{"read_buffer_size", OPT_RECORD_BUFFER, |
|
619
by Brian Aker
Removed ulong methods from vars. |
1450 |
N_("Each thread that does a sequential scan allocates a buffer of this " |
1451 |
"size for each table it scans. If you do many sequential scans, you may "
|
|
1452 |
"want to increase this value."), |
|
1453 |
(char**) &global_system_variables.read_buff_size, |
|
1454 |
(char**) &max_system_variables.read_buff_size,0, GET_UINT, REQUIRED_ARG, |
|
1455 |
128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, INT32_MAX, MALLOC_OVERHEAD, IO_SIZE, |
|
1456 |
0}, |
|
1
by brian
clean slate |
1457 |
{"read_rnd_buffer_size", OPT_RECORD_RND_BUFFER, |
312.1.15
by Monty Taylor
Finished marking strings in drizzled.cc. |
1458 |
N_("When reading rows in sorted order after a sort, the rows are read " |
1459 |
"through this buffer to avoid a disk seeks. If not set, then it's set "
|
|
1460 |
"to the value of record_buffer."), |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1461 |
(char**) &global_system_variables.read_rnd_buff_size, |
1462 |
(char**) &max_system_variables.read_rnd_buff_size, 0, |
|
619
by Brian Aker
Removed ulong methods from vars. |
1463 |
GET_UINT, REQUIRED_ARG, 256*1024L, 64 /*IO_SIZE*2+MALLOC_OVERHEAD*/ , |
1464 |
UINT32_MAX, MALLOC_OVERHEAD, 1 /* Small lower limit to be able to test MRR */, 0}, |
|
868
by Brian Aker
Adding Multi-threaded Scheduler into the system. |
1465 |
{"scheduler", 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. |
1466 |
N_("Select scheduler to be used (by default multi-thread)."), |
1467 |
(char**)&opt_scheduler, (char**)&opt_scheduler, |
|
1468 |
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
|
1034.1.6
by Brian Aker
Increase the default sort buffer size. |
1469 |
/* x8 compared to MySQL's x2. We have UTF8 to consider. */
|
1
by brian
clean slate |
1470 |
{"sort_buffer_size", OPT_SORT_BUFFER, |
312.1.15
by Monty Taylor
Finished marking strings in drizzled.cc. |
1471 |
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) |
1472 |
(char**) &global_system_variables.sortbuff_size, |
896.4.16
by Stewart Smith
for getopt, replace GET_ULONG with GET_UINT32. |
1473 |
(char**) &max_system_variables.sortbuff_size, 0, GET_SIZE, REQUIRED_ARG, |
1034.1.6
by Brian Aker
Increase the default sort buffer size. |
1474 |
MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*8, SIZE_MAX, |
1
by brian
clean slate |
1475 |
MALLOC_OVERHEAD, 1, 0}, |
1476 |
{"table_definition_cache", OPT_TABLE_DEF_CACHE, |
|
312.1.15
by Monty Taylor
Finished marking strings in drizzled.cc. |
1477 |
N_("The number of cached table definitions."), |
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1478 |
(char**) &table_def_size, (char**) &table_def_size, |
1226.1.3
by Brian Aker
Possible solution for hash/rehash. |
1479 |
0, GET_SIZE, REQUIRED_ARG, 128, 1, 512*1024L, 0, 1, 0}, |
1
by brian
clean slate |
1480 |
{"table_open_cache", OPT_TABLE_OPEN_CACHE, |
312.1.15
by Monty Taylor
Finished marking strings in drizzled.cc. |
1481 |
N_("The number of cached open tables."), |
896.4.16
by Stewart Smith
for getopt, replace GET_ULONG with GET_UINT32. |
1482 |
(char**) &table_cache_size, (char**) &table_cache_size, 0, GET_UINT64, |
1313.1.19
by Stewart Smith
TABLE_OPEN_CACHE_MIN should be used instead of unused. |
1483 |
REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, TABLE_OPEN_CACHE_MIN, 512*1024L, 0, 1, 0}, |
1
by brian
clean slate |
1484 |
{"table_lock_wait_timeout", OPT_TABLE_LOCK_WAIT_TIMEOUT, |
312.1.15
by Monty Taylor
Finished marking strings in drizzled.cc. |
1485 |
N_("Timeout in seconds to wait for a table level lock before returning an " |
1486 |
"error. Used only if the connection has active cursors."), |
|
77.1.77
by Monty Taylor
A crapton more warning cleanups (I turned on more warnings) |
1487 |
(char**) &table_lock_wait_timeout, (char**) &table_lock_wait_timeout, |
622.1.1
by Brian Aker
32bit fixes around vars |
1488 |
0, GET_ULL, REQUIRED_ARG, 50, 1, 1024 * 1024 * 1024, 0, 1, 0}, |
1
by brian
clean slate |
1489 |
{"thread_stack", OPT_THREAD_STACK, |
312.1.15
by Monty Taylor
Finished marking strings in drizzled.cc. |
1490 |
N_("The stack size for each thread."), |
1491 |
(char**) &my_thread_stack_size, |
|
896.4.16
by Stewart Smith
for getopt, replace GET_ULONG with GET_UINT32. |
1492 |
(char**) &my_thread_stack_size, 0, GET_SIZE, |
312.1.15
by Monty Taylor
Finished marking strings in drizzled.cc. |
1493 |
REQUIRED_ARG,DEFAULT_THREAD_STACK, |
1128.2.2
by Brian Aker
Refactor to remove Proto from global. |
1494 |
UINT32_C(1024*512), SIZE_MAX, 0, 1024, 0}, |
1
by brian
clean slate |
1495 |
{"tmp_table_size", OPT_TMP_TABLE_SIZE, |
672.1.3
by Andrew Hutchings
Minor string fixes (mainly US English spelling and typos) |
1496 |
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. |
1497 |
" 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) |
1498 |
(char**) &global_system_variables.tmp_table_size, |
1499 |
(char**) &max_system_variables.tmp_table_size, 0, GET_ULL, |
|
1
by brian
clean slate |
1500 |
REQUIRED_ARG, 16*1024*1024L, 1024, MAX_MEM_TABLE_SIZE, 0, 1, 0}, |
1501 |
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} |
|
1502 |
};
|
|
1503 |
||
1504 |
static void print_version(void) |
|
1505 |
{
|
|
1506 |
/*
|
|
1507 |
Note: the instance manager keys off the string 'Ver' so it can find the
|
|
575.4.4
by Yoshinori Sano
Rename mysql to drizzle. |
1508 |
version from the output of 'drizzled --version', so don't change it!
|
1
by brian
clean slate |
1509 |
*/
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1510 |
printf("%s Ver %s for %s-%s on %s (%s)\n",internal::my_progname, |
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
1511 |
PANDORA_RELEASE_VERSION, HOST_VENDOR, HOST_OS, HOST_CPU, |
1512 |
COMPILATION_COMMENT); |
|
1
by brian
clean slate |
1513 |
}
|
1514 |
||
1515 |
static void usage(void) |
|
1516 |
{
|
|
862
by Brian Aker
Remove charset directory code. |
1517 |
if (!(default_charset_info= get_charset_by_csname(default_character_set_name, MY_CS_PRIMARY))) |
1
by brian
clean slate |
1518 |
exit(1); |
1519 |
if (!default_collation_name) |
|
1520 |
default_collation_name= (char*) default_charset_info->name; |
|
1521 |
print_version(); |
|
656.1.27
by Monty Taylor
Fixed the mysqld in the drizzle.cnf thing. |
1522 |
puts(_("Copyright (C) 2008 Sun Microsystems\n" |
312.1.11
by Monty Taylor
Added some strings from drizzled.cc. |
1523 |
"This software comes with ABSOLUTELY NO WARRANTY. "
|
1524 |
"This is free software,\n" |
|
1525 |
"and you are welcome to modify and redistribute it under the GPL "
|
|
1526 |
"license\n\n" |
|
1527 |
"Starts the Drizzle database server\n")); |
|
1
by brian
clean slate |
1528 |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1529 |
printf(_("Usage: %s [OPTIONS]\n"), internal::my_progname); |
1
by brian
clean slate |
1530 |
{
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1531 |
internal::print_defaults(DRIZZLE_CONFIG_NAME,load_default_groups); |
1119.1.1
by Monty Taylor
--help doesn't need --datadir to work. |
1532 |
puts(""); |
1533 |
||
1534 |
/* Print out all the options including plugin supplied options */
|
|
1535 |
my_print_help_inc_plugins(my_long_options); |
|
1
by brian
clean slate |
1536 |
}
|
1537 |
}
|
|
1538 |
||
1539 |
||
1540 |
/**
|
|
575.4.4
by Yoshinori Sano
Rename mysql to drizzle. |
1541 |
Initialize all Drizzle global variables to default values.
|
1
by brian
clean slate |
1542 |
|
1543 |
We don't need to set numeric variables refered to in my_long_options
|
|
1544 |
as these are initialized by my_getopt.
|
|
1545 |
||
1546 |
@note
|
|
1547 |
The reason to set a lot of global variables to zero is to allow one to
|
|
1548 |
restart the embedded server with a clean environment
|
|
1549 |
It's also needed on some exotic platforms where global variables are
|
|
1550 |
not set to 0 when a program starts.
|
|
1551 |
||
1552 |
We don't need to set numeric variables refered to in my_long_options
|
|
1553 |
as these are initialized by my_getopt.
|
|
1554 |
*/
|
|
1555 |
||
574.2.1
by ysano
Rename mysql to drizzle. |
1556 |
static void drizzle_init_variables(void) |
1
by brian
clean slate |
1557 |
{
|
1558 |
/* Things reset to zero */
|
|
722.4.1
by Mark Atwood
integrate errmsg plugin into sql_print_* functions |
1559 |
drizzle_home[0]= pidfile_name[0]= 0; |
1
by brian
clean slate |
1560 |
opt_tc_log_file= (char *)"tc.log"; // no hostname in tc_log file name ! |
1561 |
opt_secure_file_priv= 0; |
|
1562 |
cleanup_done= 0; |
|
1563 |
defaults_argc= 0; |
|
1564 |
defaults_argv= 0; |
|
1089.6.1
by Padraig O'Sullivan
Converted the test_flags variable from a uint32_t to std::bitset. |
1565 |
dropping_tables= ha_open_options=0; |
1566 |
test_flags.reset(); |
|
952
by Brian Aker
Remove bad variables. |
1567 |
wake_thread=0; |
909
by Brian Aker
Remove the need for unireg init |
1568 |
abort_loop= select_thread_in_use= false; |
1
by brian
clean slate |
1569 |
ready_to_exit= shutdown_in_progress= 0; |
1570 |
aborted_threads= aborted_connects= 0; |
|
779.3.23
by Monty Taylor
More fixy-fixes. |
1571 |
max_used_connections= 0; |
971.3.12
by Eric Day
Started abstracting Protocol, removed init_connect, init_file. |
1572 |
drizzled_user= drizzled_chroot= 0; |
212.6.6
by Mats Kindahl
Removing redundant use of casts in drizzled/ for memcmp(), memcpy(), memset(), and memmove(). |
1573 |
memset(&global_status_var, 0, sizeof(global_status_var)); |
1005.2.6
by Monty Taylor
Re-added bitset<> as a replacement for Bitmap<> |
1574 |
key_map_full.set(); |
1
by brian
clean slate |
1575 |
|
1576 |
/* Character sets */
|
|
1577 |
system_charset_info= &my_charset_utf8_general_ci; |
|
1578 |
files_charset_info= &my_charset_utf8_general_ci; |
|
1579 |
table_alias_charset= &my_charset_bin; |
|
1580 |
character_set_filesystem= &my_charset_bin; |
|
1581 |
||
1582 |
/* Things with default values that are not zero */
|
|
575.4.1
by ysano
Rename mysql to drizzle. |
1583 |
drizzle_home_ptr= drizzle_home; |
1
by brian
clean slate |
1584 |
pidfile_name_ptr= pidfile_name; |
1585 |
language_ptr= language; |
|
1300.5.3
by Monty Taylor
Removed drizzle_ prefix from some things that don't need it since they're |
1586 |
data_home= data_home_real; |
818
by Brian Aker
Found a few bits to be deleted (around binlog). |
1587 |
session_startup_options= (OPTION_AUTO_IS_NULL | OPTION_SQL_NOTES); |
1
by brian
clean slate |
1588 |
refresh_version= 1L; /* Increments on each reload */ |
971.3.70
by Eric Day
Fixed style issues found by Jay. |
1589 |
global_thread_id= 1UL; |
1241.9.17
by Monty Taylor
Removed more bits from server_includes. |
1590 |
getSessionList().clear(); |
1
by brian
clean slate |
1591 |
|
1592 |
/* Set directory paths */
|
|
629.5.4
by Toru Maesaka
Fourth pass of replacing MySQL's strmake() with libc calls |
1593 |
strncpy(language, LANGUAGE, sizeof(language)-1); |
1300.5.3
by Monty Taylor
Removed drizzle_ prefix from some things that don't need it since they're |
1594 |
strncpy(data_home_real, get_relative_path(LOCALSTATEDIR), |
1595 |
sizeof(data_home_real)-1); |
|
1596 |
data_home_buff[0]=FN_CURLIB; // all paths are relative from here |
|
1597 |
data_home_buff[1]=0; |
|
1598 |
data_home_len= 2; |
|
1
by brian
clean slate |
1599 |
|
1600 |
/* Variables in libraries */
|
|
1085.3.4
by Monty Taylor
pandora-build v0.8 |
1601 |
default_character_set_name= "utf8"; |
1602 |
default_collation_name= (char *)compiled_default_collation_name; |
|
1603 |
character_set_filesystem_name= "binary"; |
|
1
by brian
clean slate |
1604 |
lc_time_names_name= (char*) "en_US"; |
1605 |
/* Set default values for some option variables */
|
|
201
by Brian Aker
Convert default engine to Innodb |
1606 |
default_storage_engine_str= (char*) "innodb"; |
971.1.21
by Monty Taylor
Store StorageEngine in system variables, rather than storage engine plugin. |
1607 |
global_system_variables.storage_engine= NULL; |
1
by brian
clean slate |
1608 |
global_system_variables.tx_isolation= ISO_REPEATABLE_READ; |
151
by Brian Aker
Ulonglong to uint64_t |
1609 |
global_system_variables.select_limit= (uint64_t) HA_POS_ERROR; |
1610 |
max_system_variables.select_limit= (uint64_t) HA_POS_ERROR; |
|
1611 |
global_system_variables.max_join_size= (uint64_t) HA_POS_ERROR; |
|
1612 |
max_system_variables.max_join_size= (uint64_t) HA_POS_ERROR; |
|
1
by brian
clean slate |
1613 |
|
1614 |
/* Variables that depends on compile options */
|
|
1615 |
#ifdef HAVE_BROKEN_REALPATH
|
|
1616 |
have_symlink=SHOW_OPTION_NO; |
|
1617 |
#else
|
|
1618 |
have_symlink=SHOW_OPTION_YES; |
|
1619 |
#endif
|
|
1620 |
||
1621 |
const char *tmpenv; |
|
1622 |
if (!(tmpenv = getenv("MY_BASEDIR_VERSION"))) |
|
722.1.4
by Monty Taylor
Removed all the setting of DEFS everywhere. Use configmake.h to get the values |
1623 |
tmpenv = PREFIX; |
629.5.4
by Toru Maesaka
Fourth pass of replacing MySQL's strmake() with libc calls |
1624 |
(void) strncpy(drizzle_home, tmpenv, sizeof(drizzle_home)-1); |
942.2.5
by Brian Aker
Fix, again, the thread lock issues for unlink_session |
1625 |
|
1626 |
connection_count= 0; |
|
1
by brian
clean slate |
1627 |
}
|
1628 |
||
1629 |
||
1410.3.4
by Djellel E. Difallah
update references to old my_'s |
1630 |
int drizzled_get_one_option(int optid, const struct option *opt, |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1631 |
char *argument) |
1
by brian
clean slate |
1632 |
{
|
1633 |
switch(optid) { |
|
1634 |
case 'a': |
|
1635 |
global_system_variables.tx_isolation= ISO_SERIALIZABLE; |
|
1636 |
break; |
|
1637 |
case 'b': |
|
629.5.4
by Toru Maesaka
Fourth pass of replacing MySQL's strmake() with libc calls |
1638 |
strncpy(drizzle_home,argument,sizeof(drizzle_home)-1); |
1
by brian
clean slate |
1639 |
break; |
1640 |
case 'C': |
|
1641 |
if (default_collation_name == compiled_default_collation_name) |
|
1642 |
default_collation_name= 0; |
|
1643 |
break; |
|
1644 |
case 'h': |
|
1300.5.3
by Monty Taylor
Removed drizzle_ prefix from some things that don't need it since they're |
1645 |
strncpy(data_home_real,argument, sizeof(data_home_real)-1); |
1
by brian
clean slate |
1646 |
/* Correct pointer set by my_getopt (for embedded library) */
|
1300.5.3
by Monty Taylor
Removed drizzle_ prefix from some things that don't need it since they're |
1647 |
data_home= data_home_real; |
1648 |
data_home_len= strlen(data_home); |
|
1
by brian
clean slate |
1649 |
break; |
1650 |
case 'u': |
|
574.2.1
by ysano
Rename mysql to drizzle. |
1651 |
if (!drizzled_user || !strcmp(drizzled_user, argument)) |
1652 |
drizzled_user= argument; |
|
1
by brian
clean slate |
1653 |
else
|
755.2.1
by Mark Atwood
replace sql_print_error etc with errmsg_print |
1654 |
errmsg_printf(ERRMSG_LVL_WARN, _("Ignoring user change to '%s' because the user was " |
312.1.10
by Monty Taylor
Added some strings from drizzled.cc. |
1655 |
"set to '%s' earlier on the command line\n"), |
574.2.1
by ysano
Rename mysql to drizzle. |
1656 |
argument, drizzled_user); |
1
by brian
clean slate |
1657 |
break; |
1658 |
case 'L': |
|
629.5.4
by Toru Maesaka
Fourth pass of replacing MySQL's strmake() with libc calls |
1659 |
strncpy(language, argument, sizeof(language)-1); |
1
by brian
clean slate |
1660 |
break; |
1661 |
case 'V': |
|
1662 |
print_version(); |
|
1663 |
exit(0); |
|
1664 |
case 'W': |
|
1665 |
if (!argument) |
|
1666 |
global_system_variables.log_warnings++; |
|
1667 |
else if (argument == disabled_my_option) |
|
1668 |
global_system_variables.log_warnings= 0L; |
|
1669 |
else
|
|
1670 |
global_system_variables.log_warnings= atoi(argument); |
|
1671 |
break; |
|
1672 |
case 'T': |
|
1089.6.1
by Padraig O'Sullivan
Converted the test_flags variable from a uint32_t to std::bitset. |
1673 |
if (argument) |
1674 |
{
|
|
1675 |
test_flags.set((uint32_t) atoi(argument)); |
|
1676 |
}
|
|
1
by brian
clean slate |
1677 |
break; |
1678 |
case (int) OPT_WANT_CORE: |
|
1089.6.1
by Padraig O'Sullivan
Converted the test_flags variable from a uint32_t to std::bitset. |
1679 |
test_flags.set(TEST_CORE_ON_SIGNAL); |
1
by brian
clean slate |
1680 |
break; |
1681 |
case (int) OPT_SKIP_STACK_TRACE: |
|
1089.6.1
by Padraig O'Sullivan
Converted the test_flags variable from a uint32_t to std::bitset. |
1682 |
test_flags.set(TEST_NO_STACKTRACE); |
1
by brian
clean slate |
1683 |
break; |
1684 |
case (int) OPT_SKIP_SYMLINKS: |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1685 |
internal::my_use_symdir=0; |
1
by brian
clean slate |
1686 |
break; |
1687 |
case (int) OPT_BIND_ADDRESS: |
|
1688 |
{
|
|
236.1.40
by Monty Taylor
A few meaningless changes. |
1689 |
struct addrinfo *res_lst, hints; |
1
by brian
clean slate |
1690 |
|
212.6.1
by Mats Kindahl
Replacing all bzero() calls with memset() calls and removing the bzero.c file. |
1691 |
memset(&hints, 0, sizeof(struct addrinfo)); |
1
by brian
clean slate |
1692 |
hints.ai_socktype= SOCK_STREAM; |
1693 |
hints.ai_protocol= IPPROTO_TCP; |
|
1694 |
||
236.1.40
by Monty Taylor
A few meaningless changes. |
1695 |
if (getaddrinfo(argument, NULL, &hints, &res_lst) != 0) |
1
by brian
clean slate |
1696 |
{
|
755.2.1
by Mark Atwood
replace sql_print_error etc with errmsg_print |
1697 |
errmsg_printf(ERRMSG_LVL_ERROR, _("Can't start server: cannot resolve hostname!")); |
1393.3.1
by Andrew Hutchings
Convert get_one_option to return an int instead of a bool |
1698 |
return EXIT_ARGUMENT_INVALID; |
1
by brian
clean slate |
1699 |
}
|
1700 |
||
1701 |
if (res_lst->ai_next) |
|
1702 |
{
|
|
755.2.1
by Mark Atwood
replace sql_print_error etc with errmsg_print |
1703 |
errmsg_printf(ERRMSG_LVL_ERROR, _("Can't start server: bind-address refers to " |
312.1.10
by Monty Taylor
Added some strings from drizzled.cc. |
1704 |
"multiple interfaces!")); |
1393.3.1
by Andrew Hutchings
Convert get_one_option to return an int instead of a bool |
1705 |
return EXIT_ARGUMENT_INVALID; |
1
by brian
clean slate |
1706 |
}
|
1707 |
freeaddrinfo(res_lst); |
|
1708 |
}
|
|
1709 |
break; |
|
1710 |
case (int) OPT_PID_FILE: |
|
629.5.4
by Toru Maesaka
Fourth pass of replacing MySQL's strmake() with libc calls |
1711 |
strncpy(pidfile_name, argument, sizeof(pidfile_name)-1); |
1
by brian
clean slate |
1712 |
break; |
1713 |
case OPT_SERVER_ID: |
|
1714 |
break; |
|
1715 |
case OPT_TX_ISOLATION: |
|
224.2.2
by Brian Aker
Second pass cleanup around filesystem type. |
1716 |
{
|
1717 |
int type; |
|
1718 |
type= find_type_or_exit(argument, &tx_isolation_typelib, opt->name); |
|
1719 |
global_system_variables.tx_isolation= (type-1); |
|
1720 |
break; |
|
1721 |
}
|
|
1
by brian
clean slate |
1722 |
case OPT_TC_HEURISTIC_RECOVER: |
1723 |
tc_heuristic_recover= find_type_or_exit(argument, |
|
1724 |
&tc_heuristic_recover_typelib, |
|
1725 |
opt->name); |
|
1726 |
break; |
|
1727 |
}
|
|
1115.1.3
by Brian Aker
Remove final bits of "myisam" specific from drizzled.cc |
1728 |
|
1
by brian
clean slate |
1729 |
return 0; |
1730 |
}
|
|
1731 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1732 |
static void option_error_reporter(enum loglevel level, const char *format, ...) |
1
by brian
clean slate |
1733 |
{
|
1734 |
va_list args; |
|
1735 |
va_start(args, format); |
|
1736 |
||
1737 |
/* Don't print warnings for --loose options during bootstrap */
|
|
228
by Brian Aker
First pass on socket cleanup. |
1738 |
if (level == ERROR_LEVEL || global_system_variables.log_warnings) |
1
by brian
clean slate |
1739 |
{
|
1130.1.12
by Monty Taylor
Moved service stuff into plugin/ |
1740 |
plugin::ErrorMessage::vprintf(current_session, ERROR_LEVEL, format, args); |
1
by brian
clean slate |
1741 |
}
|
1742 |
va_end(args); |
|
1743 |
}
|
|
1744 |
||
1745 |
||
1746 |
/**
|
|
1747 |
@todo
|
|
1271.5.3
by Tim Penhey
change the include files |
1748 |
- FIXME add EXIT_TOO_MANY_ARGUMENTS to "drizzled/error.h" and return that code?
|
1
by brian
clean slate |
1749 |
*/
|
1750 |
static void get_options(int *argc,char **argv) |
|
1751 |
{
|
|
1752 |
int ho_error; |
|
1753 |
||
1754 |
my_getopt_error_reporter= option_error_reporter; |
|
1755 |
||
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
1756 |
string progname(argv[0]); |
1757 |
||
1
by brian
clean slate |
1758 |
/* Skip unknown options so that they may be processed later by plugins */
|
163
by Brian Aker
Merge Monty's code. |
1759 |
my_getopt_skip_unknown= true; |
1
by brian
clean slate |
1760 |
|
1761 |
if ((ho_error= handle_options(argc, &argv, my_long_options, |
|
575.4.4
by Yoshinori Sano
Rename mysql to drizzle. |
1762 |
drizzled_get_one_option))) |
1
by brian
clean slate |
1763 |
exit(ho_error); |
1764 |
(*argc)++; /* add back one for the progname handle_options removes */ |
|
1765 |
/* no need to do this for argv as we are discarding it. */
|
|
1766 |
||
1767 |
#if defined(HAVE_BROKEN_REALPATH)
|
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1768 |
internal::my_use_symdir=0; |
1769 |
internal::my_disable_symlinks=1; |
|
1
by brian
clean slate |
1770 |
have_symlink=SHOW_OPTION_NO; |
1771 |
#else
|
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1772 |
if (!internal::my_use_symdir) |
1
by brian
clean slate |
1773 |
{
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1774 |
internal::my_disable_symlinks=1; |
1
by brian
clean slate |
1775 |
have_symlink=SHOW_OPTION_DISABLED; |
1776 |
}
|
|
1777 |
#endif
|
|
1778 |
if (opt_debugging) |
|
1779 |
{
|
|
1780 |
/* Allow break with SIGINT, no core or stack trace */
|
|
1089.6.1
by Padraig O'Sullivan
Converted the test_flags variable from a uint32_t to std::bitset. |
1781 |
test_flags.set(TEST_SIGINT); |
1782 |
test_flags.set(TEST_NO_STACKTRACE); |
|
1783 |
test_flags.reset(TEST_CORE_ON_SIGNAL); |
|
1
by brian
clean slate |
1784 |
}
|
1785 |
||
574.2.1
by ysano
Rename mysql to drizzle. |
1786 |
if (drizzled_chroot) |
1787 |
set_root(drizzled_chroot); |
|
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
1788 |
fix_paths(progname); |
1
by brian
clean slate |
1789 |
|
1790 |
/*
|
|
1791 |
Set some global variables from the global_system_variables
|
|
1792 |
In most cases the global variables will not be used
|
|
1793 |
*/
|
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1794 |
internal::my_default_record_cache_size=global_system_variables.read_buff_size; |
1
by brian
clean slate |
1795 |
}
|
1796 |
||
1797 |
||
722.1.4
by Monty Taylor
Removed all the setting of DEFS everywhere. Use configmake.h to get the values |
1798 |
static const char *get_relative_path(const char *path) |
1
by brian
clean slate |
1799 |
{
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1800 |
if (internal::test_if_hard_path(path) && |
1241.9.12
by Monty Taylor
Trims more out of server_includes.h. |
1801 |
(strncmp(path, PREFIX, strlen(PREFIX)) == 0) && |
722.1.4
by Monty Taylor
Removed all the setting of DEFS everywhere. Use configmake.h to get the values |
1802 |
strcmp(PREFIX,FN_ROOTDIR)) |
1
by brian
clean slate |
1803 |
{
|
722.1.4
by Monty Taylor
Removed all the setting of DEFS everywhere. Use configmake.h to get the values |
1804 |
if (strlen(PREFIX) < strlen(path)) |
1805 |
path+=(size_t) strlen(PREFIX); |
|
1
by brian
clean slate |
1806 |
while (*path == FN_LIBCHAR) |
1807 |
path++; |
|
1808 |
}
|
|
722.1.4
by Monty Taylor
Removed all the setting of DEFS everywhere. Use configmake.h to get the values |
1809 |
return path; |
1
by brian
clean slate |
1810 |
}
|
1811 |
||
1812 |
||
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
1813 |
static void fix_paths(string &progname) |
1
by brian
clean slate |
1814 |
{
|
1060.2.5
by Eric Lambert
-removed my_realpath from my_symlink and replaced it with calls to posix realpath |
1815 |
char buff[FN_REFLEN],*pos,rp_buff[PATH_MAX]; |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1816 |
internal::convert_dirname(drizzle_home,drizzle_home,NULL); |
575.4.1
by ysano
Rename mysql to drizzle. |
1817 |
/* Resolve symlinks to allow 'drizzle_home' to be a relative symlink */
|
1060.2.5
by Eric Lambert
-removed my_realpath from my_symlink and replaced it with calls to posix realpath |
1818 |
#if defined(HAVE_BROKEN_REALPATH)
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1819 |
internal::my_load_path(drizzle_home, drizzle_home, NULL); |
1060.2.5
by Eric Lambert
-removed my_realpath from my_symlink and replaced it with calls to posix realpath |
1820 |
#else
|
1821 |
if (!realpath(drizzle_home,rp_buff)) |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1822 |
internal::my_load_path(rp_buff, drizzle_home, NULL); |
1060.2.5
by Eric Lambert
-removed my_realpath from my_symlink and replaced it with calls to posix realpath |
1823 |
rp_buff[FN_REFLEN-1]= '\0'; |
1824 |
strcpy(drizzle_home,rp_buff); |
|
575.4.1
by ysano
Rename mysql to drizzle. |
1825 |
/* Ensure that drizzle_home ends in FN_LIBCHAR */
|
1826 |
pos= strchr(drizzle_home, '\0'); |
|
1060.2.5
by Eric Lambert
-removed my_realpath from my_symlink and replaced it with calls to posix realpath |
1827 |
#endif
|
1
by brian
clean slate |
1828 |
if (pos[-1] != FN_LIBCHAR) |
1829 |
{
|
|
1830 |
pos[0]= FN_LIBCHAR; |
|
1831 |
pos[1]= 0; |
|
1832 |
}
|
|
1300.5.3
by Monty Taylor
Removed drizzle_ prefix from some things that don't need it since they're |
1833 |
internal::convert_dirname(data_home_real,data_home_real,NULL); |
1834 |
(void) internal::fn_format(buff, data_home_real, "", "", |
|
1
by brian
clean slate |
1835 |
(MY_RETURN_REAL_PATH|MY_RESOLVE_SYMLINKS)); |
1300.5.3
by Monty Taylor
Removed drizzle_ prefix from some things that don't need it since they're |
1836 |
(void) internal::unpack_dirname(data_home_real_unpacked, buff); |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1837 |
internal::convert_dirname(language,language,NULL); |
1838 |
(void) internal::my_load_path(drizzle_home, drizzle_home,""); // Resolve current dir |
|
1300.5.3
by Monty Taylor
Removed drizzle_ prefix from some things that don't need it since they're |
1839 |
(void) internal::my_load_path(data_home_real, data_home_real,drizzle_home); |
1840 |
(void) internal::my_load_path(pidfile_name, pidfile_name,data_home_real); |
|
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
1841 |
|
1842 |
if (opt_plugin_dir_ptr == NULL) |
|
1843 |
{
|
|
1844 |
/* No plugin dir has been specified. Figure out where the plugins are */
|
|
1845 |
if (progname[0] != FN_LIBCHAR) |
|
1846 |
{
|
|
1847 |
/* We have a relative path and need to find the absolute */
|
|
1848 |
char working_dir[FN_REFLEN]; |
|
1849 |
char *working_dir_ptr= working_dir; |
|
1850 |
working_dir_ptr= getcwd(working_dir_ptr, FN_REFLEN); |
|
1851 |
string new_path(working_dir); |
|
1852 |
if (*(new_path.end()-1) != '/') |
|
1853 |
new_path.push_back('/'); |
|
1854 |
if (progname[0] == '.' && progname[1] == '/') |
|
1855 |
new_path.append(progname.substr(2)); |
|
1856 |
else
|
|
1857 |
new_path.append(progname); |
|
1858 |
progname.swap(new_path); |
|
1859 |
}
|
|
1860 |
||
1861 |
/* Now, trim off the exe name */
|
|
1862 |
string progdir(progname.substr(0, progname.rfind(FN_LIBCHAR)+1)); |
|
1863 |
if (progdir.rfind(".libs/") != string::npos) |
|
1864 |
{
|
|
1865 |
progdir.assign(progdir.substr(0, progdir.rfind(".libs/"))); |
|
1866 |
}
|
|
1867 |
string testfile(progdir); |
|
1300.5.2
by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then |
1868 |
testfile.append("drizzled.lo"); |
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
1869 |
struct stat testfile_stat; |
1870 |
if (stat(testfile.c_str(), &testfile_stat)) |
|
1871 |
{
|
|
1300.5.2
by Monty Taylor
Changed build to build the almost all of drizzle into libdrizzled and then |
1872 |
/* drizzled.lo doesn't exist - we are not in a source dir.
|
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
1873 |
* Go on as usual
|
1874 |
*/
|
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1875 |
(void) internal::my_load_path(opt_plugin_dir, get_relative_path(PKGPLUGINDIR), |
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
1876 |
drizzle_home); |
1877 |
}
|
|
1878 |
else
|
|
1879 |
{
|
|
1880 |
/* We are in a source dir! Plugin dir is ../plugin/.libs */
|
|
1881 |
size_t last_libchar_pos= progdir.rfind(FN_LIBCHAR,progdir.size()-2)+1; |
|
1882 |
string source_plugindir(progdir.substr(0,last_libchar_pos)); |
|
1883 |
source_plugindir.append("plugin/.libs"); |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1884 |
(void) internal::my_load_path(opt_plugin_dir, source_plugindir.c_str(), ""); |
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
1885 |
}
|
1886 |
}
|
|
1887 |
else
|
|
1888 |
{
|
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1889 |
(void) internal::my_load_path(opt_plugin_dir, opt_plugin_dir_ptr, drizzle_home); |
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
1890 |
}
|
1
by brian
clean slate |
1891 |
opt_plugin_dir_ptr= opt_plugin_dir; |
1892 |
||
856
by Brian Aker
Remove dead code around charset variable/directory. |
1893 |
const char *sharedir= get_relative_path(PKGDATADIR); |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1894 |
if (internal::test_if_hard_path(sharedir)) |
971.6.11
by Eric Day
Removed purecov messages. |
1895 |
strncpy(buff,sharedir,sizeof(buff)-1); |
1
by brian
clean slate |
1896 |
else
|
534
by Monty Taylor
Removed stxnmov. Also deleted strstr which had already been removed. |
1897 |
{
|
575.4.1
by ysano
Rename mysql to drizzle. |
1898 |
strcpy(buff, drizzle_home); |
1899 |
strncat(buff, sharedir, sizeof(buff)-strlen(drizzle_home)-1); |
|
534
by Monty Taylor
Removed stxnmov. Also deleted strstr which had already been removed. |
1900 |
}
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1901 |
internal::convert_dirname(buff,buff,NULL); |
1902 |
(void) internal::my_load_path(language,language,buff); |
|
1
by brian
clean slate |
1903 |
|
680
by Brian Aker
Remove locks around temp tables for searching tmp directory path. |
1904 |
{
|
1905 |
char *tmp_string; |
|
1906 |
struct stat buf; |
|
1907 |
||
1908 |
tmp_string= getenv("TMPDIR"); |
|
1909 |
||
1910 |
if (opt_drizzle_tmpdir) |
|
1911 |
drizzle_tmpdir= strdup(opt_drizzle_tmpdir); |
|
1912 |
else if (tmp_string == NULL) |
|
1913 |
drizzle_tmpdir= strdup(P_tmpdir); |
|
1914 |
else
|
|
1915 |
drizzle_tmpdir= strdup(tmp_string); |
|
1916 |
||
1917 |
assert(drizzle_tmpdir); |
|
1918 |
||
1919 |
if (stat(drizzle_tmpdir, &buf) || (S_ISDIR(buf.st_mode) == false)) |
|
1920 |
{
|
|
1921 |
exit(1); |
|
1922 |
}
|
|
1923 |
}
|
|
1924 |
||
1
by brian
clean slate |
1925 |
/*
|
1926 |
Convert the secure-file-priv option to system format, allowing
|
|
1927 |
a quick strcmp to check if read or write is in an allowed dir
|
|
1928 |
*/
|
|
1929 |
if (opt_secure_file_priv) |
|
1930 |
{
|
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1931 |
internal::convert_dirname(buff, opt_secure_file_priv, NULL); |
477
by Monty Taylor
Removed my_free(). It turns out that it had been def'd to ignore the flags passed to it in the second arg anyway. Gotta love that. |
1932 |
free(opt_secure_file_priv); |
656.1.19
by Monty Taylor
Removed my_strdup from drizzled/ |
1933 |
opt_secure_file_priv= strdup(buff); |
656.1.52
by Monty Taylor
Added more return value checks. |
1934 |
if (opt_secure_file_priv == NULL) |
1935 |
exit(1); |
|
1
by brian
clean slate |
1936 |
}
|
1937 |
}
|
|
1938 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1939 |
} /* namespace drizzled */ |
1940 |