summaryrefslogtreecommitdiff
path: root/mysql-test/t/archive.test
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@sun.com>2009-09-04 12:29:18 +0500
committerSergey Vojtovich <svoj@sun.com>2009-09-04 12:29:18 +0500
commita7de20574749ececbe8492f340f6ddc7be1544fa (patch)
treea27179c7cfe98c2816ae8c5b7f033532e8540066 /mysql-test/t/archive.test
parent9776b6f9cd4fc4d8c84ae373fd0a44c486c7c2e2 (diff)
downloadmariadb-git-a7de20574749ececbe8492f340f6ddc7be1544fa.tar.gz
BUG#46961 - archive engine loses rows during self joining select!
SELECT with join (not only self-join) from archive table may return incomplete result set, when result set size exceeds join buffer size. The problem was that archive row counter was initialzed too early, when ha_archive::info() method was called. Later, when optimizer exceeds join buffer, it attempts to reuse handler without calling ha_archive::info() again (which is correct). Fixed by moving row counter initialization from ha_archive::info() to ha_archive::rnd_init(). mysql-test/r/archive.result: A test case for BUG#46961. mysql-test/t/archive.test: A test case for BUG#46961. storage/archive/ha_archive.cc: Since a cursor may get reused without a call to ::info(), move assignment of scan_rows to a proper place, that is ::rnd_init().
Diffstat (limited to 'mysql-test/t/archive.test')
-rw-r--r--mysql-test/t/archive.test13
1 files changed, 13 insertions, 0 deletions
diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test
index 7139d95ab49..663f7faf208 100644
--- a/mysql-test/t/archive.test
+++ b/mysql-test/t/archive.test
@@ -1599,3 +1599,16 @@ INSERT INTO t1 VALUES (NULL, NULL),(NULL, NULL);
FLUSH TABLE t1;
SELECT * FROM t1 ORDER BY a;
DROP TABLE t1;
+
+#
+# BUG#46961 - archive engine loses rows during self joining select!
+#
+SET @save_join_buffer_size= @@join_buffer_size;
+SET @@join_buffer_size= 8228;
+CREATE TABLE t1(a CHAR(255)) ENGINE=archive;
+INSERT INTO t1 VALUES('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),
+ ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),
+ ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
+SELECT COUNT(t1.a) FROM t1, t1 a, t1 b, t1 c, t1 d, t1 e;
+DROP TABLE t1;
+SET @@join_buffer_size= @save_join_buffer_size;