Merge lp:~linuxjedi/drizzle/drizzle-global-buffer-limits into lp:drizzle/7.0

Proposed by Andrew Hutchings
Status: Merged
Approved by: Lee Bieber
Approved revision: 1823
Merged at revision: 1907
Proposed branch: lp:~linuxjedi/drizzle/drizzle-global-buffer-limits
Merge into: lp:drizzle/7.0
Diff against target: 855 lines (+442/-12)
28 files modified
client/errname.cc (+4/-1)
docs/options.rst (+21/-1)
drizzled/drizzled.cc (+70/-0)
drizzled/drizzled.h (+7/-1)
drizzled/enum.h (+5/-1)
drizzled/error.cc (+4/-0)
drizzled/filesort.cc (+17/-1)
drizzled/global_buffer.h (+69/-0)
drizzled/include.am (+1/-0)
drizzled/internal/mf_iocache.cc (+15/-0)
drizzled/join_cache.cc (+9/-0)
drizzled/records.cc (+8/-0)
drizzled/sql_select.cc (+5/-0)
tests/include/setup-global-constraints.inc (+32/-0)
tests/r/global_read_constraints.result (+32/-0)
tests/r/global_read_rnd_constraints.result (+1/-0)
tests/r/global_sort_join_constraints.result (+30/-0)
tests/t/global_read_constraints-master.opt (+1/-0)
tests/t/global_read_constraints.test (+9/-0)
tests/t/global_read_rnd_constraints-master.opt (+1/-0)
tests/t/global_read_rnd_constraints.test (+19/-0)
tests/t/global_sort_join_constraints-master.opt (+1/-0)
tests/t/global_sort_join_constraints.test (+13/-0)
unittests/atomics_test.cc (+2/-2)
unittests/global_buffer_test.cc (+60/-0)
unittests/include.am (+1/-0)
unittests/pthread_atomics_test.cc (+2/-2)
unittests/utf8_test.cc (+3/-3)
To merge this branch: bzr merge lp:~linuxjedi/drizzle/drizzle-global-buffer-limits
Reviewer Review Type Date Requested Status
Brian Aker Needs Fixing
Review via email: mp+39793@code.launchpad.net

Description of the change

Adds global buffer constraints (see blueprint)
Also fixes a GCC 4.5 bug in some unittests and a minor docs change

To post a comment you must log in.
Revision history for this message
Brian Aker (brianaker) wrote :
review: Needs Fixing
Revision history for this message
Andrew Hutchings (linuxjedi) wrote :

Doh! Silly mistake which broke 32bit, fixed now

Revision history for this message
Andrew Hutchings (linuxjedi) wrote :
Revision history for this message
Andrew Hutchings (linuxjedi) wrote :

bug#670496 is a show stopper for the test cases

Revision history for this message
Andrew Hutchings (linuxjedi) wrote :

OK, test cases should now work

Revision history for this message
Lee Bieber (kalebral-deactivatedaccount) wrote :

Tests are still failing on OSX, Centos, FreedBSD and OpenSUSE

Revision history for this message
Andrew Hutchings (linuxjedi) wrote :

