~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/drizzled.cc

  • Committer: Andrew Hutchings
  • Date: 2011-02-01 10:23:22 UTC
  • mto: (2136.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 2137.
  • Revision ID: andrew@linuxjedi.co.uk-20110201102322-oxztcyrjzg3c7yta
Fix counters cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include <config.h>
21
 
 
22
 
#include <drizzled/configmake.h>
23
 
#include <drizzled/atomics.h>
24
 
#include <drizzled/data_home.h>
 
20
#include "config.h"
 
21
#include "drizzled/configmake.h"
 
22
#include "drizzled/atomics.h"
 
23
#include "drizzled/data_home.h"
25
24
 
26
25
#include <netdb.h>
27
26
#include <sys/types.h>
32
31
#include <stdexcept>
33
32
 
34
33
#include <boost/program_options.hpp>
35
 
#include <drizzled/program_options/config_file.h>
 
34
#include "drizzled/program_options/config_file.h"
36
35
#include <boost/thread/recursive_mutex.hpp>
37
36
#include <boost/thread/mutex.hpp>
38
37
#include <boost/thread/shared_mutex.hpp>
40
39
#include <boost/filesystem.hpp>
41
40
#include <boost/detail/atomic_count.hpp>
42
41
 
43
 
#include <drizzled/cached_directory.h>
44
 
#include <drizzled/charset.h>
45
 
#include <drizzled/data_home.h>
46
 
#include <drizzled/debug.h>
47
 
#include <drizzled/definition/cache.h>
48
 
#include <drizzled/drizzled.h>
 
42
#include "drizzled/internal/my_sys.h"
 
43
#include "drizzled/internal/my_bit.h"
 
44
#include <drizzled/my_hash.h>
 
45
#include <drizzled/error.h>
49
46
#include <drizzled/errmsg_print.h>
50
 
#include <drizzled/error.h>
51
 
#include <drizzled/global_buffer.h>
52
 
#include <drizzled/internal/my_bit.h>
53
 
#include <drizzled/internal/my_sys.h>
 
47
#include <drizzled/tztime.h>
 
48
#include <drizzled/sql_base.h>
 
49
#include <drizzled/show.h>
 
50
#include <drizzled/sql_parse.h>
54
51
#include <drizzled/item/cmpfunc.h>
 
52
#include <drizzled/session.h>
55
53
#include <drizzled/item/create.h>
56
 
#include <drizzled/message/cache.h>
57
 
#include <drizzled/module/load_list.h>
58
 
#include <drizzled/module/registry.h>
59
 
#include <drizzled/plugin/client.h>
60
 
#include <drizzled/plugin/error_message.h>
61
 
#include <drizzled/plugin/event_observer.h>
62
 
#include <drizzled/plugin/listen.h>
63
 
#include <drizzled/plugin/monitored_in_transaction.h>
64
 
#include <drizzled/plugin/scheduler.h>
65
 
#include <drizzled/plugin/storage_engine.h>
66
 
#include <drizzled/plugin/xa_resource_manager.h>
67
 
#include <drizzled/probes.h>
68
 
#include <drizzled/replication_services.h> /* For ReplicationServices::evaluateRegisteredPlugins() */
69
 
#include <drizzled/session.h>
70
 
#include <drizzled/session/cache.h>
71
 
#include <drizzled/show.h>
72
 
#include <drizzled/sql_base.h>
73
 
#include <drizzled/sql_parse.h>
74
 
#include <drizzled/statistics_variables.h>
75
 
#include <drizzled/table/cache.h>
76
 
#include <drizzled/temporal_format.h> /* For init_temporal_formats() */
77
54
#include <drizzled/unireg.h>
78
 
#include <plugin/myisam/myisam.h>
79
 
#include <drizzled/typelib.h>
80
 
#include <drizzled/visibility.h>
81
 
#include <drizzled/system_variables.h>
82
 
#include <drizzled/open_tables_state.h>
 
55
#include "drizzled/temporal_format.h" /* For init_temporal_formats() */
 
56
#include "drizzled/plugin/listen.h"
 
57
#include "drizzled/plugin/error_message.h"
 
58
#include "drizzled/plugin/client.h"
 
59
#include "drizzled/plugin/scheduler.h"
 
60
#include "drizzled/plugin/xa_resource_manager.h"
 
61
#include "drizzled/plugin/monitored_in_transaction.h"
 
62
#include "drizzled/replication_services.h" /* For ReplicationServices::evaluateRegisteredPlugins() */
 
63
#include "drizzled/probes.h"
 
64
#include "drizzled/session/cache.h"
 
65
#include "drizzled/charset.h"
 
66
#include "plugin/myisam/myisam.h"
 
67
#include "drizzled/drizzled.h"
 
68
#include "drizzled/module/registry.h"
 
69
#include "drizzled/module/load_list.h"
 
70
#include "drizzled/global_buffer.h"
 
71
 
 
72
#include "drizzled/debug.h"
 
73
 
 
74
#include "drizzled/definition/cache.h"
 
75
 
 
76
#include "drizzled/plugin/event_observer.h"
 
77
 
 
78
#include "drizzled/message/cache.h"
 
79
 
 
80
#include "drizzled/visibility.h"
83
81
 
84
82
#include <google/protobuf/stubs/common.h>
85
83
 
102
100
 
103
101
#include <errno.h>
104
102
#include <sys/stat.h>
105
 
#include <drizzled/option.h>
 
103
#include "drizzled/option.h"
106
104
#ifdef HAVE_SYSENT_H
107
105
#include <sysent.h>
108
106
#endif
136
134
#include <sys/fpu.h>
137
135
#endif
138
136
 
139
 
#include <drizzled/internal/my_pthread.h>                       // For thr_setconcurency()
140
 
#include <drizzled/constrained_value.h>
 
137
#include "drizzled/internal/my_pthread.h"                       // For thr_setconcurency()
 
138
#include "drizzled/constrained_value.h"
141
139
 
142
140
#include <drizzled/gettext.h>
143
141
 
158
156
namespace po=boost::program_options;
159
157
namespace dpo=drizzled::program_options;
160
158
 
161
 
bool opt_daemon= false;
162
159
 
163
160
namespace drizzled
164
161
{
257
254
uint64_t session_startup_options;
258
255
back_log_constraints back_log(50);
259
256
DRIZZLED_API uint32_t server_id;
260
 
DRIZZLED_API string server_uuid;
261
257
uint64_t table_cache_size;
262
258
size_t table_def_size;
263
259
uint32_t global_thread_id= 1UL;
309
305
fs::path system_config_dir(SYSCONFDIR);
310
306
 
311
307
 
 
308
char system_time_zone[30];
 
309
char *default_tz_name;
 
310
DRIZZLED_API char glob_hostname[FN_REFLEN];
 
311
 
312
312
char *opt_tc_log_file;
313
313
const key_map key_map_empty(0);
314
314
key_map key_map_full(0);                        // Will be initialized later
322
322
const char *in_additional_cond= "<IN COND>";
323
323
const char *in_having_cond= "<IN HAVING>";
324
324
 
 
325
type::Decimal decimal_zero;
325
326
/* classes for comparation parsing/processing */
326
327
 
327
328
FILE *stderror_file=0;
330
331
drizzle_system_variables max_system_variables;
331
332
global_counters current_global_counters;
332
333
 
333
 
DRIZZLED_API const charset_info_st *system_charset_info;
334
 
const charset_info_st *files_charset_info;
335
 
const charset_info_st *table_alias_charset;
336
 
const charset_info_st *character_set_filesystem;
 
334
DRIZZLED_API const CHARSET_INFO *system_charset_info;
 
335
const CHARSET_INFO *files_charset_info;
 
336
const CHARSET_INFO *table_alias_charset;
 
337
const CHARSET_INFO *character_set_filesystem;
337
338
 
338
339
MY_LOCALE *my_default_lc_time_names;
339
340
 
356
357
global_buffer_constraint<uint64_t> global_read_rnd_buffer(0);
357
358
global_buffer_constraint<uint64_t> global_read_buffer(0);
358
359
 
359
 
DRIZZLED_API size_t transaction_message_threshold;
 
360
/** 
 
361
  Refresh value. We use to test this to find out if a refresh even has happened recently.
 
362
*/
 
363
uint64_t refresh_version;  /* Increments on each reload */
 
364
 
 
365
/* Function declarations */
 
366
bool drizzle_rm_tmp_tables();
360
367
 
361
368
static void drizzle_init_variables(void);
362
369
static void get_options();
367
374
 
368
375
fs::path base_plugin_dir(PKGPLUGINDIR);
369
376
 
370
 
po::options_description config_options(_("Config File Options"));
371
 
po::options_description long_options(_("Kernel Options"));
372
 
po::options_description plugin_load_options(_("Plugin Loading Options"));
373
 
po::options_description plugin_options(_("Plugin Options"));
374
 
po::options_description initial_options(_("Config and Plugin Loading"));
375
 
po::options_description full_options(_("Kernel and Plugin Loading and Plugin"));
 
377
po::options_description config_options("Config File Options");
 
378
po::options_description long_options("Kernel Options");
 
379
po::options_description plugin_load_options("Plugin Loading Options");
 
380
po::options_description plugin_options("Plugin Options");
 
381
po::options_description initial_options("Config and Plugin Loading");
 
382
po::options_description full_options("Kernel and Plugin Loading and Plugin");
376
383
vector<string> unknown_options;
377
384
vector<string> defaults_file_list;
378
385
po::variables_map vm;
379
386
 
 
387
fs::path data_home(LOCALSTATEDIR);
 
388
fs::path full_data_home(LOCALSTATEDIR);
 
389
 
380
390
po::variables_map &getVariablesMap()
381
391
{
382
392
  return vm;
383
393
}
384
394
 
385
 
namespace
386
 
{
387
 
 
388
 
std::string &getGlobHostname()
389
 
{
390
 
  static std::string glob_hostname("localhost");
391
 
  return glob_hostname;
392
 
}
393
 
 
394
 
void setServerHostname(const std::string &hostname)
395
 
{
396
 
  getGlobHostname()= hostname;
397
 
}
398
 
}
399
 
 
400
 
const std::string &getServerHostname()
401
 
{
402
 
  return getGlobHostname();
403
 
}
404
 
 
 
395
fs::path& getFullDataHome()
 
396
{
 
397
  return full_data_home;
 
398
}
 
399
 
 
400
fs::path& getDataHome()
 
401
{
 
402
  return data_home;
 
403
}
 
404
 
 
405
fs::path& getDataHomeCatalog()
 
406
{
 
407
  static fs::path data_home_catalog(getDataHome());
 
408
  return data_home_catalog;
 
409
}
 
410
 
 
411
 
405
412
/****************************************************************************
406
413
** Code to end drizzled
407
414
****************************************************************************/
413
420
 
414
421
  /* kill connection thread */
415
422
  {
416
 
    boost::mutex::scoped_lock scopedLock(session::Cache::mutex());
 
423
    boost::mutex::scoped_lock scopedLock(session::Cache::singleton().mutex());
417
424
 
418
425
    while (select_thread_in_use)
419
426
    {
420
 
      boost::xtime xt;
421
 
      xtime_get(&xt, boost::TIME_UTC);
422
 
      xt.sec += 2;
 
427
      boost::xtime xt; 
 
428
      xtime_get(&xt, boost::TIME_UTC); 
 
429
      xt.sec += 2; 
423
430
 
424
431
      for (uint32_t tmp=0 ; tmp < 10 && select_thread_in_use; tmp++)
425
432
      {
438
445
  */
439
446
 
440
447
  {
441
 
    boost::mutex::scoped_lock scopedLock(session::Cache::mutex());
442
 
    session::Cache::list list= session::Cache::getCache();
 
448
    boost::mutex::scoped_lock scopedLock(session::Cache::singleton().mutex());
 
449
    session::Cache::list list= session::Cache::singleton().getCache();
443
450
 
444
 
    BOOST_FOREACH(session::Cache::list::reference tmp, list)
 
451
    for (session::Cache::list::iterator it= list.begin(); it != list.end(); ++it )
445
452
    {
 
453
      Session::shared_ptr tmp(*it);
 
454
 
446
455
      tmp->setKilled(Session::KILL_CONNECTION);
447
456
      tmp->scheduler->killSession(tmp.get());
448
457
      DRIZZLE_CONNECTION_DONE(tmp->thread_id);
451
460
    }
452
461
  }
453
462
 
454
 
  if (session::Cache::count())
 
463
  if (session::Cache::singleton().count())
455
464
    sleep(2);                                   // Give threads time to die
456
465
 
457
466
  /*
461
470
  */
462
471
  for (;;)
463
472
  {
464
 
    boost::mutex::scoped_lock scopedLock(session::Cache::mutex());
465
 
    session::Cache::list list= session::Cache::getCache();
 
473
    boost::mutex::scoped_lock scopedLock(session::Cache::singleton().mutex());
 
474
    session::Cache::list list= session::Cache::singleton().getCache();
466
475
 
467
476
    if (list.empty())
468
477
    {
479
488
 
480
489
  if (exit_code)
481
490
  {
482
 
    errmsg_printf(error::ERROR, _("Aborting"));
 
491
    errmsg_printf(ERRMSG_LVL_ERROR, _("Aborting\n"));
483
492
  }
484
493
  else if (opt_help)
485
494
  {
486
495
    usage();
487
496
  }
488
 
 
489
497
  clean_up(!opt_help && (exit_code));
490
498
  internal::my_end();
491
499
  exit(exit_code);
501
509
  free_charsets();
502
510
  module::Registry &modules= module::Registry::singleton();
503
511
  modules.shutdownModules();
 
512
  xid_cache_free();
504
513
 
505
514
  deinit_temporal_formats();
506
515
 
511
520
  (void) unlink(pid_file.file_string().c_str());        // This may not always exist
512
521
 
513
522
  if (print_message && server_start_time)
514
 
    errmsg_printf(drizzled::error::INFO, _(ER(ER_SHUTDOWN_COMPLETE)),internal::my_progname);
 
523
    errmsg_printf(ERRMSG_LVL_INFO, _(ER(ER_SHUTDOWN_COMPLETE)),internal::my_progname);
515
524
 
516
 
  session::Cache::shutdownFirst();
 
525
  session::Cache::singleton().shutdownFirst();
517
526
 
518
527
  /*
519
528
    The following lines may never be executed as the main thread may have
538
547
      tmp_user_info= getpwnam(user);
539
548
      if ((!tmp_user_info || user_id != tmp_user_info->pw_uid) &&
540
549
          global_system_variables.log_warnings)
541
 
            errmsg_printf(error::WARN, _("One can only use the --user switch "
 
550
            errmsg_printf(ERRMSG_LVL_WARN, _("One can only use the --user switch "
542
551
                            "if running as root\n"));
543
552
    }
544
553
    return NULL;
545
554
  }
546
555
  if (not user)
547
556
  {
548
 
      errmsg_printf(error::ERROR, _("Fatal error: Please read \"Security\" section of "
549
 
                                    "the manual to find out how to run drizzled as root"));
 
557
    errmsg_printf(ERRMSG_LVL_ERROR, _("Fatal error: Please read \"Security\" section of "
 
558
                                      "the manual to find out how to run drizzled as root!\n"));
550
559
    unireg_abort(1);
551
560
  }
552
 
 
553
 
  if (not strcmp(user, "root"))
 
561
  if (!strcmp(user,"root"))
554
562
    return NULL;                        // Avoid problem with dynamic libraries
555
563
 
556
564
  if (!(tmp_user_info= getpwnam(user)))
566
574
  return tmp_user_info;
567
575
 
568
576
err:
569
 
  errmsg_printf(error::ERROR, _("Fatal error: Can't change to run as user '%s' ;  "
 
577
  errmsg_printf(ERRMSG_LVL_ERROR, _("Fatal error: Can't change to run as user '%s' ;  "
570
578
                    "Please check that the user exists!\n"),user);
571
579
  unireg_abort(1);
572
580
 
622
630
    session              Thread handler
623
631
*/
624
632
 
625
 
void Session::unlink(session_id_t &session_id)
 
633
void drizzled::Session::unlink(session_id_t &session_id)
626
634
{
627
 
  Session::shared_ptr session= session::Cache::find(session_id);
 
635
  Session::shared_ptr session= session::Cache::singleton().find(session_id);
628
636
 
629
637
  if (session)
630
638
    unlink(session);
631
639
}
632
640
 
633
 
void Session::unlink(Session::shared_ptr &session)
 
641
void drizzled::Session::unlink(Session::shared_ptr &session)
634
642
{
635
643
  --connection_count;
636
644
 
637
645
  session->cleanup();
638
646
 
639
 
  boost::mutex::scoped_lock scopedLock(session::Cache::mutex());
 
647
  boost::mutex::scoped_lock scopedLock(session::Cache::singleton().mutex());
640
648
 
641
649
  if (unlikely(plugin::EventObserver::disconnectSession(*session)))
642
650
  {
643
651
    // We should do something about an error...
644
652
  }
645
 
  session::Cache::erase(session);
 
653
  session::Cache::singleton().erase(session);
646
654
}
647
655
 
648
656
 
656
664
 
657
665
 
658
666
 
659
 
const char *load_default_groups[]=
 
667
const char *load_default_groups[]= 
660
668
{
661
669
  DRIZZLE_CONFIG_NAME, "server", 0, 0
662
670
};
663
671
 
664
672
static void find_plugin_dir(string progname)
665
673
{
666
 
  fs::path full_progname(fs::system_complete(progname));
667
 
 
668
 
  fs::path progdir(full_progname.parent_path());
669
 
  if (progdir.filename() == ".libs")
670
 
  {
671
 
    progdir= progdir.parent_path();
672
 
  }
673
 
 
674
 
  if (fs::exists(progdir / "drizzled.lo") || fs::exists(progdir / "drizzled.o"))
 
674
  if (progname[0] != FN_LIBCHAR)
 
675
  {
 
676
    /* We have a relative path and need to find the absolute */
 
677
    char working_dir[FN_REFLEN];
 
678
    char *working_dir_ptr= working_dir;
 
679
    working_dir_ptr= getcwd(working_dir_ptr, FN_REFLEN);
 
680
    string new_path(working_dir);
 
681
    if (*(new_path.end()-1) != '/')
 
682
      new_path.push_back('/');
 
683
    if (progname[0] == '.' && progname[1] == '/')
 
684
      new_path.append(progname.substr(2));
 
685
    else
 
686
      new_path.append(progname);
 
687
    progname.swap(new_path);
 
688
  }
 
689
 
 
690
  /* Now, trim off the exe name */
 
691
  string progdir(progname.substr(0, progname.rfind(FN_LIBCHAR)+1));
 
692
  if (progdir.rfind(".libs/") != string::npos)
 
693
  {
 
694
    progdir.assign(progdir.substr(0, progdir.rfind(".libs/")));
 
695
  }
 
696
  string testlofile(progdir);
 
697
  testlofile.append("drizzled.lo");
 
698
  string testofile(progdir);
 
699
  testofile.append("drizzled.o");
 
700
  struct stat testfile_stat;
 
701
  if (not (stat(testlofile.c_str(), &testfile_stat) && stat(testofile.c_str(), &testfile_stat)))
675
702
  {
676
703
    /* We are in a source dir! Plugin dir is ../plugin/.libs */
677
 
    base_plugin_dir= progdir.parent_path();
 
704
    size_t last_libchar_pos= progdir.rfind(FN_LIBCHAR,progdir.size()-2)+1;
 
705
    base_plugin_dir= progdir.substr(0,last_libchar_pos);
678
706
    base_plugin_dir /= "plugin";
679
707
    base_plugin_dir /= ".libs";
680
708
  }
817
845
  global_system_variables.min_examined_row_limit= in_min_examined_row_limit;
818
846
}
819
847
 
820
 
static void check_limits_max_join_size(ha_rows in_max_join_size)
 
848
static void check_limits_max_join_size(drizzled::ha_rows in_max_join_size)
821
849
{
822
850
  global_system_variables.max_join_size= INT32_MAX;
823
851
  if ((uint64_t)in_max_join_size < 1 || (uint64_t)in_max_join_size > INT32_MAX)
1004
1032
 
1005
1033
static void check_limits_transaction_message_threshold(size_t in_transaction_message_threshold)
1006
1034
{
1007
 
  transaction_message_threshold= 1024*1024;
 
1035
  global_system_variables.transaction_message_threshold= 1024*1024;
1008
1036
  if ((int64_t) in_transaction_message_threshold < 128*1024 || (int64_t)in_transaction_message_threshold > 1024*1024)
1009
1037
  {
1010
1038
    cout << _("Error: Invalid Value for transaction_message_threshold valid values are between 131072 - 1048576 bytes");
1011
1039
    exit(-1);
1012
1040
  }
1013
 
  transaction_message_threshold= in_transaction_message_threshold;
 
1041
  global_system_variables.transaction_message_threshold= in_transaction_message_threshold;
1014
1042
}
1015
1043
 
1016
1044
static void process_defaults_files()
1017
1045
{
1018
 
        BOOST_FOREACH(vector<string>::reference iter, defaults_file_list)
 
1046
  for (vector<string>::iterator iter= defaults_file_list.begin();
 
1047
       iter != defaults_file_list.end();
 
1048
       ++iter)
1019
1049
  {
1020
 
    fs::path file_location= iter;
 
1050
    fs::path file_location= *iter;
1021
1051
 
1022
1052
    ifstream input_defaults_file(file_location.file_string().c_str());
1023
 
 
 
1053
    
1024
1054
    po::parsed_options file_parsed=
1025
1055
      dpo::parse_config_file(input_defaults_file, full_options, true);
1026
 
    vector<string> file_unknown=
 
1056
    vector<string> file_unknown= 
1027
1057
      po::collect_unrecognized(file_parsed.options, po::include_positional);
1028
1058
 
1029
1059
    for (vector<string>::iterator it= file_unknown.begin();
1033
1063
      string new_unknown_opt("--");
1034
1064
      new_unknown_opt.append(*it);
1035
1065
      ++it;
1036
 
      if (it == file_unknown.end())
1037
 
                                break;
1038
 
      if ((*it) != "true")
1039
 
      {
1040
 
        new_unknown_opt.push_back('=');
1041
 
        new_unknown_opt.append(*it);
 
1066
      if (it != file_unknown.end())
 
1067
      {
 
1068
        if ((*it) != "true")
 
1069
        {
 
1070
          new_unknown_opt.push_back('=');
 
1071
          new_unknown_opt.append(*it);
 
1072
        }
 
1073
      }
 
1074
      else
 
1075
      {
 
1076
        break;
1042
1077
      }
1043
1078
      unknown_options.push_back(new_unknown_opt);
1044
1079
    }
1048
1083
 
1049
1084
static void compose_defaults_file_list(vector<string> in_options)
1050
1085
{
1051
 
        BOOST_FOREACH(vector<string>::reference it, in_options)
 
1086
  for (vector<string>::iterator it= in_options.begin();
 
1087
       it != in_options.end();
 
1088
       ++it)
1052
1089
  {
1053
 
    fs::path p(it);
 
1090
    fs::path p(*it);
1054
1091
    if (fs::is_regular_file(p))
1055
 
      defaults_file_list.push_back(it);
 
1092
      defaults_file_list.push_back(*it);
1056
1093
    else
1057
1094
    {
1058
 
      errmsg_printf(error::ERROR, _("Defaults file '%s' not found\n"), it.c_str());
 
1095
      errmsg_printf(ERRMSG_LVL_ERROR,
 
1096
                  _("Defaults file '%s' not found\n"), (*it).c_str());
1059
1097
      unireg_abort(1);
1060
1098
    }
 
1099
 
1061
1100
  }
1062
1101
}
1063
1102
 
1064
 
int init_basic_variables(int argc, char **argv)
 
1103
int init_common_variables(int argc, char **argv, module::Registry &plugins)
1065
1104
{
1066
1105
  time_t curr_time;
1067
1106
  umask(((~internal::my_umask) & 0666));
1078
1117
  drizzle_init_variables();
1079
1118
 
1080
1119
  find_plugin_dir(argv[0]);
1081
 
 
1082
 
  char ret_hostname[FN_REFLEN];
1083
 
  if (gethostname(ret_hostname,sizeof(ret_hostname)) < 0)
1084
 
  {
1085
 
    errmsg_printf(error::WARN,
1086
 
                  _("gethostname failed, using '%s' as hostname"),
1087
 
                  getServerHostname().c_str());
 
1120
  {
 
1121
    struct tm tm_tmp;
 
1122
    localtime_r(&server_start_time,&tm_tmp);
 
1123
    strncpy(system_time_zone, tzname[tm_tmp.tm_isdst != 0 ? 1 : 0],
 
1124
            sizeof(system_time_zone)-1);
 
1125
 
 
1126
  }
 
1127
  /*
 
1128
    We set SYSTEM time zone as reasonable default and
 
1129
    also for failure of my_tz_init() and bootstrap mode.
 
1130
    If user explicitly set time zone with --default-time-zone
 
1131
    option we will change this value in my_tz_init().
 
1132
  */
 
1133
  global_system_variables.time_zone= my_tz_SYSTEM;
 
1134
 
 
1135
  if (gethostname(glob_hostname,sizeof(glob_hostname)) < 0)
 
1136
  {
 
1137
    strncpy(glob_hostname, STRING_WITH_LEN("localhost"));
 
1138
    errmsg_printf(ERRMSG_LVL_WARN, _("gethostname failed, using '%s' as hostname"),
 
1139
                  glob_hostname);
1088
1140
    pid_file= "drizzle";
1089
1141
  }
1090
1142
  else
1091
1143
  {
1092
 
    setServerHostname(ret_hostname);
1093
 
    pid_file= getServerHostname();
 
1144
    pid_file= glob_hostname;
1094
1145
  }
1095
1146
  pid_file.replace_extension(".pid");
1096
1147
 
1099
1150
  config_options.add_options()
1100
1151
  ("help,?", po::value<bool>(&opt_help)->default_value(false)->zero_tokens(),
1101
1152
  _("Display this help and exit."))
1102
 
  ("daemon,d", po::value<bool>(&opt_daemon)->default_value(false)->zero_tokens(),
1103
 
  _("Run as a daemon."))
1104
1153
  ("no-defaults", po::value<bool>()->default_value(false)->zero_tokens(),
1105
1154
  _("Configuration file defaults are not used if no-defaults is set"))
1106
1155
  ("defaults-file", po::value<vector<string> >()->composing()->notifier(&compose_defaults_file_list),
1115
1164
  ("plugin-add", po::value<vector<string> >()->composing()->notifier(&compose_plugin_add),
1116
1165
  _("Optional comma separated list of plugins to load at startup in addition "
1117
1166
     "to the default list of plugins. "
1118
 
     "[for example: --plugin_add=crc32,logger_gearman]"))
 
1167
     "[for example: --plugin_add=crc32,logger_gearman]"))    
1119
1168
  ("plugin-remove", po::value<vector<string> >()->composing()->notifier(&compose_plugin_remove),
1120
1169
  _("Optional comma separated list of plugins to not load at startup. Effectively "
1121
1170
     "removes a plugin from the list of plugins to be loaded. "
1137
1186
  ("chroot,r", po::value<string>(),
1138
1187
  _("Chroot drizzled daemon during startup."))
1139
1188
  ("collation-server", po::value<string>(),
1140
 
  _("Set the default collation."))
 
1189
  _("Set the default collation."))      
1141
1190
  ("completion-type", po::value<uint32_t>(&global_system_variables.completion_type)->default_value(0)->notifier(&check_limits_completion_type),
1142
1191
  _("Default completion type."))
1143
1192
  ("core-file",  _("Write core on errors."))
1144
 
  ("datadir", po::value<fs::path>(&getDataHome()),
 
1193
  ("datadir", po::value<fs::path>(&data_home),
1145
1194
  _("Path to the database root."))
1146
1195
  ("default-storage-engine", po::value<string>(),
1147
1196
  _("Set the default storage engine for tables."))
1154
1203
  ("lc-time-name", po::value<string>(),
1155
1204
  _("Set the language used for the month names and the days of the week."))
1156
1205
  ("log-warnings,W", po::value<bool>(&global_system_variables.log_warnings)->default_value(false)->zero_tokens(),
1157
 
  _("Log some not critical warnings to the log file."))
 
1206
  _("Log some not critical warnings to the log file."))  
1158
1207
  ("pid-file", po::value<fs::path>(&pid_file),
1159
1208
  _("Pid file used by drizzled."))
1160
1209
  ("port-open-timeout", po::value<uint32_t>(&drizzled_bind_timeout)->default_value(0),
1167
1216
  ("server-id", po::value<uint32_t>(&server_id)->default_value(0),
1168
1217
  _("Uniquely identifies the server instance in the community of "
1169
1218
     "replication partners."))
1170
 
  ("skip-stack-trace",
 
1219
  ("skip-stack-trace",  
1171
1220
  _("Don't print a stack trace on failure."))
1172
1221
  ("symbolic-links,s", po::value<bool>(&internal::my_use_symdir)->default_value(IF_PURIFY(false,true))->zero_tokens(),
1173
1222
  _("Enable symbolic link support."))
1174
1223
  ("timed-mutexes", po::value<bool>(&internal::timed_mutexes)->default_value(false)->zero_tokens(),
1175
1224
  _("Specify whether to time mutexes (only InnoDB mutexes are currently "
1176
 
     "supported)"))
 
1225
     "supported)")) 
1177
1226
  ("tmpdir,t", po::value<string>(),
1178
1227
  _("Path for temporary files."))
1179
1228
  ("transaction-isolation", po::value<string>(),
1180
1229
  _("Default transaction isolation level."))
1181
 
  ("transaction-message-threshold", po::value<size_t>(&transaction_message_threshold)->default_value(1024*1024)->notifier(&check_limits_transaction_message_threshold),
 
1230
  ("transaction-message-threshold", po::value<size_t>(&global_system_variables.transaction_message_threshold)->default_value(1024*1024)->notifier(&check_limits_transaction_message_threshold),
1182
1231
  _("Max message size written to transaction log, valid values 131072 - 1048576 bytes."))
1183
1232
  ("user,u", po::value<string>(),
1184
 
  _("Run drizzled daemon as user."))
1185
 
  ("version,V",
 
1233
  _("Run drizzled daemon as user."))  
 
1234
  ("version,V", 
1186
1235
  _("Output version information and exit."))
1187
1236
  ("back-log", po::value<back_log_constraints>(&back_log),
1188
1237
  _("The number of outstanding connection requests Drizzle can have. This "
1189
1238
     "comes into play when the main Drizzle thread gets very many connection "
1190
1239
     "requests in a very short time."))
1191
 
  ("bulk-insert-buffer-size",
 
1240
  ("bulk-insert-buffer-size", 
1192
1241
  po::value<uint64_t>(&global_system_variables.bulk_insert_buff_size)->default_value(8192*1024),
1193
1242
  _("Size of tree cache used in bulk insert optimization. Note that this is "
1194
1243
     "a limit per thread!"))
1208
1257
  _("Max number of errors/warnings to store for a statement."))
1209
1258
  ("max-heap-table-size", po::value<uint64_t>(&global_system_variables.max_heap_table_size)->default_value(16*1024*1024L)->notifier(&check_limits_mhts),
1210
1259
  _("Don't allow creation of heap tables bigger than this."))
1211
 
  ("max-join-size", po::value<ha_rows>(&global_system_variables.max_join_size)->default_value(INT32_MAX)->notifier(&check_limits_max_join_size),
 
1260
  ("max-join-size", po::value<drizzled::ha_rows>(&global_system_variables.max_join_size)->default_value(INT32_MAX)->notifier(&check_limits_max_join_size),
1212
1261
  _("Joins that are probably going to read more than max_join_size records "
1213
1262
     "return an error."))
1214
1263
  ("max-length-for-sort-data", po::value<uint64_t>(&global_system_variables.max_length_for_sort_data)->default_value(1024)->notifier(&check_limits_mlfsd),
1215
1264
  _("Max number of bytes in sorted records."))
1216
1265
  ("max-seeks-for-key", po::value<uint64_t>(&global_system_variables.max_seeks_for_key)->default_value(ULONG_MAX)->notifier(&check_limits_msfk),
1217
1266
  _("Limit assumed max number of seeks when looking up rows based on a key"))
1218
 
  ("max-sort-length", po::value<size_t>(&global_system_variables.max_sort_length)->default_value(1024)->notifier(&check_limits_max_sort_length),
 
1267
  ("max-sort-length", po::value<size_t>(&global_system_variables.max_sort_length)->default_value(1024)->notifier(&check_limits_max_sort_length),  
1219
1268
  _("The number of bytes to use when sorting BLOB or TEXT values "
1220
1269
     "(only the first max_sort_length bytes of each value are used; the "
1221
1270
     "rest are ignored)."))
1238
1287
     "testing/comparison)."))
1239
1288
  ("preload-buffer-size", po::value<uint64_t>(&global_system_variables.preload_buff_size)->default_value(32*1024L)->notifier(&check_limits_pbs),
1240
1289
  _("The size of the buffer that is allocated when preloading indexes"))
1241
 
  ("query-alloc-block-size",
 
1290
  ("query-alloc-block-size", 
1242
1291
  po::value<uint32_t>(&global_system_variables.query_alloc_block_size)->default_value(QUERY_ALLOC_BLOCK_SIZE)->notifier(&check_limits_qabs),
1243
1292
  _("Allocation block size for query parsing and execution"))
1244
1293
  ("query-prealloc-size",
1280
1329
     "error. Used only if the connection has active cursors."))
1281
1330
  ("thread-stack", po::value<size_t>(&my_thread_stack_size)->default_value(DEFAULT_THREAD_STACK)->notifier(&check_limits_thread_stack),
1282
1331
  _("The stack size for each thread."))
1283
 
  ("tmp-table-size",
 
1332
  ("tmp-table-size", 
1284
1333
  po::value<uint64_t>(&global_system_variables.tmp_table_size)->default_value(16*1024*1024L)->notifier(&check_limits_tmp_table_size),
1285
1334
  _("If an internal in-memory temporary table exceeds this size, Drizzle will"
1286
1335
     " automatically convert it to an on-disk MyISAM table."))
1287
 
  ("verbose", po::value<std::string>()->default_value(error::verbose_string())->notifier(&error::check_verbosity),
1288
 
  _("The verbosity of messages from drizzled.  Possible values are INSPECT, INFO, WARN or ERROR"))
1289
1336
  ;
1290
1337
 
1291
1338
  full_options.add(long_options);
1307
1354
  }
1308
1355
  catch (std::exception&)
1309
1356
  {
1310
 
    errmsg_printf(error::ERROR, _("Duplicate entry for command line option\n"));
 
1357
    errmsg_printf(ERRMSG_LVL_ERROR, _("Duplicate entry for command line option\n"));
1311
1358
    unireg_abort(1);
1312
1359
  }
1313
1360
 
1325
1372
    CachedDirectory config_conf_d(config_conf_d_location.file_string());
1326
1373
    if (not config_conf_d.fail())
1327
1374
    {
1328
 
                        BOOST_FOREACH(CachedDirectory::Entries::const_reference iter, config_conf_d.getEntries())
 
1375
 
 
1376
      for (CachedDirectory::Entries::const_iterator iter= config_conf_d.getEntries().begin();
 
1377
           iter != config_conf_d.getEntries().end();
 
1378
           ++iter)
1329
1379
      {
1330
 
        string file_entry(iter->filename);
 
1380
        string file_entry((*iter)->filename);
1331
1381
 
1332
1382
        if (not file_entry.empty()
1333
1383
            && file_entry != "."
1350
1400
  }
1351
1401
  catch (po::validation_error &err)
1352
1402
  {
1353
 
    errmsg_printf(error::ERROR,
 
1403
    errmsg_printf(ERRMSG_LVL_ERROR,  
1354
1404
                  _("%s: %s.\n"
1355
1405
                    "Use --help to get a list of available options\n"),
1356
1406
                  internal::my_progname, err.what());
1368
1418
  }
1369
1419
  catch (po::validation_error &err)
1370
1420
  {
1371
 
    errmsg_printf(error::ERROR,
 
1421
    errmsg_printf(ERRMSG_LVL_ERROR,
1372
1422
                  _("%s: %s.\n"
1373
1423
                    "Use --help to get a list of available options\n"),
1374
1424
                  internal::my_progname, err.what());
1375
1425
    unireg_abort(1);
1376
1426
  }
1377
1427
 
1378
 
  return 0;
1379
 
}
1380
 
 
1381
 
int init_remaining_variables(module::Registry &plugins)
1382
 
{
1383
 
  int style = po::command_line_style::default_style & ~po::command_line_style::allow_guessing;
1384
 
 
1385
 
  current_pid= getpid();                /* Save for later ref */
1386
 
 
1387
1428
  /* At this point, we've read all the options we need to read from files and
1388
1429
     collected most of them into unknown options - now let's load everything
1389
1430
  */
1390
1431
 
1391
1432
  if (plugin_init(plugins, plugin_options))
1392
1433
  {
1393
 
    errmsg_printf(error::ERROR, _("Failed to initialize plugins\n"));
 
1434
    errmsg_printf(ERRMSG_LVL_ERROR, _("Failed to initialize plugins\n"));
1394
1435
    unireg_abort(1);
1395
1436
  }
1396
1437
 
1411
1452
  }
1412
1453
  catch (po::validation_error &err)
1413
1454
  {
1414
 
    errmsg_printf(error::ERROR,
 
1455
    errmsg_printf(ERRMSG_LVL_ERROR,
1415
1456
                  _("%s: %s.\n"
1416
1457
                    "Use --help to get a list of available options\n"),
1417
1458
                  internal::my_progname, err.what());
1419
1460
  }
1420
1461
  catch (po::invalid_command_line_syntax &err)
1421
1462
  {
1422
 
    errmsg_printf(error::ERROR,
 
1463
    errmsg_printf(ERRMSG_LVL_ERROR,
1423
1464
                  _("%s: %s.\n"
1424
1465
                    "Use --help to get a list of available options\n"),
1425
1466
                  internal::my_progname, err.what());
1427
1468
  }
1428
1469
  catch (po::unknown_option &err)
1429
1470
  {
1430
 
    errmsg_printf(error::ERROR,
 
1471
    errmsg_printf(ERRMSG_LVL_ERROR,
1431
1472
                  _("%s\nUse --help to get a list of available options\n"),
1432
1473
                  err.what());
1433
1474
    unireg_abort(1);
1439
1480
  }
1440
1481
  catch (po::validation_error &err)
1441
1482
  {
1442
 
    errmsg_printf(error::ERROR,
 
1483
    errmsg_printf(ERRMSG_LVL_ERROR,  
1443
1484
                  _("%s: %s.\n"
1444
1485
                    "Use --help to get a list of available options\n"),
1445
1486
                  internal::my_progname, err.what());
1450
1491
 
1451
1492
  /* Inverted Booleans */
1452
1493
 
1453
 
  global_system_variables.optimizer_prune_level= not vm.count("disable-optimizer-prune");
 
1494
  global_system_variables.optimizer_prune_level=
 
1495
    vm.count("disable-optimizer-prune") ? false : true;
1454
1496
 
1455
 
  if (! vm["help"].as<bool>())
 
1497
  if (vm.count("help") == 0 && vm.count("help-extended") == 0)
1456
1498
  {
1457
1499
    if ((user_info= check_user(drizzled_user)))
1458
1500
    {
1462
1504
 
1463
1505
  fix_paths();
1464
1506
 
 
1507
  current_pid= getpid();                /* Save for later ref */
1465
1508
  init_time();                          /* Init time-functions (read zone) */
1466
1509
 
1467
1510
  if (item_create_init())
1475
1518
  if (!(default_charset_info=
1476
1519
        get_charset_by_csname(default_character_set_name, MY_CS_PRIMARY)))
1477
1520
  {
1478
 
    errmsg_printf(error::ERROR, _("Error getting default charset"));
 
1521
    errmsg_printf(ERRMSG_LVL_ERROR, _("Error getting default charset"));
1479
1522
    return 1;                           // Eof of the list
1480
1523
  }
1481
1524
 
1484
1527
 
1485
1528
  if (default_collation_name)
1486
1529
  {
1487
 
    const charset_info_st * const default_collation= get_charset_by_name(default_collation_name);
 
1530
    const CHARSET_INFO * const default_collation= get_charset_by_name(default_collation_name);
1488
1531
    if (not default_collation)
1489
1532
    {
1490
 
      errmsg_printf(error::ERROR, _(ER(ER_UNKNOWN_COLLATION)), default_collation_name);
 
1533
      errmsg_printf(ERRMSG_LVL_ERROR, _(ER(ER_UNKNOWN_COLLATION)), default_collation_name);
1491
1534
      return 1;
1492
1535
    }
1493
1536
    if (not my_charset_same(default_charset_info, default_collation))
1494
1537
    {
1495
 
      errmsg_printf(error::ERROR, _(ER(ER_COLLATION_CHARSET_MISMATCH)),
 
1538
      errmsg_printf(ERRMSG_LVL_ERROR, _(ER(ER_COLLATION_CHARSET_MISMATCH)),
1496
1539
                    default_collation_name,
1497
1540
                    default_charset_info->csname);
1498
1541
      return 1;
1505
1548
  if (not (character_set_filesystem=
1506
1549
           get_charset_by_csname(character_set_filesystem_name, MY_CS_PRIMARY)))
1507
1550
  {
1508
 
    errmsg_printf(error::ERROR, _("Error setting collation"));
 
1551
    errmsg_printf(ERRMSG_LVL_ERROR, _("Error setting collation"));
1509
1552
    return 1;
1510
1553
  }
1511
1554
  global_system_variables.character_set_filesystem= character_set_filesystem;
1513
1556
  if (!(my_default_lc_time_names=
1514
1557
        my_locale_by_name(lc_time_names_name)))
1515
1558
  {
1516
 
    errmsg_printf(error::ERROR, _("Unknown locale: '%s'"), lc_time_names_name);
 
1559
    errmsg_printf(ERRMSG_LVL_ERROR, _("Unknown locale: '%s'"), lc_time_names_name);
1517
1560
    return 1;
1518
1561
  }
1519
1562
  global_system_variables.lc_time_names= my_default_lc_time_names;
1533
1576
  */
1534
1577
  if (table_cache_init())
1535
1578
  {
1536
 
    errmsg_printf(error::ERROR, _("Could not initialize table cache\n"));
 
1579
    errmsg_printf(ERRMSG_LVL_ERROR, _("Could not initialize table cache\n"));
1537
1580
    unireg_abort(1);
1538
1581
  }
1539
1582
 
1540
1583
  // Resize the definition Cache at startup
1541
 
  table::Cache::rehash(table_def_size);
1542
 
  definition::Cache::rehash(table_def_size);
 
1584
  table::Cache::singleton().rehash(table_def_size);
 
1585
  definition::Cache::singleton().rehash(table_def_size);
1543
1586
  message::Cache::singleton().rehash(table_def_size);
1544
1587
 
1545
1588
  setup_fpu();
1546
1589
 
 
1590
  /* Setup logs */
 
1591
 
 
1592
  if (xid_cache_init())
 
1593
  {
 
1594
    errmsg_printf(ERRMSG_LVL_ERROR, _("XA cache initialization failed: Out of memory\n"));
 
1595
    unireg_abort(1);
 
1596
  }
 
1597
 
1547
1598
  /* Allow storage engine to give real error messages */
1548
1599
  ha_init_errors();
1549
1600
 
1564
1615
  else
1565
1616
  {
1566
1617
    scheduler_name= opt_scheduler_default;
1567
 
    opt_scheduler= opt_scheduler_default;
 
1618
    opt_scheduler= opt_scheduler_default; 
1568
1619
  }
1569
1620
 
1570
1621
  if (plugin::Scheduler::setPlugin(scheduler_name))
1571
1622
  {
1572
 
      errmsg_printf(error::ERROR,
 
1623
      errmsg_printf(ERRMSG_LVL_ERROR,
1573
1624
                   _("No scheduler found, cannot continue!\n"));
1574
1625
      unireg_abort(1);
1575
1626
  }
1594
1645
    engine= plugin::StorageEngine::findByName(name);
1595
1646
    if (engine == NULL)
1596
1647
    {
1597
 
      errmsg_printf(error::ERROR, _("Unknown/unsupported storage engine: %s\n"),
 
1648
      errmsg_printf(ERRMSG_LVL_ERROR, _("Unknown/unsupported storage engine: %s\n"),
1598
1649
                    default_storage_engine_str);
1599
1650
      unireg_abort(1);
1600
1651
    }
1620
1671
enum options_drizzled
1621
1672
{
1622
1673
  OPT_SOCKET=256,
1623
 
  OPT_BIND_ADDRESS,
 
1674
  OPT_BIND_ADDRESS,            
1624
1675
  OPT_PID_FILE,
1625
 
  OPT_STORAGE_ENGINE,
 
1676
  OPT_STORAGE_ENGINE,          
1626
1677
  OPT_INIT_FILE,
1627
1678
  OPT_WANT_CORE,
1628
1679
  OPT_MEMLOCK,
1688
1739
  {"help", '?', N_("Display this help and exit."),
1689
1740
   (char**) &opt_help, (char**) &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
1690
1741
   0, 0},
1691
 
  {"daemon", 'd', N_("Run as daemon."),
1692
 
   (char**) &opt_daemon, (char**) &opt_daemon, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
1693
 
   0, 0},
1694
1742
  {"auto-increment-increment", OPT_AUTO_INCREMENT,
1695
1743
   N_("Auto-increment columns are incremented by this"),
1696
1744
   (char**) &global_system_variables.auto_increment_increment,
1994
2042
         "and you are welcome to modify and redistribute it under the GPL "
1995
2043
         "license\n\n"));
1996
2044
 
1997
 
 
 
2045
 
1998
2046
  printf(_("Usage: %s [OPTIONS]\n"), internal::my_progname);
1999
2047
 
2000
2048
  po::options_description all_options("Drizzled Options");
2044
2092
 
2045
2093
  /* Things with default values that are not zero */
2046
2094
  session_startup_options= (OPTION_AUTO_IS_NULL | OPTION_SQL_NOTES);
2047
 
  g_refresh_version= 1L;        /* Increments on each reload */
 
2095
  refresh_version= 1L;  /* Increments on each reload */
2048
2096
  global_thread_id= 1UL;
2049
 
  session::Cache::getCache().clear();
 
2097
  session::Cache::singleton().getCache().clear();
2050
2098
 
2051
2099
  /* Variables in libraries */
2052
2100
  default_character_set_name= "utf8";
2108
2156
 
2109
2157
  fs::path &data_home_catalog= getDataHomeCatalog();
2110
2158
  data_home_catalog= getDataHome();
2111
 
  data_home_catalog /= "local";
 
2159
  data_home_catalog /= "local"; 
2112
2160
 
2113
2161
  if (vm.count("user"))
2114
2162
  {
2116
2164
      drizzled_user= (char *)vm["user"].as<string>().c_str();
2117
2165
 
2118
2166
    else
2119
 
      errmsg_printf(error::WARN, _("Ignoring user change to '%s' because the user was "
 
2167
      errmsg_printf(ERRMSG_LVL_WARN, _("Ignoring user change to '%s' because the user was "
2120
2168
                                       "set to '%s' earlier on the command line\n"),
2121
2169
                    vm["user"].as<string>().c_str(), drizzled_user);
2122
2170
  }
2130
2178
  if (vm.count("sort-heap-threshold"))
2131
2179
  {
2132
2180
    if ((vm["sort-heap-threshold"].as<uint64_t>() > 0) and
2133
 
      (vm["sort-heap-threshold"].as<uint64_t>() <
 
2181
      (vm["sort-heap-threshold"].as<uint64_t>() < 
2134
2182
      global_system_variables.sortbuff_size))
2135
2183
    {
2136
2184
      cout << _("Error: sort-heap-threshold cannot be less than sort-buffer-size") << endl;
2204
2252
 
2205
2253
  if (vm.count("transaction-isolation"))
2206
2254
  {
2207
 
    int type= tx_isolation_typelib.find_type_or_exit(vm["transaction-isolation"].as<string>().c_str(), "transaction-isolation");
2208
 
    global_system_variables.tx_isolation= type - 1;
 
2255
    int type;
 
2256
    type= find_type_or_exit((char *)vm["transaction-isolation"].as<string>().c_str(), &tx_isolation_typelib, "transaction-isolation");
 
2257
    global_system_variables.tx_isolation= (type-1);
2209
2258
  }
2210
2259
 
2211
2260
  /* @TODO Make this all strings */
2260
2309
 
2261
2310
  if (not opt_help)
2262
2311
  {
2263
 
    const char *tmp_string= getenv("TMPDIR");
 
2312
    const char *tmp_string= getenv("TMPDIR") ? getenv("TMPDIR") : NULL;
2264
2313
    struct stat buf;
2265
2314
    drizzle_tmpdir.clear();
2266
2315
 
2286
2335
    {
2287
2336
      if (errno != EEXIST)
2288
2337
      {
2289
 
        errmsg_printf(error::ERROR, _("There was an error creating the '%s' part of the path '%s'.  Please check the path exists and is writable.\n"), fs::path(drizzle_tmpdir).leaf().c_str(), drizzle_tmpdir.c_str());
 
2338
        errmsg_printf(ERRMSG_LVL_ERROR, _("There was an error creating the '%s' part of the path '%s'.  Please check the path exists and is writable.\n"), fs::path(drizzle_tmpdir).leaf().c_str(), drizzle_tmpdir.c_str());
2290
2339
        exit(1);
2291
2340
      }
2292
2341
    }
2293
2342
 
2294
2343
    if (stat(drizzle_tmpdir.c_str(), &buf) || (S_ISDIR(buf.st_mode) == false))
2295
2344
    {
2296
 
      errmsg_printf(error::ERROR, _("There was an error opening the path '%s', please check the path exists and is writable.\n"), drizzle_tmpdir.c_str());
 
2345
      errmsg_printf(ERRMSG_LVL_ERROR, _("There was an error opening the path '%s', please check the path exists and is writable.\n"), drizzle_tmpdir.c_str());
2297
2346
      exit(1);
2298
2347
    }
2299
2348
  }