59
63
using namespace drizzled;
60
64
using namespace std;
65
namespace fs=boost::filesystem;
62
67
static pthread_t select_thread;
63
68
static uint32_t thr_kill_signal;
66
72
All global error messages are sent here where the first one is stored
230
236
google::protobuf::SetLogHandler(&GoogleProtoErrorThrower);
232
238
/* Function generates error messages before abort */
239
error_handler_hook= my_message_sql;
233
240
/* init_common_variables must get basic settings such as data_home_dir
234
241
and plugin_load_list. */
235
if (init_common_variables(argc, argv))
242
if (init_common_variables(argc, argv, modules))
236
243
unireg_abort(1); // Will do exit
247
After this we can't quit by a simple unireg_abort
241
252
select_thread=pthread_self();
242
253
select_thread_in_use=1;
244
if (chdir(data_home_real) && !opt_help)
246
errmsg_printf(ERRMSG_LVL_ERROR, _("Data directory %s does not exist\n"), data_home_real);
257
if (chdir(getDataHome().c_str()))
259
errmsg_printf(ERRMSG_LVL_ERROR,
260
_("Data directory %s does not exist\n"),
261
getDataHome().c_str());
264
if (mkdir("local", 0700))
266
/* We don't actually care */
270
errmsg_printf(ERRMSG_LVL_ERROR,
271
_("Local catalog %s/local does not exist\n"),
272
getDataHome().c_str());
275
/* TODO: This is a hack until we can properly support std::string in sys_var*/
276
char **data_home_ptr= getDatadirPtr();
277
fs::path full_data_home_path(fs::system_complete(fs::path(getDataHome())));
278
std::string full_data_home(full_data_home_path.file_string());
279
*data_home_ptr= new char[full_data_home.size()+1] ();
280
memcpy(*data_home_ptr, full_data_home.c_str(), full_data_home.size());
281
getDataHomeCatalog()= "./";
282
getDataHome()= "../";
249
data_home= data_home_buff;
250
data_home[0]=FN_CURLIB; // all paths are relative from here
254
287
if (server_id == 0)
276
309
if (plugin::Listen::setup())
281
After this we can't quit by a simple unireg_abort
283
error_handler_hook= my_message_sql;
285
313
assert(plugin::num_trx_monitored_objects > 0);
286
314
if (drizzle_rm_tmp_tables() ||
321
349
COND_thread_count.notify_all();
323
351
/* Wait until cleanup is done */
324
LOCK_thread_count.lock();
325
while (!ready_to_exit)
326
pthread_cond_wait(COND_server_end.native_handle(), LOCK_thread_count.native_handle());
327
LOCK_thread_count.unlock();
353
boost::mutex::scoped_lock scopedLock(LOCK_thread_count);
354
while (!ready_to_exit)
355
COND_server_end.wait(scopedLock);
330
359
module::Registry::shutdown();
331
360
internal::my_end();