#At file:///home/satya/WORK/mysql-6.0-bug-40677/
2934 Satya B 2008-11-20
Fix for BUG#40677 - Archive tables joined on primary return no result
Problem
=======
Select queries on archive tables when joined on their primary keys
returns no results(empty set)
How it was solved
=================
Archive storage doesn't inform the handler about the fetched record
status when it is found. Fixed the archive storage engine to update
the record status when it fetches successfully
TestCase
========
Modified archive.test testcase to test this functionality
modified:
mysql-test/r/archive.result
mysql-test/t/archive.test
storage/archive/ha_archive.cc
=== modified file 'mysql-test/r/archive.result'
--- a/mysql-test/r/archive.result 2007-12-13 12:59:16 +0000
+++ b/mysql-test/r/archive.result 2008-11-20 12:02:37 +0000
@@ -12698,3 +12698,13 @@ SELECT * FROM t1 ORDER BY a;
a b
1 NULL
2 NULL
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1(id INT NOT NULL AUTO_INCREMENT, name VARCHAR(128) NOT NULL, PRIMARY KEY(id)) ENGINE=archive;
+INSERT INTO t1 VALUES(NULL,'a'),(NULL,'a');
+CREATE TABLE t2(id INT NOT NULL AUTO_INCREMENT, name VARCHAR(128) NOT NULL, PRIMARY KEY(id)) ENGINE=archive;
+INSERT INTO t2 VALUES(NULL,'b'),(NULL,'b');
+SELECT t1.id, t2.id, t1.name, t2.name FROM t1,t2 WHERE t1.id = t2.id;
+id id name name
+1 1 a b
+2 2 a b
+DROP TABLE IF EXISTS t1,t2;
=== modified file 'mysql-test/t/archive.test'
--- a/mysql-test/t/archive.test 2007-11-29 12:05:51 +0000
+++ b/mysql-test/t/archive.test 2008-11-20 12:02:37 +0000
@@ -1600,3 +1600,18 @@ CREATE TABLE t1(a INT NOT NULL AUTO_INCR
INSERT INTO t1 VALUES (NULL, NULL),(NULL, NULL);
FLUSH TABLE t1;
SELECT * FROM t1 ORDER BY a;
+
+#
+# BUG#40677 - Archive tables joined on primary return no result
+#
+-- disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+-- enable_warnings
+CREATE TABLE t1(id INT NOT NULL AUTO_INCREMENT, name VARCHAR(128) NOT NULL, PRIMARY KEY(id)) ENGINE=archive;
+INSERT INTO t1 VALUES(NULL,'a'),(NULL,'a');
+CREATE TABLE t2(id INT NOT NULL AUTO_INCREMENT, name VARCHAR(128) NOT NULL, PRIMARY KEY(id)) ENGINE=archive;
+INSERT INTO t2 VALUES(NULL,'b'),(NULL,'b');
+SELECT t1.id, t2.id, t1.name, t2.name FROM t1,t2 WHERE t1.id = t2.id;
+-- disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+-- enable_warnings
=== modified file 'storage/archive/ha_archive.cc'
--- a/storage/archive/ha_archive.cc 2008-11-06 06:18:15 +0000
+++ b/storage/archive/ha_archive.cc 2008-11-20 12:02:37 +0000
@@ -950,7 +950,11 @@ int ha_archive::index_read_idx(uchar *bu
}
if (found)
+ {
+ /* notify handler that a record has been found */
+ table->status= 0;
DBUG_RETURN(0);
+ }
error:
DBUG_RETURN(rc ? rc : HA_ERR_END_OF_FILE);
| Thread |
|---|
| • bzr commit into mysql-6.0 branch (satya.bn:2934) Bug#40677 | Satya B | 20 Nov |