~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/drizzled.cc

  • Committer: Brian Aker
  • Date: 2010-10-15 05:30:39 UTC
  • mfrom: (1843.8.7 trunk-drizzle)
  • Revision ID: brian@tangent.org-20101015053039-ebmv3hnn1yaq4wqy
Merge in refactoring on table (broken it up by type, this will allow me to
insert the new locking).

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
#include "drizzled/plugin/monitored_in_transaction.h"
61
61
#include "drizzled/replication_services.h" /* For ReplicationServices::evaluateRegisteredPlugins() */
62
62
#include "drizzled/probes.h"
63
 
#include "drizzled/session/cache.h"
 
63
#include "drizzled/session_list.h"
64
64
#include "drizzled/charset.h"
65
65
#include "plugin/myisam/myisam.h"
66
66
#include "drizzled/drizzled.h"
67
67
#include "drizzled/module/registry.h"
68
68
#include "drizzled/module/load_list.h"
69
 
#include "drizzled/global_buffer.h"
70
 
 
71
 
#include "drizzled/definition/cache.h"
72
69
 
73
70
#include "drizzled/plugin/event_observer.h"
74
71
 
75
 
#include "drizzled/message/cache.h"
76
 
 
77
72
#include <google/protobuf/stubs/common.h>
78
73
 
79
74
#if TIME_WITH_SYS_TIME
130
125
#endif
131
126
 
132
127
#include "drizzled/internal/my_pthread.h"                       // For thr_setconcurency()
133
 
#include "drizzled/constrained_value.h"
134
128
 
135
129
#include <drizzled/gettext.h>
136
130
 
137
131
 
138
 
#ifdef HAVE_VALGRIND
 
132
#ifdef HAVE_purify
139
133
#define IF_PURIFY(A,B) (A)
140
134
#else
141
135
#define IF_PURIFY(A,B) (B)
250
244
uint32_t dropping_tables, ha_open_options;
251
245
uint32_t tc_heuristic_recover= 0;
252
246
uint64_t session_startup_options;
253
 
back_log_constraints back_log(50);
 
247
uint32_t back_log;
254
248
uint32_t server_id;
255
249
uint64_t table_cache_size;
256
250
size_t table_def_size;
326
320
 
327
321
FILE *stderror_file=0;
328
322
 
329
 
struct drizzle_system_variables global_system_variables;
330
 
struct drizzle_system_variables max_system_variables;
 
323
struct system_variables global_system_variables;
 
324
struct system_variables max_system_variables;
331
325
struct global_counters current_global_counters;
332
326
 
333
327
const CHARSET_INFO *system_charset_info, *files_charset_info ;
339
333
SHOW_COMP_OPTION have_symlink;
340
334
 
341
335
/* Thread specific variables */
 
336
 
 
337
boost::mutex LOCK_open;
342
338
boost::mutex LOCK_global_system_variables;
 
339
boost::mutex LOCK_thread_count;
343
340
 
344
341
boost::condition_variable_any COND_refresh;
345
342
boost::condition_variable COND_thread_count;
354
351
 
355
352
atomic<uint32_t> connection_count;
356
353
 
357
 
global_buffer_constraint<uint64_t> global_sort_buffer(0);
358
 
global_buffer_constraint<uint64_t> global_join_buffer(0);
359
 
global_buffer_constraint<uint64_t> global_read_rnd_buffer(0);
360
 
global_buffer_constraint<uint64_t> global_read_buffer(0);
361
 
 
362
354
/** 
363
355
  Refresh value. We use to test this to find out if a refresh even has happened recently.
364
356
*/
417
409
 
418
410
  /* kill connection thread */
