mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 20:07:13 +02: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.
storage/ibmdb2i/ha_ibmdb2i.cc:
Bug#44337 Select query using index merge fails with MCH3601
- clear the rrnAssocHandle at the beginning of each
read operation
- checks to see whether it has been set to a valid
handle value before attempting to use it in rnd_pos
This commit is contained in:
parent
e7c4b2dfc7
commit
70f53b1a65
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
Add a link
Reference in a new issue