mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 19:11:46 +01:00
Bug#44337 Select query using index merge fails with MCH3601
The storage engine was not correctly handling the case in which rnd_pos is executed for a handler without a preceding rnd_next or index read operation. As a result, an unitialized file handle was sometimes being passed to the QMY_READ API. The fix clears the rrnAssocHandle at the beginning of each read operation and then checks to see whether it has been set to a valid handle value before attempting to use it in rnd_pos. If rrnAssocHandle has not been set by a previous read operation, rnd_pos instead falls back to the use of the currently active handle.
This commit is contained in:
parent
4edc43b7b8
commit
f51e62cfa3
1 changed files with 6 additions and 1 deletions
|
@ -898,6 +898,8 @@ int ha_ibmdb2i::index_init(uint idx, bool sorted)
|
|||
releaseIndexFile(idx);
|
||||
}
|
||||
|
||||
rrnAssocHandle= 0;
|
||||
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
|
@ -1154,6 +1156,8 @@ int ha_ibmdb2i::rnd_init(bool scan)
|
|||
releaseDataFile();
|
||||
}
|
||||
|
||||
rrnAssocHandle= 0;
|
||||
|
||||
DBUG_RETURN(0); // MySQL sometimes does not check the return code, causing
|
||||
// an assert in ha_rnd_end later on if we return a non-zero
|
||||
// value here.
|
||||
|
@ -1251,7 +1255,8 @@ int ha_ibmdb2i::rnd_pos(uchar * buf, uchar *pos)
|
|||
|
||||
int rc = 0;
|
||||
|
||||
if (activeHandle != rrnAssocHandle)
|
||||
if (rrnAssocHandle &&
|
||||
(activeHandle != rrnAssocHandle))
|
||||
{
|
||||
if (activeHandle) releaseActiveHandle();
|
||||
rc = useFileByHandle(QMY_UPDATABLE, rrnAssocHandle);
|
||||
|
|
Loading…
Add table
Reference in a new issue