419
411
  {
420
 
    boost::mutex::scoped_lock scopedLock(session::Cache::singleton().mutex());
 
412
    boost::mutex::scoped_lock scopedLock(LOCK_thread_count);
421
413
 
422
414
    while (select_thread_in_use)
423
415
    {
441
433
    statements and inform their clients that the server is about to die.
442
434
  */
443
435
 
 
436
  Session *tmp;
 
437
 
444
438
  {
445
 
    boost::mutex::scoped_lock scopedLock(session::Cache::singleton().mutex());
446
 
    session::Cache::list list= session::Cache::singleton().getCache();
447
 
 
448
 
    for (session::Cache::list::iterator it= list.begin(); it != list.end(); ++it )
 
439
    boost::mutex::scoped_lock scoped(LOCK_thread_count);
 
440
    for( SessionList::iterator it= getSessionList().begin(); it != getSessionList().end(); ++it )
449
441
    {
450
 
      Session::shared_ptr tmp(*it);
451
 
 
452
 
      tmp->setKilled(Session::KILL_CONNECTION);
453
 
      tmp->scheduler->killSession(tmp.get());
 
442
      tmp= *it;
 
443
      tmp->killed= Session::KILL_CONNECTION;
 
444
      tmp->scheduler->killSession(tmp);
454
445
      DRIZZLE_CONNECTION_DONE(tmp->thread_id);
455
 
 
456
446
      tmp->lockOnSys();
457
447
    }
458
448
  }
459
449
 
460
 
  if (session::Cache::singleton().count())
 
450
  if (connection_count)
461
451
    sleep(2);                                   // Give threads time to die
462
452
 
463
453
  /*
467
457
  */
468
458
  for (;;)
469
459
  {
470
 
    boost::mutex::scoped_lock scopedLock(session::Cache::singleton().mutex());
471
 
    session::Cache::list list= session::Cache::singleton().getCache();
472
 
 
473
 
    if (list.empty())
 
460
    boost::mutex::scoped_lock scoped(LOCK_thread_count);
 
461
    if (getSessionList().empty())
474
462
    {
475
463
      break;
476
464
    }
 
465
    tmp= getSessionList().front();
477
466
    /* Close before unlock, avoiding crash. See LP bug#436685 */
478
 
    list.front()->client->close();
 
467
    tmp->client->close();
479
468
  }
480
469
}
481
470
 
514
503
 
515
504
  if (print_message && server_start_time)
516
505
    errmsg_printf(ERRMSG_LVL_INFO, _(ER(ER_SHUTDOWN_COMPLETE)),internal::my_progname);
517
 
  {
518
 
    boost::mutex::scoped_lock scopedLock(session::Cache::singleton().mutex());
519
 
    ready_to_exit= true;
520
 
 
521
 
    /* do the broadcast inside the lock to ensure that my_end() is not called */
522
 
    COND_server_end.notify_all();
523
 
  }
 
506
  LOCK_thread_count.lock();
 
507
  ready_to_exit=1;
 
508
  /* do the broadcast inside the lock to ensure that my_end() is not called */
 
509
  COND_server_end.notify_all();
 
510
  LOCK_thread_count.unlock();
524
511
 
525
512
  /*
526
513
    The following lines may never be executed as the main thread may have
550
537
    }
551
538
    return NULL;
552
539
  }
553
 
  if (not user)
 
540
  if (!user)
554
541
  {
555
542
      errmsg_printf(ERRMSG_LVL_ERROR, _("Fatal error: Please read \"Security\" section of "
556
543
                      "the manual to find out how to run drizzled as root!\n"));
626
613
  SYNOPSIS
627
614
    Session::unlink()
628
615
    session              Thread handler
 
616
 
 
617
  NOTES
 
618
    LOCK_thread_count is locked and left locked
629
619
*/
630
620
 
631
 
void drizzled::Session::unlink(Session::shared_ptr &session)
 
621
void Session::unlink(Session *session)
632
622
{
633
623
  connection_count.decrement();
634
624
 
635
625
  session->cleanup();
636
626
 
637
 
  boost::mutex::scoped_lock scopedLock(session::Cache::singleton().mutex());
 
627
  boost::mutex::scoped_lock scoped(LOCK_thread_count);
 
628
  session->lockForDelete();
638
629
 
 
630
  getSessionList().erase(remove(getSessionList().begin(),
 
631
                         getSessionList().end(),
 
632
                         session));
639
633
  if (unlikely(plugin::EventObserver::disconnectSession(*session)))
640
634
  {
641
635
    // We should do something about an error...
642
636
  }
643
 
  session::Cache::singleton().erase(session);
 
637
 
 
638
  delete session;
644
639
}
645
640
 
646
641
 
754
749
  global_system_variables.completion_type= in_completion_type;
755
750
}
756
751
 
 
752
static void check_limits_back_log(uint32_t in_back_log)
 