OK, fixed a problem found with join buffer constraint accounting.
Had to disable 2 tests as drizzleslap now gives unpredictable results if a query errors (which is the condition we are trying to test here).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'client/errname.cc'
--- client/errname.cc 2010-09-08 22:31:17 +0000
+++ client/errname.cc 2010-11-05 13:28:56 +0000
@@ -735,7 +735,10 @@
735 { "ER_UNKNOWN_SCHEMA_OPTION", 1699},735 { "ER_UNKNOWN_SCHEMA_OPTION", 1699},
736 { "ER_EVENT_OBSERVER_PLUGIN", 1700},736 { "ER_EVENT_OBSERVER_PLUGIN", 1700},
737 { "ER_CORRUPT_SCHEMA_DEFINITION", 1701},737 { "ER_CORRUPT_SCHEMA_DEFINITION", 1701},
738 { "ER_UNUSED1702", 1702},738 { "ER_OUT_OF_GLOBAL_SORTMEMORY", 1702},
739 { "ER_OUT_OF_GLOBAL_JOINMEMORY", 1703},
740 { "ER_OUT_OF_GLOBAL_READRNDMEMORY", 1704},
741 { "ER_OUT_OF_GLOBAL_READMEMORY", 1705},
739 { 0, 0 }742 { 0, 0 }
740 };743 };
741744
742745
=== modified file 'docs/options.rst'
--- docs/options.rst 2010-09-30 16:54:59 +0000
+++ docs/options.rst 2010-11-05 13:28:56 +0000
@@ -178,8 +178,13 @@
178178
179 The size of the buffer that is used for full joins.179 The size of the buffer that is used for full joins.
180180
181.. option:: --join-buffer-constraint arg (=0)
182
183 A global constraint for join-buffer-size for all clients, cannot be set lower
184 than --join-buffer-size. Setting to 0 means unlimited.
185
181.. Why is this a core arg?186.. Why is this a core arg?
182.. option:: --max-allowed-packet arg (=1M)187.. option:: --max-allowed-packet arg (=64M)
183188
184 Max packetlength to send/receive from to server.189 Max packetlength to send/receive from to server.
185190
@@ -259,12 +264,22 @@
259 each table it scans. If you do many sequential scans, you may want to264 each table it scans. If you do many sequential scans, you may want to
260 increase this value.265 increase this value.
261266
267.. option:: --read-buffer-constraint arg (=0)
268
269 A global constraint for read-buffer-size for all clients, cannot be set lower
270 than --read-buffer-size. Setting to 0 means unlimited.
271
262.. option:: --read-rnd-buffer-size arg (=262144)272.. option:: --read-rnd-buffer-size arg (=262144)
263273
264 When reading rows in sorted order after a sort, the rows are read through274 When reading rows in sorted order after a sort, the rows are read through
265 this buffer to avoid a disk seeks. If not set, then it's set to the value of275 this buffer to avoid a disk seeks. If not set, then it's set to the value of
266 record_buffer.276 record_buffer.
267277
278.. option:: --read-rnd-constraint arg (=0)
279
280 A global constraint for read-rnd-buffer-size for all clients, cannot be set
281 lower than --read-rnd-buffer-size. Setting to 0 means unlimited.
282
268.. option:: --scheduler arg (=multi-thread)283.. option:: --scheduler arg (=multi-thread)
269284
270 Select scheduler to be used.285 Select scheduler to be used.
@@ -273,6 +288,11 @@
273288
274 Each thread that needs to do a sort allocates a buffer of this size.289 Each thread that needs to do a sort allocates a buffer of this size.
275290
291.. option:: --sort-buffer-constraint arg (=0)
292
293 A global constraint for sort-buffer-size for all clients, cannot be set lower
294 than --sort-buffer-size. Setting to 0 means unlimited.
295
276.. option:: --table-definition-cache arg (=128)296.. option:: --table-definition-cache arg (=128)
277297
278 The number of cached table definitions.298 The number of cached table definitions.
279299
=== modified file 'drizzled/drizzled.cc'
--- drizzled/drizzled.cc 2010-10-28 05:22:47 +0000
+++ drizzled/drizzled.cc 2010-11-05 13:28:56 +0000
@@ -66,6 +66,7 @@
66#include "drizzled/drizzled.h"66#include "drizzled/drizzled.h"
67#include "drizzled/module/registry.h"67#include "drizzled/module/registry.h"
68#include "drizzled/module/load_list.h"68#include "drizzled/module/load_list.h"
69#include "drizzled/global_buffer.h"
6970
70#include "drizzled/plugin/event_observer.h"71#include "drizzled/plugin/event_observer.h"
7172
@@ -352,6 +353,11 @@
352353
353atomic<uint32_t> connection_count;354atomic<uint32_t> connection_count;
354355
356global_buffer_constraint<uint64_t> global_sort_buffer(0);
357global_buffer_constraint<uint64_t> global_join_buffer(0);
358global_buffer_constraint<uint64_t> global_read_rnd_buffer(0);
359global_buffer_constraint<uint64_t> global_read_buffer(0);
360
355/** 361/**
356 Refresh value. We use to test this to find out if a refresh even has happened recently.362 Refresh value. We use to test this to find out if a refresh even has happened recently.
357*/363*/
@@ -1300,6 +1306,9 @@
1300 N_("The maximum length of the result of function group_concat."))1306 N_("The maximum length of the result of function group_concat."))
1301 ("join-buffer-size", po::value<uint64_t>(&global_system_variables.join_buff_size)->default_value(128*1024L)->notifier(&check_limits_join_buffer_size),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 N_("The size of the buffer that is used for full joins."))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 ("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(64*1024*1024L)->notifier(&check_limits_map),
1304 N_("Max packetlength to send/receive from to server."))1313 N_("Max packetlength to send/receive from to server."))
1305 ("max-connect-errors", po::value<uint64_t>(&max_connect_errors)->default_value(MAX_CONNECT_ERRORS)->notifier(&check_limits_mce),1314 ("max-connect-errors", po::value<uint64_t>(&max_connect_errors)->default_value(MAX_CONNECT_ERRORS)->notifier(&check_limits_mce),
@@ -1353,16 +1362,25 @@
1353 N_("Each thread that does a sequential scan allocates a buffer of this "1362 N_("Each thread that does a sequential scan allocates a buffer of this "
1354 "size for each table it scans. If you do many sequential scans, you may "1363 "size for each table it scans. If you do many sequential scans, you may "
1355 "want to increase this value."))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 ("read-rnd-buffer-size",1368 ("read-rnd-buffer-size",
1357 po::value<uint32_t>(&global_system_variables.read_rnd_buff_size)->default_value(256*1024L)->notifier(&check_limits_read_rnd_buffer_size),1369 po::value<uint32_t>(&global_system_variables.read_rnd_buff_size)->default_value(256*1024L)->notifier(&check_limits_read_rnd_buffer_size),
1358 N_("When reading rows in sorted order after a sort, the rows are read "1370 N_("When reading rows in sorted order after a sort, the rows are read "
1359 "through this buffer to avoid a disk seeks. If not set, then it's set "1371 "through this buffer to avoid a disk seeks. If not set, then it's set "
1360 "to the value of record_buffer."))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 ("scheduler", po::value<string>(),1376 ("scheduler", po::value<string>(),
1362 N_("Select scheduler to be used (by default multi-thread)."))1377 N_("Select scheduler to be used (by default multi-thread)."))
1363 ("sort-buffer-size",1378 ("sort-buffer-size",
1364 po::value<size_t>(&global_system_variables.sortbuff_size)->default_value(MAX_SORT_MEMORY)->notifier(&check_limits_sort_buffer_size),1379 po::value<size_t>(&global_system_variables.sortbuff_size)->default_value(MAX_SORT_MEMORY)->notifier(&check_limits_sort_buffer_size),
1365 N_("Each thread that needs to do a sort allocates a buffer of this size."))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 ("table-definition-cache", po::value<size_t>(&table_def_size)->default_value(128)->notifier(&check_limits_tdc),1384 ("table-definition-cache", po::value<size_t>(&table_def_size)->default_value(128)->notifier(&check_limits_tdc),
1367 N_("The number of cached table definitions."))1385 N_("The number of cached table definitions."))
1368 ("table-open-cache", po::value<uint64_t>(&table_cache_size)->default_value(TABLE_OPEN_CACHE_DEFAULT)->notifier(&check_limits_toc),1386 ("table-open-cache", po::value<uint64_t>(&table_cache_size)->default_value(TABLE_OPEN_CACHE_DEFAULT)->notifier(&check_limits_toc),
@@ -2256,6 +2274,58 @@
2256 exit(0);2274 exit(0);
2257 }2275 }
22582276
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 if (vm.count("exit-info"))2329 if (vm.count("exit-info"))
2260 {2330 {
2261 if (vm["exit-info"].as<long>())2331 if (vm["exit-info"].as<long>())
22622332
=== modified file 'drizzled/drizzled.h'
--- drizzled/drizzled.h 2010-09-27 07:06:04 +0000
+++ drizzled/drizzled.h 2010-11-05 13:28:56 +0000
@@ -25,7 +25,8 @@
25#include <boost/program_options.hpp>25#include <boost/program_options.hpp>
2626
27#include "drizzled/atomics.h"27#include "drizzled/atomics.h"
2828#include "drizzled/global_buffer.h"
29#include "drizzled/definitions.h"
29struct passwd;30struct passwd;
3031
31namespace drizzled32namespace drizzled
@@ -47,6 +48,11 @@
47extern passwd *user_info;48extern passwd *user_info;
48extern char *drizzled_user;49extern char *drizzled_user;
4950
51extern global_buffer_constraint<uint64_t> global_sort_buffer;
52extern global_buffer_constraint<uint64_t> global_join_buffer;
53extern global_buffer_constraint<uint64_t> global_read_rnd_buffer;
54extern global_buffer_constraint<uint64_t> global_read_buffer;
55
50extern const char * const DRIZZLE_CONFIG_NAME;56extern const char * const DRIZZLE_CONFIG_NAME;
5157
52boost::program_options::variables_map &getVariablesMap();58boost::program_options::variables_map &getVariablesMap();
5359
=== modified file 'drizzled/enum.h'
--- drizzled/enum.h 2010-09-08 22:31:17 +0000
+++ drizzled/enum.h 2010-11-05 13:28:56 +0000
@@ -1044,7 +1044,11 @@
1044 ER_UNKNOWN_SCHEMA_OPTION,1044 ER_UNKNOWN_SCHEMA_OPTION,
1045 ER_EVENT_OBSERVER_PLUGIN,1045 ER_EVENT_OBSERVER_PLUGIN,
1046 ER_CORRUPT_SCHEMA_DEFINITION,1046 ER_CORRUPT_SCHEMA_DEFINITION,
1047 ER_ERROR_LAST= ER_CORRUPT_SCHEMA_DEFINITION1047 ER_OUT_OF_GLOBAL_SORTMEMORY,
1048 ER_OUT_OF_GLOBAL_JOINMEMORY,
1049 ER_OUT_OF_GLOBAL_READRNDMEMORY,
1050 ER_OUT_OF_GLOBAL_READMEMORY,
1051 ER_ERROR_LAST= ER_OUT_OF_GLOBAL_READMEMORY
1048};1052};
10491053
1050enum drizzle_exit_codes {1054enum drizzle_exit_codes {
10511055
=== modified file 'drizzled/error.cc'
--- drizzled/error.cc 2010-10-14 18:58:48 +0000
+++ drizzled/error.cc 2010-11-05 13:28:56 +0000
@@ -235,6 +235,10 @@
235 add(ER_OPEN_AS_READONLY, N_("Table '%-.192s' is read only"));235 add(ER_OPEN_AS_READONLY, N_("Table '%-.192s' is read only"));
236 add(ER_OUTOFMEMORY, N_("Out of memory; restart server and try again (needed %lu bytes)"));236 add(ER_OUTOFMEMORY, N_("Out of memory; restart server and try again (needed %lu bytes)"));
237 add(ER_OUT_OF_SORTMEMORY, N_("Out of sort memory; increase server sort buffer size"));237 add(ER_OUT_OF_SORTMEMORY, N_("Out of sort memory; increase server sort buffer size"));
238 add(ER_OUT_OF_GLOBAL_SORTMEMORY, N_("Global sort memory constraint hit; increase sort-heap-threshold"));
239 add(ER_OUT_OF_GLOBAL_JOINMEMORY, N_("Global join memory constraint hit; increase join-heap-threshold"));
240 add(ER_OUT_OF_GLOBAL_READRNDMEMORY, N_("Global read_rnd memory constraint hit; increase read-rnd-heap-threshold"));
241 add(ER_OUT_OF_GLOBAL_READMEMORY, N_("Global read memory constraint hit; increase read-buffer-threshold"));
238 add(ER_UNEXPECTED_EOF, N_("Unexpected EOF found when reading file '%-.192s' (errno: %d)"));242 add(ER_UNEXPECTED_EOF, N_("Unexpected EOF found when reading file '%-.192s' (errno: %d)"));
239 add(ER_CON_COUNT_ERROR, N_("Too many connections"));243 add(ER_CON_COUNT_ERROR, N_("Too many connections"));
240 add(ER_OUT_OF_RESOURCES, N_("Out of memory; check if drizzled or some other process uses all available memory; if not, you may have to use 'ulimit' to allow drizzled to use more memory or you can add more swap space"));244 add(ER_OUT_OF_RESOURCES, N_("Out of memory; check if drizzled or some other process uses all available memory; if not, you may have to use 'ulimit' to allow drizzled to use more memory or you can add more swap space"));
241245
=== modified file 'drizzled/filesort.cc'
--- drizzled/filesort.cc 2010-10-30 01:19:00 +0000
+++ drizzled/filesort.cc 2010-11-05 13:28:56 +0000
@@ -29,6 +29,7 @@
29#include <queue>29#include <queue>
30#include <algorithm>30#include <algorithm>
3131
32#include "drizzled/drizzled.h"
32#include "drizzled/sql_sort.h"33#include "drizzled/sql_sort.h"
33#include "drizzled/error.h"34#include "drizzled/error.h"
34#include "drizzled/probes.h"35#include "drizzled/probes.h"
@@ -41,6 +42,8 @@
41#include "drizzled/internal/my_sys.h"42#include "drizzled/internal/my_sys.h"
42#include "plugin/myisam/myisam.h"43#include "plugin/myisam/myisam.h"
43#include "drizzled/plugin/transactional_storage_engine.h"44#include "drizzled/plugin/transactional_storage_engine.h"
45#include "drizzled/atomics.h"
46#include "drizzled/global_buffer.h"
4447
45using namespace std;48using namespace std;
4649
@@ -136,8 +139,9 @@
136 bool sort_positions, ha_rows *examined_rows)139 bool sort_positions, ha_rows *examined_rows)
137{140{
138 int error;141 int error;
139 uint32_t memavl, min_sort_memory;142 uint32_t memavl= 0, min_sort_memory;
140 uint32_t maxbuffer;143 uint32_t maxbuffer;
144 size_t allocated_sort_memory= 0;
141 buffpek *buffpek_inst;145 buffpek *buffpek_inst;
142 ha_rows records= HA_POS_ERROR;146 ha_rows records= HA_POS_ERROR;
143 unsigned char **sort_keys= 0;147 unsigned char **sort_keys= 0;
@@ -247,10 +251,20 @@
247 uint32_t old_memavl;251 uint32_t old_memavl;
248 uint32_t keys= memavl/(param.rec_length+sizeof(char*));252 uint32_t keys= memavl/(param.rec_length+sizeof(char*));
249 param.keys= (uint32_t) min(records+1, (ha_rows)keys);253 param.keys= (uint32_t) min(records+1, (ha_rows)keys);
254
255 allocated_sort_memory= param.keys * param.rec_length;
256 if (not global_sort_buffer.add(allocated_sort_memory))
257 {
258 my_error(ER_OUT_OF_GLOBAL_SORTMEMORY, MYF(ME_ERROR+ME_WAITTANG));
259 goto err;
260 }
261
250 if ((table_sort.sort_keys=262 if ((table_sort.sort_keys=
251 (unsigned char **) make_char_array((char **) table_sort.sort_keys,263 (unsigned char **) make_char_array((char **) table_sort.sort_keys,
252 param.keys, param.rec_length)))264 param.keys, param.rec_length)))
253 break;265 break;
266
267 global_sort_buffer.sub(allocated_sort_memory);
254 old_memavl= memavl;268 old_memavl= memavl;
255 if ((memavl= memavl/4*3) < min_sort_memory && old_memavl > min_sort_memory)269 if ((memavl= memavl/4*3) < min_sort_memory && old_memavl > min_sort_memory)
256 memavl= min_sort_memory;270 memavl= min_sort_memory;
@@ -261,6 +275,7 @@
261 my_error(ER_OUT_OF_SORTMEMORY,MYF(ME_ERROR+ME_WAITTANG));275 my_error(ER_OUT_OF_SORTMEMORY,MYF(ME_ERROR+ME_WAITTANG));
262 goto err;276 goto err;
263 }277 }
278
264 if (open_cached_file(&buffpek_pointers,drizzle_tmpdir.c_str(),TEMP_PREFIX,279 if (open_cached_file(&buffpek_pointers,drizzle_tmpdir.c_str(),TEMP_PREFIX,
265 DISK_BUFFER_SIZE, MYF(MY_WME)))280 DISK_BUFFER_SIZE, MYF(MY_WME)))
266 goto err;281 goto err;
@@ -357,6 +372,7 @@
357 session->status_var.filesort_rows+= (uint32_t) records;372 session->status_var.filesort_rows+= (uint32_t) records;
358 }373 }
359 *examined_rows= param.examined_rows;374 *examined_rows= param.examined_rows;
375 global_sort_buffer.sub(allocated_sort_memory);
360 memcpy(&table->sort, &table_sort, sizeof(filesort_info));376 memcpy(&table->sort, &table_sort, sizeof(filesort_info));
361 DRIZZLE_FILESORT_DONE(error, records);377 DRIZZLE_FILESORT_DONE(error, records);
362 return (error ? HA_POS_ERROR : records);378 return (error ? HA_POS_ERROR : records);
363379
=== added file 'drizzled/global_buffer.h'
--- drizzled/global_buffer.h 1970-01-01 00:00:00 +0000
+++ drizzled/global_buffer.h 2010-11-05 13:28:56 +0000
@@ -0,0 +1,69 @@
1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2010 Andrew Hutchings
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef DRIZZLED_GLOBAL_BUFFER_H
21#define DRIZZLED_GLOBAL_BUFFER_H
22
23#include <drizzled/atomics.h>
24
25namespace drizzled
26{
27template <class T>
28class global_buffer_constraint
29{
30public:
31 global_buffer_constraint(T max)
32 {
33 setMaxSize(max);
34 }
35
36 T getMaxSize() const { return max_size; }
37 void setMaxSize(T new_size)
38 {
39 if (new_size == 0) new_size = std::numeric_limits<T>::max();
40 max_size= new_size;
41 }
42
43 bool add(T addition)
44 {
45 if (current_size.add_and_fetch(addition) > max_size)
46 {
47 current_size.add_and_fetch(T(0) - addition);
48 return false;
49 }
50 return true;
51 }
52
53 bool sub(T subtract)
54 {
55 if (current_size < subtract)
56 return false;
57 else
58 current_size.add_and_fetch(T(0) - subtract);
59
60 return true;
61 }
62
63private:
64 atomic<T> current_size;
65 T max_size;
66};
67
68}
69#endif /* DRIZZLED_GLOBAL_BUFFER_H */
070
=== modified file 'drizzled/include.am'
--- drizzled/include.am 2010-10-28 05:22:47 +0000
+++ drizzled/include.am 2010-11-05 13:28:56 +0000
@@ -190,6 +190,7 @@
190 drizzled/generator/session.h \190 drizzled/generator/session.h \
191 drizzled/generator/table.h \191 drizzled/generator/table.h \
192 drizzled/gettext.h \192 drizzled/gettext.h \
193 drizzled/global_buffer.h \
193 drizzled/global_charset_info.h \194 drizzled/global_charset_info.h \
194 drizzled/ha_statistics.h \195 drizzled/ha_statistics.h \
195 drizzled/handler_structs.h \196 drizzled/handler_structs.h \
196197
=== modified file 'drizzled/internal/mf_iocache.cc'
--- drizzled/internal/mf_iocache.cc 2010-10-10 08:28:30 +0000
+++ drizzled/internal/mf_iocache.cc 2010-11-05 13:28:56 +0000
@@ -51,6 +51,7 @@
5151
52#include "drizzled/internal/my_sys.h"52#include "drizzled/internal/my_sys.h"
53#include "drizzled/internal/m_string.h"53#include "drizzled/internal/m_string.h"
54#include "drizzled/drizzled.h"
54#ifdef HAVE_AIOWAIT55#ifdef HAVE_AIOWAIT
55#include "drizzled/error.h"56#include "drizzled/error.h"
56#include "drizzled/internal/aio_result.h"57#include "drizzled/internal/aio_result.h"
@@ -247,6 +248,12 @@
247 if (cachesize < min_cache)248 if (cachesize < min_cache)
248 cachesize = min_cache;249 cachesize = min_cache;
249 buffer_block= cachesize;250 buffer_block= cachesize;
251 if ((type == READ_CACHE) and (not global_read_buffer.add(buffer_block)))
252 {
253 my_error(ER_OUT_OF_GLOBAL_READMEMORY, MYF(ME_ERROR+ME_WAITTANG));
254 return 2;
255 }
256
250 if ((info->buffer=257 if ((info->buffer=
251 (unsigned char*) malloc(buffer_block)) != 0)258 (unsigned char*) malloc(buffer_block)) != 0)
252 {259 {
@@ -255,8 +262,14 @@
255 break; /* Enough memory found */262 break; /* Enough memory found */
256 }263 }
257 if (cachesize == min_cache)264 if (cachesize == min_cache)
265 {
266 if (type == READ_CACHE)
267 global_read_buffer.sub(buffer_block);
258 return(2); /* Can't alloc cache */268 return(2); /* Can't alloc cache */
269 }
259 /* Try with less memory */270 /* Try with less memory */
271 if (type == READ_CACHE)
272 global_read_buffer.sub(buffer_block);
260 cachesize= (cachesize*3/4 & ~(min_cache-1));273 cachesize= (cachesize*3/4 & ~(min_cache-1));
261 }274 }
262 }275 }
@@ -928,6 +941,8 @@
928 }941 }
929 if (info->alloced_buffer)942 if (info->alloced_buffer)
930 {943 {
944 if (info->type == READ_CACHE)
945 global_read_buffer.sub(info->buffer_length);
931 info->alloced_buffer=0;946 info->alloced_buffer=0;
932 if (info->file != -1) /* File doesn't exist */947 if (info->file != -1) /* File doesn't exist */
933 error= my_b_flush_io_cache(info,1);948 error= my_b_flush_io_cache(info,1);
934949
=== modified file 'drizzled/join_cache.cc'
--- drizzled/join_cache.cc 2010-07-30 20:31:19 +0000
+++ drizzled/join_cache.cc 2010-11-05 13:28:56 +0000
@@ -30,6 +30,8 @@
30#include "config.h"30#include "config.h"
31#include "drizzled/sql_select.h" /* include join.h */31#include "drizzled/sql_select.h" /* include join.h */
32#include "drizzled/field/blob.h"32#include "drizzled/field/blob.h"
33#include "drizzled/drizzled.h"
34#include "drizzled/internal/my_sys.h"
3335
34#include <algorithm>36#include <algorithm>
3537
@@ -87,6 +89,8 @@
87 if (!(cache->field=(CacheField*)89 if (!(cache->field=(CacheField*)
88 memory::sql_alloc(sizeof(CacheField)*(cache->fields+table_count*2)+(blobs+1)* sizeof(CacheField*))))90 memory::sql_alloc(sizeof(CacheField)*(cache->fields+table_count*2)+(blobs+1)* sizeof(CacheField*))))
89 {91 {
92 size= cache->end - cache->buff;
93 global_join_buffer.sub(size);
90 free((unsigned char*) cache->buff);94 free((unsigned char*) cache->buff);
91 cache->buff=0;95 cache->buff=0;
92 return(1);96 return(1);
@@ -162,6 +166,11 @@
162 cache->blobs= blobs;166 cache->blobs= blobs;
163 *blob_ptr= NULL; /* End sequentel */167 *blob_ptr= NULL; /* End sequentel */
164 size= max((size_t) session->variables.join_buff_size, (size_t)cache->length);168 size= max((size_t) session->variables.join_buff_size, (size_t)cache->length);
169 if (not global_join_buffer.add(size))
170 {
171 my_error(ER_OUT_OF_GLOBAL_JOINMEMORY, MYF(ME_ERROR+ME_WAITTANG));
172 return 1;
173 }
165 if (!(cache->buff= (unsigned char*) malloc(size)))174 if (!(cache->buff= (unsigned char*) malloc(size)))
166 return 1;175 return 1;
167 cache->end= cache->buff+size;176 cache->end= cache->buff+size;
168177
=== modified file 'drizzled/records.cc'
--- drizzled/records.cc 2010-10-20 20:25:52 +0000
+++ drizzled/records.cc 2010-11-05 13:28:56 +0000
@@ -27,6 +27,7 @@
27#include "drizzled/optimizer/range.h"27#include "drizzled/optimizer/range.h"
28#include "drizzled/internal/my_sys.h"28#include "drizzled/internal/my_sys.h"
29#include "drizzled/internal/iocache.h"29#include "drizzled/internal/iocache.h"
30#include "drizzled/drizzled.h"
3031
31namespace drizzled32namespace drizzled
32{33{
@@ -172,6 +173,7 @@
172{ /* free cache if used */173{ /* free cache if used */
173 if (cache)174 if (cache)
174 {175 {
176 global_read_rnd_buffer.sub(session->variables.read_rnd_buff_size);
175 free((char*) cache);177 free((char*) cache);
176 cache= NULL;178 cache= NULL;
177 }179 }
@@ -402,6 +404,12 @@
402 local_rec_cache_size= cache_records * reclength;404 local_rec_cache_size= cache_records * reclength;
403 rec_cache_size= cache_records * ref_length;405 rec_cache_size= cache_records * ref_length;
404406
407 if (not global_read_rnd_buffer.add(session->variables.read_rnd_buff_size))
408 {
409 my_error(ER_OUT_OF_GLOBAL_READRNDMEMORY, MYF(ME_ERROR+ME_WAITTANG));
410 return false;
411 }
412
405 // We have to allocate one more byte to use uint3korr (see comments for it)413 // We have to allocate one more byte to use uint3korr (see comments for it)
406 if (cache_records <= 2 ||414 if (cache_records <= 2 ||
407 !(cache=(unsigned char*) malloc(local_rec_cache_size + cache_records * struct_length + 1)))415 !(cache=(unsigned char*) malloc(local_rec_cache_size + cache_records * struct_length + 1)))
408416
=== modified file 'drizzled/sql_select.cc'
--- drizzled/sql_select.cc 2010-11-02 17:38:03 +0000
+++ drizzled/sql_select.cc 2010-11-05 13:28:56 +0000
@@ -51,6 +51,7 @@
51#include "drizzled/index_hint.h"51#include "drizzled/index_hint.h"
52#include "drizzled/records.h"52#include "drizzled/records.h"
53#include "drizzled/internal/iocache.h"53#include "drizzled/internal/iocache.h"
54#include "drizzled/drizzled.h"
5455
55#include "drizzled/sql_union.h"56#include "drizzled/sql_union.h"
56#include "drizzled/optimizer/key_field.h"57#include "drizzled/optimizer/key_field.h"
@@ -1216,7 +1217,11 @@
1216 delete quick;1217 delete quick;
1217 quick= 0;1218 quick= 0;
1218 if (cache.buff)1219 if (cache.buff)
1220 {
1221 size_t size= cache.end - cache.buff;
1222 global_join_buffer.sub(size);
1219 free(cache.buff);1223 free(cache.buff);
1224 }
1220 cache.buff= 0;1225 cache.buff= 0;
1221 limit= 0;1226 limit= 0;
1222 if (table)1227 if (table)
12231228
=== added file 'tests/include/setup-global-constraints.inc'
--- tests/include/setup-global-constraints.inc 1970-01-01 00:00:00 +0000
+++ tests/include/setup-global-constraints.inc 2010-11-05 13:28:56 +0000
@@ -0,0 +1,32 @@
1--disable_warnings
2DROP TABLE IF EXISTS t1;
3DROP TABLE IF EXISTS t2;
4--enable_warnings
5
6CREATE TABLE `t1` (
7 `charcol1` VARCHAR(36) COLLATE utf8_general_ci DEFAULT NULL,
8 `charcol2` VARCHAR(36) COLLATE utf8_general_ci DEFAULT NULL
9) ENGINE=InnoDB COLLATE = utf8_general_ci;
10
11INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
12INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
13INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
14INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
15INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
16INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
17INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
18INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
19INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
20INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
21INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
22INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
23INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
24INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
25INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
26INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
27INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
28INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
29INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
30INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
31
32CREATE TABLE t2 SELECT * FROM t1;
033
=== added file 'tests/r/global_read_constraints.result'
--- tests/r/global_read_constraints.result 1970-01-01 00:00:00 +0000
+++ tests/r/global_read_constraints.result 2010-11-05 13:28:56 +0000
@@ -0,0 +1,32 @@
1USE test;
2DROP TABLE IF EXISTS t1;
3DROP TABLE IF EXISTS t2;
4CREATE TABLE `t1` (
5`charcol1` VARCHAR(36) COLLATE utf8_general_ci DEFAULT NULL,
6`charcol2` VARCHAR(36) COLLATE utf8_general_ci DEFAULT NULL
7) ENGINE=InnoDB COLLATE = utf8_general_ci;
8INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
9INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
10INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
11INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
12INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
13INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
14INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
15INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
16INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
17INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
18INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
19INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
20INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
21INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
22INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
23INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
24INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
25INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
26INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
27INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
28CREATE TABLE t2 SELECT * FROM t1;
29create temporary table t3 (a varchar(255), b varchar(255)) engine=myisam;
30insert into t3 select * from t1;
31select SQL_BIG_RESULT * from t3, (select * from t1) as t4;
32ERROR HY000: Global read memory constraint hit; increase read-buffer-threshold
033
=== added file 'tests/r/global_read_rnd_constraints.result'
--- tests/r/global_read_rnd_constraints.result 1970-01-01 00:00:00 +0000
+++ tests/r/global_read_rnd_constraints.result 2010-11-05 13:28:56 +0000
@@ -0,0 +1,1 @@
1USE test;
02
=== added file 'tests/r/global_sort_join_constraints.result'
--- tests/r/global_sort_join_constraints.result 1970-01-01 00:00:00 +0000
+++ tests/r/global_sort_join_constraints.result 2010-11-05 13:28:56 +0000
@@ -0,0 +1,30 @@
1USE test;
2DROP TABLE IF EXISTS t1;
3DROP TABLE IF EXISTS t2;
4CREATE TABLE `t1` (
5`charcol1` VARCHAR(36) COLLATE utf8_general_ci DEFAULT NULL,
6`charcol2` VARCHAR(36) COLLATE utf8_general_ci DEFAULT NULL
7) ENGINE=InnoDB COLLATE = utf8_general_ci;
8INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
9INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
10INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
11INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
12INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
13INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
14INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
15INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
16INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
17INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
18INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
19INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
20INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
21INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
22INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
23INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
24INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
25INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
26INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
27INSERT INTO t1 VALUES (UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID()),(UUID(), UUID());
28CREATE TABLE t2 SELECT * FROM t1;
29select SQL_BIG_RESULT * from t1 join t2 on (t1.charcol1 = t2.charcol2) join t2 as t3 on (t1.charcol1 = t3.charcol2);
30ERROR HY000: Global join memory constraint hit; increase join-heap-threshold
031
=== added file 'tests/t/global_read_constraints-master.opt'
--- tests/t/global_read_constraints-master.opt 1970-01-01 00:00:00 +0000
+++ tests/t/global_read_constraints-master.opt 2010-11-05 13:28:56 +0000
@@ -0,0 +1,1 @@
1--read-buffer-threshold=128k
02
=== added file 'tests/t/global_read_constraints.test'
--- tests/t/global_read_constraints.test 1970-01-01 00:00:00 +0000
+++ tests/t/global_read_constraints.test 2010-11-05 13:28:56 +0000
@@ -0,0 +1,9 @@
1# Setup table for tests
2USE test;
3
4--source include/setup-global-constraints.inc
5
6create temporary table t3 (a varchar(255), b varchar(255)) engine=myisam;
7insert into t3 select * from t1;
8--error 1705
9select SQL_BIG_RESULT * from t3, (select * from t1) as t4;
010
=== added file 'tests/t/global_read_rnd_constraints-master.opt'
--- tests/t/global_read_rnd_constraints-master.opt 1970-01-01 00:00:00 +0000
+++ tests/t/global_read_rnd_constraints-master.opt 2010-11-05 13:28:56 +0000
@@ -0,0 +1,1 @@
1--read-rnd-threshold=262144
02
=== added file 'tests/t/global_read_rnd_constraints.test'
--- tests/t/global_read_rnd_constraints.test 1970-01-01 00:00:00 +0000
+++ tests/t/global_read_rnd_constraints.test 2010-11-05 13:28:56 +0000
@@ -0,0 +1,19 @@
1# Test is disabled because drizzleslap error code is now different on different platforms
2
3# Setup table for tests
4USE test;
5
6#--source include/setup-global-constraints.inc
7
8# We appear to need to beef up the table to use the read_rnd buffer at all
9#alter table t1 modify charcol1 varchar(255);
10#alter table t1 modify charcol2 varchar(255);
11#insert into t1 select SQL_BIG_RESULT * from t1;
12#insert into t1 select SQL_BIG_RESULT * from t1;
13#insert into t1 select SQL_BIG_RESULT * from t1;
14#insert into t1 select SQL_BIG_RESULT * from t1;
15#insert into t1 select SQL_BIG_RESULT * from t1;
16
17# Test for read_rnd buffer constraint
18#--error 134
19#--exec $DRIZZLE_SLAP -q "SELECT SQL_BIG_RESULT * FROM t1 ORDER BY 1" -c100 --iterations=1 --number-of-queries=1000 --create-schema=test
020
=== added file 'tests/t/global_sort_join_constraints-master.opt'
--- tests/t/global_sort_join_constraints-master.opt 1970-01-01 00:00:00 +0000
+++ tests/t/global_sort_join_constraints-master.opt 2010-11-05 13:28:56 +0000
@@ -0,0 +1,1 @@
1--join-heap-threshold=131072 --sort-heap-threshold=2097144
02
=== added file 'tests/t/global_sort_join_constraints.test'
--- tests/t/global_sort_join_constraints.test 1970-01-01 00:00:00 +0000
+++ tests/t/global_sort_join_constraints.test 2010-11-05 13:28:56 +0000
@@ -0,0 +1,13 @@
1# Setup table for tests
2USE test;
3
4--source include/setup-global-constraints.inc
5
6# Test for sort buffer constraint
7# Test disabled, needs two parallel filesorts to trigger error. Drizzleslap's error handling currently unpredictable
8#--error 134
9#--exec $DRIZZLE_SLAP -q "SELECT * FROM t1 ORDER BY 1" -c100 --iterations=1 --number-of-queries=1000 --create-schema=test
10
11# Test for join buffer constraint
12--error 1703
13select SQL_BIG_RESULT * from t1 join t2 on (t1.charcol1 = t2.charcol2) join t2 as t3 on (t1.charcol1 = t3.charcol2);
014
=== modified file 'unittests/atomics_test.cc'
--- unittests/atomics_test.cc 2010-06-02 22:35:45 +0000
+++ unittests/atomics_test.cc 2010-11-05 13:28:56 +0000
@@ -78,8 +78,8 @@
7878
79 u235.fetch_and_store(100);79 u235.fetch_and_store(100);
8080
81 EXPECT_EQ(false, u235.compare_and_swap(42, 200));81 ASSERT_FALSE(u235.compare_and_swap(42, 200));
82 EXPECT_EQ(true, u235.compare_and_swap(200, 100));82 ASSERT_TRUE(u235.compare_and_swap(200, 100));
83 EXPECT_EQ(200, u235);83 EXPECT_EQ(200, u235);
84}84}
8585
8686
=== added file 'unittests/global_buffer_test.cc'
--- unittests/global_buffer_test.cc 1970-01-01 00:00:00 +0000
+++ unittests/global_buffer_test.cc 2010-11-05 13:28:56 +0000
@@ -0,0 +1,60 @@
1/* -*- mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2010 Andrew Hutchings
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include "config.h"
22
23#include <gtest/gtest.h>
24#include "drizzled/global_buffer.h"
25
26TEST(global_buffer, overflow)
27{
28 drizzled::global_buffer_constraint<uint64_t> test_buffer(1024);
29
30 ASSERT_TRUE(test_buffer.add(512));
31 ASSERT_TRUE(test_buffer.add(512));
32 ASSERT_FALSE(test_buffer.add(1));
33}
34
35TEST(global_buffer, subtract)
36{
37 drizzled::global_buffer_constraint<uint64_t> test_buffer(1024);
38
39 ASSERT_TRUE(test_buffer.add(1024));
40 ASSERT_TRUE(test_buffer.sub(512));
41 ASSERT_TRUE(test_buffer.add(512));
42 ASSERT_FALSE(test_buffer.add(1));
43}
44
45TEST(global_buffer, underflow)
46{
47 drizzled::global_buffer_constraint<uint64_t> test_buffer(1024);
48
49 ASSERT_TRUE(test_buffer.add(10));
50 ASSERT_FALSE(test_buffer.sub(11));
51}
52
53TEST(global_buffer, change_max)
54{
55 drizzled::global_buffer_constraint<uint64_t> test_buffer(1024);
56
57 test_buffer.setMaxSize(512);
58
59 ASSERT_FALSE(test_buffer.add(513));
60}
061
=== modified file 'unittests/include.am'
--- unittests/include.am 2010-09-14 07:47:50 +0000
+++ unittests/include.am 2010-11-05 13:28:56 +0000
@@ -28,6 +28,7 @@
28 unittests/date_test.cc \28 unittests/date_test.cc \
29 unittests/date_time_test.cc \29 unittests/date_time_test.cc \
30 unittests/generators.cc \30 unittests/generators.cc \
31 unittests/global_buffer_test.cc \
31 unittests/libdrizzle_test.cc \32 unittests/libdrizzle_test.cc \
32 unittests/main.cc \33 unittests/main.cc \
33 unittests/micro_timestamp_test.cc \34 unittests/micro_timestamp_test.cc \
3435
=== modified file 'unittests/pthread_atomics_test.cc'
--- unittests/pthread_atomics_test.cc 2010-06-02 22:35:45 +0000
+++ unittests/pthread_atomics_test.cc 2010-11-05 13:28:56 +0000
@@ -106,8 +106,8 @@
106106
107 u235.fetch_and_store(100);107 u235.fetch_and_store(100);
108108
109 EXPECT_EQ(false, u235.compare_and_swap(42, 200));109 ASSERT_FALSE(u235.compare_and_swap(42, 200));
110 EXPECT_EQ(true, u235.compare_and_swap(200, 100));110 ASSERT_TRUE(u235.compare_and_swap(200, 100));
111 EXPECT_EQ(200, u235);111 EXPECT_EQ(200, u235);
112}112}
113113
114114
=== modified file 'unittests/utf8_test.cc'
--- unittests/utf8_test.cc 2010-06-03 20:42:25 +0000
+++ unittests/utf8_test.cc 2010-11-05 13:28:56 +0000
@@ -29,10 +29,10 @@
2929
30TEST(utf8, is_single)30TEST(utf8, is_single)
31{31{
32 EXPECT_EQ(true, utf8::is_single('a'));32 ASSERT_TRUE(utf8::is_single('a'));
33 const char *multi_byte= "ç";33 const char *multi_byte= "ç";
34 EXPECT_EQ(false, utf8::is_single(*multi_byte));34 ASSERT_FALSE(utf8::is_single(*multi_byte));
35 EXPECT_EQ(false, utf8::is_single(*(multi_byte + 1)));35 ASSERT_FALSE(utf8::is_single(*(multi_byte + 1)));
36}36}
3737
38TEST(utf8, codepoint_length)38TEST(utf8, codepoint_length)

Subscribers

People subscribed via source and target branches