Bug #8925 Error reported from handler leads to assertion

Submitted: 3 Mar 2005 15:48 Modified: 16 Dec 2005 19:13
Reporter: Mikael Ronström Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.3 OS:MacOS (Mac OS X)
Assigned to: Ingo Strüwing CPU Architecture:Any

[3 Mar 2005 15:48] Mikael Ronström
Description:
If the handler reports an error on index_read_idx
when doing the query
select * from t1 where a = 1;
where a is the primary key then the server core's on an assert of that
table->key_read != 0 in close_thread_table

The problem is that the cleanup doesn't work properly in this error case

How to repeat:
Mix with a handler such that it reports error on any index_read_idx
create table t1 (a int not null, primary key(a));
insert into t1 values (1);
select * from t1 where a = 1;
Crash occurs on select statement
[3 Mar 2005 16:04] Mikael Ronström
The following code is the problem:
The original code didn't handle the call to extra(HA_EXTRA_NO_KEYREAD) in the
error situation so this call was done before the error was checked.

(The code is in join_read_const_table in sql_select.cc)

Patched code:
    error=join_read_const(tab);
    if (table->key_read)
    {
      table->key_read=0;
      table->file->extra(HA_EXTRA_NO_KEYREAD);
    }
    if (error)
    {
     tab->info="unique row not found";
      /* Mark for EXPLAIN that the row was not found */
      pos->records_read=0.0;
      if (!table->maybe_null || error > 0)
	DBUG_RETURN(error);
    }
[22 Jul 2005 19:18] Mikael Ronström
This bug has been fixed in the 5.1 tree
[19 Oct 2005 11:39] Mikael Ronström
Bug not fixed in 5.0 release but fixed in 5.1 release
[20 Oct 2005 20:34] Paul DuBois
Please indicate the three-part version number when the fix
was made.  Thanks.
[16 Dec 2005 19:13] Jim Winstead
If it was fixed in 5.1 tree in October, it was before any 5.1 releases and thus doesn't need documentation.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.054 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
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.