summaryrefslogtreecommitdiff
path: root/storage
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 /storage
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 'storage')
-rw-r--r--storage/archive/ha_archive.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index 1146b2eb73a..f1b9c26dfd6 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -993,6 +993,7 @@ int ha_archive::rnd_init(bool scan)
/* We rewind the file so that we can read from the beginning if scan */
if (scan)
{
+ scan_rows= stats.records;
DBUG_PRINT("info", ("archive will retrieve %llu rows",
(unsigned long long) scan_rows));
@@ -1461,7 +1462,6 @@ int ha_archive::info(uint flag)
stats.records= share->rows_recorded;
pthread_mutex_unlock(&share->mutex);
- scan_rows= stats.records;
stats.deleted= 0;
DBUG_PRINT("ha_archive", ("Stats rows is %d\n", (int)stats.records));