~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/drizzled.cc

Merge Andrew - fix bug #663765: Some unittests are won't compile in GCC 4.5
Merge Andrew - Add a GLOBAL UPPER bound to cap SORT BUFFER memory use

Show diffs side-by-side

added added

removed removed

Lines of Context:
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"
69
70
 
70
71
#include "drizzled/plugin/event_observer.h"
71
72
 
352
353
 
353
354
atomic<uint32_t> connection_count;
354
355
 
 
356
global_buffer_constraint<uint64_t> global_sort_buffer(0);
 
357
global_buffer_constraint<uint64_t> global_join_buffer(0);
 
358
global_buffer_constraint<uint64_t> global_read_rnd_buffer(0);
 
359
global_buffer_constraint<uint64_t> global_read_buffer(0);
 
360
 
355
361
/** 
356
362
  Refresh value. We use to test this to find out if a refresh even has happened recently.
357
363
*/
1300
1306
  N_("The maximum length of the result of function  group_concat."))
1301
1307
  ("join-buffer-size", po::value<uint64_t>(&global_system_variables.join_buff_size)->default_value(128*1024L)->notifier(&check_limits_join_buffer_size),
1302
1308
  N_("The size of the buffer that is used for full joins."))
 
1309
  ("join-heap-threshold",
 
1310
  po::value<uint64_t>()->default_value(0),
 
1311
  N_("A global cap on the amount of memory that can be allocated by session join buffers (0 means unlimited)"))
1303
1312
  ("max-allowed-packet", po::value<uint32_t>(&global_system_variables.max_allowed_packet)->default_value(64*1024*1024L)->notifier(&check_limits_map),
1304
1313
  N_("Max packetlength to send/receive from to server."))
1305
1314
  ("max-connect-errors", po::value<uint64_t>(&max_connect_errors)->default_value(MAX_CONNECT_ERRORS)->notifier(&check_limits_mce),
1353
1362
  N_("Each thread that does a sequential scan allocates a buffer of this "
1354
1363
      "size for each table it scans. If you do many sequential scans, you may "
1355
1364
      "want to increase this value."))
 
1365
  ("read-buffer-threshold",
 
1366
  po::value<uint64_t>()->default_value(0),
 
1367
  N_("A global cap on the size of read-buffer-size (0 means unlimited)"))
1356
1368
  ("read-rnd-buffer-size",
1357
1369
  po::value<uint32_t>(&global_system_variables.read_rnd_buff_size)->default_value(256*1024L)->notifier(&check_limits_read_rnd_buffer_size),
1358
1370
  N_("When reading rows in sorted order after a sort, the rows are read "
1359
1371
     "through this buffer to avoid a disk seeks. If not set, then it's set "
1360
1372
     "to the value of record_buffer."))
 
1373
  ("read-rnd-threshold",
 
1374
  po::value<uint64_t>()->default_value(0),
 
1375
  N_("A global cap on the size of read-rnd-buffer-size (0 means unlimited)"))
1361
1376
  ("scheduler", po::value<string>(),
1362
1377
  N_("Select scheduler to be used (by default multi-thread)."))
1363
1378
  ("sort-buffer-size",
1364
1379
  po::value<size_t>(&global_system_variables.sortbuff_size)->default_value(MAX_SORT_MEMORY)->notifier(&check_limits_sort_buffer_size),
1365
1380
  N_("Each thread that needs to do a sort allocates a buffer of this size."))
 
1381
  ("sort-heap-threshold",
 
1382
  po::value<uint64_t>()->default_value(0),
 
1383
  N_("A global cap on the amount of memory that can be allocated by session sort buffers (0 means unlimited)"))
1366
1384
  ("table-definition-cache", po::value<size_t>(&table_def_size)->default_value(128)->notifier(&check_limits_tdc),
1367
1385
  N_("The number of cached table definitions."))
1368
1386
  ("table-open-cache", po::value<uint64_t>(&table_cache_size)->default_value(TABLE_OPEN_CACHE_DEFAULT)->notifier(&check_limits_toc),
2256
2274
    exit(0);
2257
2275
  }
2258
2276
 
 
2277
  if (vm.count("sort-heap-threshold"))
 
2278
  {
 
2279
    if ((vm["sort-heap-threshold"].as<uint64_t>() > 0) and
 
2280
      (vm["sort-heap-threshold"].as<uint64_t>() < 
 
2281
      global_system_variables.sortbuff_size))
 
2282
    {
 
2283
      cout << N_("Error: sort-heap-threshold cannot be less than sort-buffer-size") << endl;
 
2284
      exit(-1);
 
2285
    }
 
2286
 
 
2287
    global_sort_buffer.setMaxSize(vm["sort-heap-threshold"].as<uint64_t>());
 
2288
  }
 
2289
 
 
2290
  if (vm.count("join-heap-threshold"))
 
2291
  {
 
2292
    if ((vm["join-heap-threshold"].as<uint64_t>() > 0) and
 
2293
      (vm["join-heap-threshold"].as<uint64_t>() <
 
2294
      global_system_variables.join_buff_size))
 
2295
    {
 
2296
      cout << N_("Error: join-heap-threshold cannot be less than join-buffer-size") << endl;
 
2297
      exit(-1);
 
2298
    }
 
2299
 
 
2300
    global_join_buffer.setMaxSize(vm["join-heap-threshold"].as<uint64_t>());
 
2301
  }
 
2302
 
 
2303
  if (vm.count("read-rnd-threshold"))
 
2304
  {
 
2305
    if ((vm["read-rnd-threshold"].as<uint64_t>() > 0) and
 
2306
      (vm["read-rnd-threshold"].as<uint64_t>() <
 
2307
      global_system_variables.read_rnd_buff_size))
 
2308
    {
 
2309
      cout << N_("Error: read-rnd-threshold cannot be less than read-rnd-buffer-size") << endl;
 
2310
      exit(-1);
 
2311
    }
 
2312
 
 
2313
    global_read_rnd_buffer.setMaxSize(vm["read-rnd-threshold"].as<uint64_t>());
 
2314
  }
 
2315
 
 
2316
  if (vm.count("read-buffer-threshold"))
 
2317
  {
 
2318
    if ((vm["read-buffer-threshold"].as<uint64_t>() > 0) and
 
2319
      (vm["read-buffer-threshold"].as<uint64_t>() <
 
2320
      global_system_variables.read_buff_size))
 
2321
    {
 
2322
      cout << N_("Error: read-buffer-threshold cannot be less than read-buffer-size") << endl;
 
2323
      exit(-1);
 
2324
    }
 
2325
 
 
2326
    global_read_buffer.setMaxSize(vm["read-buffer-threshold"].as<uint64_t>());
 
2327
  }
 
2328
 
2259
2329
  if (vm.count("exit-info"))
2260
2330
  {
2261
2331
    if (vm["exit-info"].as<long>())