Commit e13406b2 authored by Igor Babaev's avatar Igor Babaev

Changed the queries of index_intersect.test to ensure platform

independent execution plans.
Fixed a bug in Unique::unique_add that caused a crash for a query from
index_intersect_innodb on some platforms.
Fixed two bugs in opt_range.cc that led to the choice of not the
cheapest plans for index intersections.
parent 80377bbf
This diff is collapsed.
This diff is collapsed.
...@@ -679,8 +679,6 @@ INSERT INTO t1(b,c) SELECT b,c FROM t2; ...@@ -679,8 +679,6 @@ INSERT INTO t1(b,c) SELECT b,c FROM t2;
UPDATE t2 SET c='2007-01-03'; UPDATE t2 SET c='2007-01-03';
INSERT INTO t1(b,c) SELECT b,c FROM t2; INSERT INTO t1(b,c) SELECT b,c FROM t2;
set @@sort_buffer_size=8192; set @@sort_buffer_size=8192;
Warnings:
Warning 1292 Truncated incorrect sort_buffer_size value: '8192'
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
COUNT(*) COUNT(*)
3072 3072
......
...@@ -3667,8 +3667,6 @@ CREATE TABLE t1 (a int, b int auto_increment, PRIMARY KEY (b)); ...@@ -3667,8 +3667,6 @@ CREATE TABLE t1 (a int, b int auto_increment, PRIMARY KEY (b));
CREATE TABLE t2 (x int auto_increment, y int, z int, CREATE TABLE t2 (x int auto_increment, y int, z int,
PRIMARY KEY (x), FOREIGN KEY (y) REFERENCES t1 (b)); PRIMARY KEY (x), FOREIGN KEY (y) REFERENCES t1 (b));
SET SESSION sort_buffer_size = 32 * 1024; SET SESSION sort_buffer_size = 32 * 1024;
Warnings:
Warning 1292 Truncated incorrect sort_buffer_size value: '32768'
SELECT SQL_NO_CACHE COUNT(*) SELECT SQL_NO_CACHE COUNT(*)
FROM (SELECT a, b, (SELECT x FROM t2 WHERE y=b ORDER BY z DESC LIMIT 1) c FROM (SELECT a, b, (SELECT x FROM t2 WHERE y=b ORDER BY z DESC LIMIT 1) c
FROM t1) t; FROM t1) t;
...@@ -4104,8 +4102,6 @@ INSERT INTO `t1` VALUES ('asdf','2007-02-08 01:11:26'); ...@@ -4104,8 +4102,6 @@ INSERT INTO `t1` VALUES ('asdf','2007-02-08 01:11:26');
INSERT INTO `t2` VALUES ('abcdefghijk'); INSERT INTO `t2` VALUES ('abcdefghijk');
INSERT INTO `t2` VALUES ('asdf'); INSERT INTO `t2` VALUES ('asdf');
SET session sort_buffer_size=8192; SET session sort_buffer_size=8192;
Warnings:
Warning 1292 Truncated incorrect sort_buffer_size value: '8192'
SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.a ORDER BY t1.b LIMIT 1) AS d1 FROM t2; SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.a ORDER BY t1.b LIMIT 1) AS d1 FROM t2;
d1 d1
1 1
......
This diff is collapsed.
...@@ -5112,7 +5112,7 @@ double get_unique_intersect_cost(COMMON_INDEX_INTERSECTION_INFO *common, ...@@ -5112,7 +5112,7 @@ double get_unique_intersect_cost(COMMON_INDEX_INTERSECTION_INFO *common,
common->max_memory_size, common->max_memory_size,
common->compare_factor, common->compare_factor,
TRUE, in_memory); TRUE, in_memory);
if (in_memory) if (*in_memory)
*in_memory_cost= cost; *in_memory_cost= cost;
} }
return cost; return cost;
...@@ -5124,7 +5124,7 @@ double get_cpk_filter_cost(INDEX_SCAN_INFO *index_scan, ...@@ -5124,7 +5124,7 @@ double get_cpk_filter_cost(INDEX_SCAN_INFO *index_scan,
INDEX_SCAN_INFO *cpk_scan, INDEX_SCAN_INFO *cpk_scan,
double compare_factor) double compare_factor)
{ {
return log((double) cpk_scan->range_count) / (compare_factor * M_LN2) * return log((double) (cpk_scan->range_count+1)) / (compare_factor * M_LN2) *
index_scan->records; index_scan->records;
} }
...@@ -5174,7 +5174,8 @@ bool check_index_intersect_extension(PARTIAL_INDEX_INTERSECTION_INFO *curr, ...@@ -5174,7 +5174,8 @@ bool check_index_intersect_extension(PARTIAL_INDEX_INTERSECTION_INFO *curr,
return FALSE; return FALSE;
records_in_scans= curr->records_in_scans + index_scan_records; records_in_scans= curr->records_in_scans + index_scan_records;
next->in_memory= curr->in_memory; if ((next->in_memory= curr->in_memory))
next->in_memory_cost= curr->in_memory_cost;
records= records_in_index_intersect_extension(curr, ext_index_scan); records= records_in_index_intersect_extension(curr, ext_index_scan);
if (idx && records > curr->records) if (idx && records > curr->records)
...@@ -5207,7 +5208,7 @@ bool check_index_intersect_extension(PARTIAL_INDEX_INTERSECTION_INFO *curr, ...@@ -5207,7 +5208,7 @@ bool check_index_intersect_extension(PARTIAL_INDEX_INTERSECTION_INFO *curr,
{ {
double cost2; double cost2;
bool in_memory_save= next->in_memory; bool in_memory_save= next->in_memory;
if (!idx) if (idx)
{ {
next->length= curr->length+1; next->length= curr->length+1;
records2= records_in_index_intersect_extension(next, cpk_scan); records2= records_in_index_intersect_extension(next, cpk_scan);
......
...@@ -2983,7 +2983,8 @@ public: ...@@ -2983,7 +2983,8 @@ public:
{ {
DBUG_ENTER("unique_add"); DBUG_ENTER("unique_add");
DBUG_PRINT("info", ("tree %u - %lu", tree.elements_in_tree, max_elements)); DBUG_PRINT("info", ("tree %u - %lu", tree.elements_in_tree, max_elements));
if (tree.elements_in_tree > max_elements && flush()) if (!(tree.flag & TREE_ONLY_DUPS) &&
tree.elements_in_tree >= max_elements && flush())
DBUG_RETURN(1); DBUG_RETURN(1);
DBUG_RETURN(!tree_insert(&tree, ptr, 0, tree.custom_arg)); DBUG_RETURN(!tree_insert(&tree, ptr, 0, tree.custom_arg));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment