~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/drizzled.cc

  • Committer: Lee Bieber
  • Date: 2010-11-15 04:50:59 UTC
  • mfrom: (1931.1.2 build)
  • Revision ID: kalebral@gmail.com-20101115045059-syjxk4sjrwmkz2sf
Merge Andrew - fix bug 674381: global_status test failure
Merge Monty - fix bug 669635: Boolean options in config file require a value while command line does not 
Merge Monty- fix bug #669707: Crash from boost::condition_variable assert fail when datadir is not full path

Show diffs side-by-side

added added

removed removed

Lines of Context:
1046
1046
  global_system_variables.transaction_message_threshold= in_transaction_message_threshold;
1047
1047
}
1048
1048
 
1049
 
static pair<string, string> parse_size_suffixes(string s)
1050
 
{
1051
 
  size_t equal_pos= s.find("=");
1052
 
  if (equal_pos != string::npos)
1053
 
  {
1054
 
    string arg_key(s.substr(0, equal_pos));
1055
 
    string arg_val(s.substr(equal_pos+1));
1056
 
 
1057
 
    try
1058
 
    {
1059
 
      size_t size_suffix_pos= arg_val.find_last_of("kmgKMG");
1060
 
      if (size_suffix_pos == arg_val.size()-1)
1061
 
      {
1062
 
        char suffix= arg_val[size_suffix_pos];
1063
 
        string size_val(arg_val.substr(0, size_suffix_pos));
1064
 
 
1065
 
        uint64_t base_size= boost::lexical_cast<uint64_t>(size_val);
1066
 
        uint64_t new_size= 0;
1067
 
 
1068
 
        switch (suffix)
1069
 
        {
1070
 
        case 'K':
1071
 
        case 'k':
1072
 
          new_size= base_size * 1024;
1073
 
          break;
1074
 
        case 'M':
1075
 
        case 'm':
1076
 
          new_size= base_size * 1024 * 1024;
1077
 
          break;
1078
 
        case 'G':
1079
 
        case 'g':
1080
 
          new_size= base_size * 1024 * 1024 * 1024;
1081
 
          break;
1082
 
        }
1083
 
        return make_pair(arg_key,
1084
 
                         boost::lexical_cast<string>(new_size));
1085
 
      }
1086
 
    }
1087
 
    catch (...)
1088
 
    {
1089
 
      /* Screw it, let the normal parser take over */
1090
 
    }
1091
 
  }
1092
 
 
1093
 
  return make_pair(string(""), string(""));
1094
 
}
1095
 
 
1096
 
static pair<string, string> parse_size_arg(string s)
1097
 
{
1098
 
  if (s.find("--") == 0)
1099
 
  {
1100
 
    return parse_size_suffixes(s.substr(2));
1101
 
  }
1102
 
  return make_pair(string(""), string(""));
1103
 
}
1104
 
 
1105
1049
static void process_defaults_files()
1106
1050
{
1107
1051
  for (vector<string>::iterator iter= defaults_file_list.begin();
1502
1446
  {
1503
1447
    po::parsed_options final_parsed=
1504
1448
      po::command_line_parser(unknown_options).style(style).
1505
 
      options(full_options).extra_parser(parse_size_arg).run();
 
1449
      options(full_options).extra_parser(dpo::parse_size_arg).run();
1506
1450
 
1507
1451
    final_unknown_options=
1508
1452
      po::collect_unrecognized(final_parsed.options, po::include_positional);
2408
2352
    pid_file_path= getDataHome();
2409
2353
    pid_file_path /= pid_file;
2410
2354
  }
2411
 
  pid_file= pid_file_path;
 
2355
  pid_file= fs::system_complete(pid_file_path);
2412
2356
 
2413
2357
  if (not opt_help)
2414
2358
  {