# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2006/06/22 10:46:02-04:00 mikael@dator5.(none)
# BUG#20583: index_last causes crash when performed on single
partition
#
# sql/ha_partition.cc
# 2006/06/22 10:45:58-04:00 mikael@dator5.(none) +2 -1
# Ensure index_last always uses ordered index scan
#
# mysql-test/t/partition.test
# 2006/06/22 10:45:58-04:00 mikael@dator5.(none) +9 -0
# New test case
#
# mysql-test/r/partition.result
# 2006/06/22 10:45:58-04:00 mikael@dator5.(none) +8 -0
# New test case
#
diff -Nru a/mysql-test/r/partition.result
b/mysql-test/r/partition.result
--- a/mysql-test/r/partition.result 2006-06-22 10:51:52 -04:00
+++ b/mysql-test/r/partition.result 2006-06-22 10:51:52 -04:00
@@ -1043,4 +1043,12 @@
alter table t1 drop partition p2;
use test;
drop database db99;
+create table t1 (a int, index(a))
+partition by hash(a);
+insert into t1 values (1),(2);
+select * from t1 ORDER BY a DESC;
+a
+2
+1
+drop table t1;
End of 5.1 tests
diff -Nru a/mysql-test/t/partition.test b/mysql-test/t/partition.test
--- a/mysql-test/t/partition.test 2006-06-22 10:51:52 -04:00
+++ b/mysql-test/t/partition.test 2006-06-22 10:51:52 -04:00
@@ -1199,4 +1199,13 @@
use test;
drop database db99;
+#
+# Bug 20583 Partitions: Crash using index_last
+#
+create table t1 (a int, index(a))
+partition by hash(a);
+insert into t1 values (1),(2);
+select * from t1 ORDER BY a DESC;
+drop table t1;
+
--echo End of 5.1 tests
diff -Nru a/sql/ha_partition.cc b/sql/ha_partition.cc
--- a/sql/ha_partition.cc 2006-06-22 10:51:52 -04:00
+++ b/sql/ha_partition.cc 2006-06-22 10:51:52 -04:00
@@ -3399,7 +3399,8 @@
if ((error= partition_scan_set_up(buf, FALSE)))
return error;
- if (!m_ordered_scan_ongoing)
+ if (!m_ordered_scan_ongoing &&
+ m_index_scan_type != partition_index_last)
return handle_unordered_scan_next_partition(buf);
return handle_ordered_index_scan(buf);
}
Mikael Ronstrom, Senior Software Architect
MySQL AB, www.mysql.com
Jumpstart your cluster:
http://www.mysql.com/consulting/packaged/cluster.html
My blog:
http://mikaelronstrom.blogspot.com
| Thread |
|---|
| • bk commit - 5.1 tree (mikael:1.2227) BUG#20583 | Mikael Ronström | 22 Jun |