753
{
 
754
  back_log= 50;
 
755
  if (in_back_log < 1 || in_back_log > 65535)
 
756
  {
 
757
    cout << N_("Error: Invalid Value for back_log");
 
758
    exit(-1);
 
759
  }
 
760
  back_log= in_back_log;
 
761
}
757
762
 
758
763
static void check_limits_dpi(uint32_t in_div_precincrement)
759
764
{
791
796
 
792
797
static void check_limits_map(uint32_t in_max_allowed_packet)
793
798
{
794
 
  global_system_variables.max_allowed_packet= (64*1024*1024L);
 
799
  global_system_variables.max_allowed_packet= (1024*1024L);
795
800
  if (in_max_allowed_packet < 1024 || in_max_allowed_packet > 1024*1024L*1024L)
796
801
  {
797
802
    cout << N_("Error: Invalid Value for max_allowed_packet");
1042
1047
  global_system_variables.transaction_message_threshold= in_transaction_message_threshold;
1043
1048
}
1044
1049
 
 
1050
static pair<string, string> parse_size_suffixes(string s)
 
1051
{
 
1052
  size_t equal_pos= s.find("=");
 
1053
  if (equal_pos != string::npos)
 
1054
  {
 
1055
    string arg_key(s.substr(0, equal_pos));
 
1056
    string arg_val(s.substr(equal_pos+1));
 
1057
 
 
1058
    try
 
1059
    {
 
1060
      size_t size_suffix_pos= arg_val.find_last_of("kmgKMG");
 
1061
      if (size_suffix_pos == arg_val.size()-1)
 
1062
      {
 
1063
        char suffix= arg_val[size_suffix_pos];
 
1064
        string size_val(arg_val.substr(0, size_suffix_pos));
 
1065
 
 
1066
        uint64_t base_size= boost::lexical_cast<uint64_t>(size_val);
 
1067
        uint64_t new_size= 0;
 
1068
 
 
1069
        switch (suffix)
 
1070
        {
 
1071
        case 'K':
 
1072
        case 'k':
 
1073
          new_size= base_size * 1024;
 
1074
          break;
 
1075
        case 'M':
 
1076
        case 'm':
 
1077
          new_size= base_size * 1024 * 1024;
 
1078
          break;
 
1079
        case 'G':
 
1080
        case 'g':
 
1081
          new_size= base_size * 1024 * 1024 * 1024;
 
1082
          break;
 
1083
        }
 
1084
        return make_pair(arg_key,
 
1085
                         boost::lexical_cast<string>(new_size));
 
1086
      }
 
1087
    }
 
1088
    catch (...)
 
1089
    {
 
1090
      /* Screw it, let the normal parser take over */
 
1091
    }
 
1092
  }
 
1093
 
 
1094
  return make_pair(string(""), string(""));
 
1095
}
 
1096
 
 
1097
static pair<string, string> parse_size_arg(string s)
 
1098
{
 
1099
  if (s.find("--") == 0)
 
1100
  {
 
1101
    return parse_size_suffixes(s.substr(2));
 
1102
  }
 
1103
  return make_pair(string(""), string(""));
 
1104
}
 
1105
 
1045
1106
static void process_defaults_files()
1046
1107
{
1047
1108
  for (vector<string>::iterator iter= defaults_file_list.begin();
1048
1109
       iter != defaults_file_list.end();
1049
1110
       ++iter)
1050
1111
  {
1051
 
    fs::path file_location= *iter;
 
1112
    fs::path file_location(system_config_dir);
 
1113
    if ((*iter)[0] != '/')
 
1114
    {
 
1115
      /* Relative path - add config dir */
 
1116
      file_location /= *iter;
 
1117
    }
 
1118
    else
 
1119
    {
 
1120
      file_location= *iter;
 
1121
    }
1052
1122
 
1053
1123
    ifstream input_defaults_file(file_location.file_string().c_str());
1054
1124
    
1088
1158
       it != in_options.end();
1089
1159
       ++it)
1090
1160
  {
1091
 
    fs::path p(*it);
1092
 
    if (fs::is_regular_file(p))
1093
 
      defaults_file_list.push_back(*it);
1094
 
    else
1095
 
    {
1096
 
      errmsg_printf(ERRMSG_LVL_ERROR,
1097
 
                  _("Defaults file '%s' not found\n"), (*it).c_str());
1098
 
      unireg_abort(1);
1099
 
    }
1100
 
 
 
1161
    defaults_file_list.push_back(*it);
1101
1162
  }
1102
1163
}
1103
1164
 
1147
1208
  pid_file.replace_extension(".pid");
1148
1209
 
1149
1210
  system_config_dir /= "drizzle";
 
1211
  std::string system_config_file_drizzle("drizzled.cnf");
1150
1212
 
1151
1213
  config_options.add_options()
1152
1214
  ("help,?", po::value<bool>(&opt_help)->default_value(false)->zero_tokens(),
1209
1271
  N_("Pid file used by drizzled."))
1210
1272
  ("port-open-timeout", po::value<uint32_t>(&drizzled_bind_timeout)->default_value(0),
1211
1273
  N_("Maximum time in seconds to wait for the port to become free. "))
1212
 
  ("replicate-query", po::value<bool>(&global_system_variables.replicate_query)->default_value(false)->zero_tokens(),
1213
 
  N_("Include the SQL query in replicated protobuf messages."))
1214
1274
  ("secure-file-priv", po::value<fs::path>(&secure_file_priv)->notifier(expand_secure_file_priv),
1215
1275
  N_("Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files "
1216
1276
     "within specified directory"))
1234
1294
  N_("Run drizzled daemon as user."))  
1235
1295
  ("version,V", 
1236
1296
  N_("Output version information and exit."))
1237
 
  ("back-log", po::value<back_log_constraints>(&back_log),
 
1297
  ("back-log", po::value<uint32_t>(&back_log)->default_value(50)->notifier(&check_limits_back_log),
1238
1298
  N_("The number of outstanding connection requests Drizzle can have. This "
1239
1299
     "comes into play when the main Drizzle thread gets very many connection "
1240
1300
     "requests in a very short time."))
1249
1309
  N_("The maximum length of the result of function  group_concat."))
1250
1310
  ("join-buffer-size", po::value<uint64_t>(&global_system_variables.join_buff_size)->default_value(128*1024L)->notifier(&check_limits_join_buffer_size),
1251
1311
  N_("The size of the buffer that is used for full joins."))
1252
 
  ("join-heap-threshold",
1253
 
  po::value<uint64_t>()->default_value(0),
1254
 
  N_("A global cap on the amount of memory that can be allocated by session join buffers (0 means unlimited)"))
1255
 
  ("max-allowed-packet", po::value<uint32_t>(&global_system_variables.max_allowed_packet)->default_value(64*1024*1024L)->notifier(&check_limits_map),
 
1312
  ("max-allowed-packet", po::value<uint32_t>(&global_system_variables.max_allowed_packet)->default_value(1024*1024L)->notifier(&check_limits_map),
1256
1313
  N_("Max packetlength to send/receive from to server."))
1257
1314
  ("max-connect-errors", po::value<uint64_t>(&max_connect_errors)->default_value(MAX_CONNECT_ERRORS)->notifier(&check_limits_mce),
1258
1315
  N_("If there is more than this number of interrupted connections from a "
1305
1362
  N_("Each thread that does a sequential scan allocates a buffer of this "
1306
1363
      "size for each table it scans. If you do many sequential scans, you may "
1307
1364
      "want to increase this value."))
1308
 
  ("read-buffer-threshold",
1309
 
  po::value<uint64_t>()->default_value(0),
1310
 
  N_("A global cap on the size of read-buffer-size (0 means unlimited)"))
1311
1365
  ("read-rnd-buffer-size",
1312
1366
  po::value<uint32_t>(&global_system_variables.read_rnd_buff_size)->default_value(256*1024L)->notifier(&check_limits_read_rnd_buffer_size),
1313
1367
  N_("When reading rows in sorted order after a sort, the rows are read "
1314
1368
     "through this buffer to avoid a disk seeks. If not set, then it's set "
1315
1369
     "to the value of record_buffer."))
1316
 
  ("read-rnd-threshold",
1317
 
  po::value<uint64_t>()->default_value(0),
1318
 
  N_("A global cap on the size of read-rnd-buffer-size (0 means unlimited)"))
1319
1370
  ("scheduler", po::value<string>(),
1320
1371
  N_("Select scheduler to be used (by default multi-thread)."))
1321
1372
  ("sort-buffer-size",
1322
1373
  po::value<size_t>(&global_system_variables.sortbuff_size)->default_value(MAX_SORT_MEMORY)->notifier(&check_limits_sort_buffer_size),
1323
1374
  N_("Each thread that needs to do a sort allocates a buffer of this size."))
1324
 
  ("sort-heap-threshold",
1325
 
  po::value<uint64_t>()->default_value(0),
1326
 
  N_("A global cap on the amount of memory that can be allocated by session sort buffers (0 means unlimited)"))
1327
1375
  ("table-definition-cache", po::value<size_t>(&table_def_size)->default_value(128)->notifier(&check_limits_tdc),
1328
1376
  N_("The number of cached table definitions."))
1329
1377
  ("table-open-cache", po::value<uint64_t>(&table_cache_size)->default_value(TABLE_OPEN_CACHE_DEFAULT)->notifier(&check_limits_toc),
1356
1404
  {
1357
1405
    po::store(parsed, vm);
1358
1406
  }
1359
 
  catch (std::exception&)
 
1407
  catch (...)
1360
1408
  {
1361
1409
    errmsg_printf(ERRMSG_LVL_ERROR, _("Duplicate entry for command line option\n"));
1362
1410
    unireg_abort(1);
1364
1412
 
1365
1413
  if (not vm["no-defaults"].as<bool>())
1366
1414
  {
1367
 
    fs::path system_config_file_drizzle(system_config_dir);
1368
 
    system_config_file_drizzle /= "drizzled.cnf";
1369
1415
    defaults_file_list.insert(defaults_file_list.begin(),
1370
 
                              system_config_file_drizzle.file_string());
1371
 
 
1372
 
    fs::path config_conf_d_location(system_config_dir);
1373
 
    config_conf_d_location /= "conf.d";
1374
 
 
1375
 
 
1376
 
    CachedDirectory config_conf_d(config_conf_d_location.file_string());
1377
 
    if (not config_conf_d.fail())
 
1416
                              system_config_file_drizzle);
 
1417
  }
 
1418
 
 
1419
  fs::path config_conf_d_location(system_config_dir);
 
1420
  config_conf_d_location /= "conf.d";
 
1421
 
 
1422
  CachedDirectory config_conf_d(config_conf_d_location.file_string());
 
1423
  if (not config_conf_d.fail())
 
1424
  {
 
1425
 
 
1426
    for (CachedDirectory::Entries::const_iterator iter= config_conf_d.getEntries().begin();
 
1427
         iter != config_conf_d.getEntries().end();
 
1428
         ++iter)
1378
1429
    {
1379
 
 
1380
 
      for (CachedDirectory::Entries::const_iterator iter= config_conf_d.getEntries().begin();
1381
 
           iter != config_conf_d.getEntries().end();
1382
 
           ++iter)
 
1430
      string file_entry((*iter)->filename);
 
1431
          
 
1432
      if (not file_entry.empty()
 
1433
          && file_entry != "."
 
1434
          && file_entry != "..")
1383
1435
      {
1384
 
        string file_entry((*iter)->filename);
1385
 
 
1386
 
        if (not file_entry.empty()
1387
 
            && file_entry != "."
1388
 
            && file_entry != "..")
1389
 
        {
1390
 
          fs::path the_entry(config_conf_d_location);
1391
 
          the_entry /= file_entry;
1392
 
          defaults_file_list.push_back(the_entry.file_string());
1393
 
        }
 
1436
        fs::path the_entry(config_conf_d_location);
 
1437
        the_entry /= file_entry;
 
1438
        defaults_file_list.push_back(the_entry.file_string());
1394
1439
      }
1395
1440
    }
1396
1441
  }
1397
1442
 
 
1443
  process_defaults_files();
1398
1444
  /* TODO: here is where we should add a process_env_vars */
1399
1445
 
1400
1446
  /* We need a notify here so that plugin_init will work properly */
1401
 
  try
1402
 
  {
1403
 
    po::notify(vm);
1404
 
  }
1405
 
  catch (po::validation_error &err)
1406
 
  {
1407
 
    errmsg_printf(ERRMSG_LVL_ERROR,  
1408
 
                  _("%s: %s.\n"
1409
 
                    "Use --help to get a list of available options\n"),
1410
 
                  internal::my_progname, err.what());
1411
 
    unireg_abort(1);
1412
 
  }
1413
 
 
1414
 
  process_defaults_files();
1415
 
 
1416
 
  /* Process with notify a second time because a config file may contain
1417
 
     plugin loader options */
1418
 
 
1419
 
  try
1420
 
  {
1421
 
    po::notify(vm);
1422
 
  }
1423
 
  catch (po::validation_error &err)
1424
 
  {
1425
 
    errmsg_printf(ERRMSG_LVL_ERROR,
1426
 
                  _("%s: %s.\n"
1427
 
                    "Use --help to get a list of available options\n"),
1428
 
                  internal::my_progname, err.what());
1429
 
    unireg_abort(1);
1430
 
  }
1431
 
 
 
1447
  po::notify(vm);
1432
1448
  /* At this point, we've read all the options we need to read from files and
1433
1449
     collected most of them into unknown options - now let's load everything
1434
1450
  */
1446
1462
  {
1447
1463
    po::parsed_options final_parsed=
1448
1464
      po::command_line_parser(unknown_options).style(style).
1449
 
      options(full_options).extra_parser(dpo::parse_size_arg).run();
 
1465
      options(full_options).extra_parser(parse_size_arg).run();
1450
1466
 
1451
1467
    final_unknown_options=
1452
1468
      po::collect_unrecognized(final_parsed.options, po::include_positional);
1454
1470
    po::store(final_parsed, vm);
1455
1471
 
1456
1472
  }
1457
 
  catch (po::validation_error &err)
1458
 
  {
1459
 
    errmsg_printf(ERRMSG_LVL_ERROR,
1460
 
                  _("%s: %s.\n"
1461
 
                    "Use --help to get a list of available options\n"),
1462
 
                  internal::my_progname, err.what());
1463
 
    unireg_abort(1);
1464
 
  }
1465
1473
  catch (po::invalid_command_line_syntax &err)
1466
1474
  {
1467
1475
    errmsg_printf(ERRMSG_LVL_ERROR,
1478
1486
    unireg_abort(1);
1479
1487
  }
1480
1488
 
1481
 
  try
1482
 
  {
1483
 
    po::notify(vm);
1484
 
  }
1485
 
  catch (po::validation_error &err)
1486
 
  {
1487
 
    errmsg_printf(ERRMSG_LVL_ERROR,  
1488
 
                  _("%s: %s.\n"
1489
 
                    "Use --help to get a list of available options\n"),
1490
 
                  internal::my_progname, err.what());
1491
 
    unireg_abort(1);
1492
 
  }
 
1489
  po::notify(vm);
1493
1490
 
1494
1491
  get_options();
1495
1492
 
1513
1510
 
1514
1511
  if (item_create_init())
1515
1512
    return 1;
1516
 
  if (sys_var_init())
 
1513
  if (set_var_init())
1517
1514
    return 1;
1518
1515
  /* Creates static regex matching for temporal values */
1519
1516
  if (! init_temporal_formats())
1583
1580
    errmsg_printf(ERRMSG_LVL_ERROR, _("Could not initialize table cache\n"));
1584
1581
    unireg_abort(1);
1585
1582
  }
1586
 
 
1587
 
  // Resize the definition Cache at startup
1588
 
  table::Cache::singleton().rehash(table_def_size);
1589
 
  definition::Cache::singleton().rehash(table_def_size);
1590
 
  message::Cache::singleton().rehash(table_def_size);
 
1583
  TableShare::cacheStart();
1591
1584
 
1592
1585
  setup_fpu();
1593
1586
 
1894
1887
   N_("Max packetlength to send/receive from to server."),
1895
1888
   (char**) &global_system_variables.max_allowed_packet,
1896
1889
   (char**) &max_system_variables.max_allowed_packet, 0, GET_UINT32,
1897
 
   REQUIRED_ARG, 64*1024*1024L, 1024, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
 
1890
   REQUIRED_ARG, 1024*1024L, 1024, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
1898
1891
  {"max_connect_errors", OPT_MAX_CONNECT_ERRORS,
1899
1892
   N_("If there is more than this number of interrupted connections from a "
1900
1893
      "host this host will be blocked from further connections."),
2139
2132
  session_startup_options= (OPTION_AUTO_IS_NULL | OPTION_SQL_NOTES);
2140
2133
  refresh_version= 1L;  /* Increments on each reload */
2141
2134
  global_thread_id= 1UL;
2142
 
  session::Cache::singleton().getCache().clear();
 
2135
  getSessionList().clear();
2143
2136
 
2144
2137
  /* Variables in libraries */
2145
2138
  default_character_set_name= "utf8";
2222
2215
    exit(0);
2223
2216
  }
2224
2217
 
2225
 
  if (vm.count("sort-heap-threshold"))
2226
 
  {
2227
 
    if ((vm["sort-heap-threshold"].as<uint64_t>() > 0) and
2228
 
      (vm["sort-heap-threshold"].as<uint64_t>() < 
2229
 
      global_system_variables.sortbuff_size))
2230
 
    {
2231
 
      cout << N_("Error: sort-heap-threshold cannot be less than sort-buffer-size") << endl;
2232
 
      exit(-1);
2233
 
    }
2234
 
 
2235
 
    global_sort_buffer.setMaxSize(vm["sort-heap-threshold"].as<uint64_t>());
2236
 
  }
2237
 
 
2238
 
  if (vm.count("join-heap-threshold"))
2239
 
  {
2240
 
    if ((vm["join-heap-threshold"].as<uint64_t>() > 0) and
2241
 
      (vm["join-heap-threshold"].as<uint64_t>() <
2242
 
      global_system_variables.join_buff_size))
2243
 
    {
2244
 
      cout << N_("Error: join-heap-threshold cannot be less than join-buffer-size") << endl;
2245
 
      exit(-1);
2246
 
    }
2247
 
 
2248
 
    global_join_buffer.setMaxSize(vm["join-heap-threshold"].as<uint64_t>());
2249
 
  }
2250
 
 
2251
 
  if (vm.count("read-rnd-threshold"))
2252
 
  {
2253
 
    if ((vm["read-rnd-threshold"].as<uint64_t>() > 0) and
2254
 
      (vm["read-rnd-threshold"].as<uint64_t>() <
2255
 
      global_system_variables.read_rnd_buff_size))
2256
 
    {
2257
 
      cout << N_("Error: read-rnd-threshold cannot be less than read-rnd-buffer-size") << endl;
2258
 
      exit(-1);
2259
 
    }
2260
 
 
2261
 
    global_read_rnd_buffer.setMaxSize(vm["read-rnd-threshold"].as<uint64_t>());
2262
 
  }
2263
 
 
2264
 
  if (vm.count("read-buffer-threshold"))
2265
 
  {
2266
 
    if ((vm["read-buffer-threshold"].as<uint64_t>() > 0) and
2267
 
      (vm["read-buffer-threshold"].as<uint64_t>() <
2268
 
      global_system_variables.read_buff_size))
2269
 
    {
2270
 
      cout << N_("Error: read-buffer-threshold cannot be less than read-buffer-size") << endl;
2271
 
      exit(-1);
2272
 
    }
2273
 
 
2274
 
    global_read_buffer.setMaxSize(vm["read-buffer-threshold"].as<uint64_t>());
2275
 
  }
2276
 
 
2277
2218
  if (vm.count("exit-info"))
2278
2219
  {
2279
2220
    if (vm["exit-info"].as<long>())
2352
2293
    pid_file_path= getDataHome();
2353
2294
    pid_file_path /= pid_file;
2354
2295
  }
2355
 
  pid_file= fs::system_complete(pid_file_path);
 
2296
  pid_file= pid_file_path;
2356
2297
 
2357
2298
  if (not opt_help)
2358
2299
  {