#At file:///home/lb200670/mysql/43630/ based on revid:olav.sandstaa@stripped
2701 lars-erik.bjork@stripped 2009-05-09
This is one of at least two patches for bug#43630
'A SELECT using ORDER BY and LIMIT sometimes returns no rows'
The index walker logic does not handle if an index page is empty. In
loads with lots of updates, we may get empty pages. When walking the
index we will stop at the first empty index page, even though this is
not the end of the level. In this test, this has often been the first
page, resulting in no rows returned.
This patch makes the search proceed to the next page when an empty
index page that is not the end of the level is encountered.
=== modified file 'storage/falcon/WalkIndex.cpp'
WalkIndex::getNextNode has been changed to reposition the index to the
next page when an index page with BUCKET_END as it first node is
encountered.
modified:
storage/falcon/WalkIndex.cpp
=== modified file 'storage/falcon/WalkIndex.cpp'
--- a/storage/falcon/WalkIndex.cpp 2009-03-02 08:16:53 +0000
+++ b/storage/falcon/WalkIndex.cpp 2009-05-09 11:25:17 +0000
@@ -88,9 +88,21 @@ int32 WalkIndex::getNextNode(void)
recordNumber = node.getNumber();
if (recordNumber >= 0)
+ {
return recordNumber;
- else if (recordNumber == END_LEVEL || recordNumber == END_BUCKET)
+ }
+ else if (recordNumber == END_BUCKET)
+ {
+ // This page is empty, proceed to next page
+ IndexRootPage::repositionIndex(index->dbb, index->indexId, this);
+ continue;
+ }
+ else if (recordNumber == END_LEVEL)
+ {
return -1;
+ }
+
+ ASSERT (false);
}
node.getNext(endNodes);

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.