Bug #70236 Use_count: Wrong count for key at 0x27547278, 3 should be 4
Submitted: 4 Sep 2013 5:05 Modified: 15 Oct 2013 17:56
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:5.6.15 OS:Any
Assigned to: CPU Architecture:Any

[4 Sep 2013 5:05] Shane Bester
Description:
Version: '5.6.15-debug'  MySQL Community Server (GPL)
[Note] Use_count: Wrong count for key at 0x27547278, 3 should be 4
[Note] Use_count: Wrong count for key at 0x27547278, 3 should be 4

How to repeat:
#on debug builds of 5.6, 5.7.

drop table if exists t1;
create table `t1` (`a` int,`b` int,`c` int,primary key (`a`),key (`b`,`c`)) engine=innodb;
insert into t1 values(0,0,0);
select * from `t1` where c <> 0 and a < 0 and b <> 1;

Suggested fix:
Enable the assertion for this bug and run RQG so that we'll find all the cases.  The SEL_ARG::test_use_count contains assertions commented out:

 //DBUG_ASSERT(false); // Todo - enable and clean up mess
[15 Oct 2013 17:56] Paul DuBois
Noted in 5.6.15, 5.7.3 changelog.

Incorrect reference counting in the range optimizer module resulted
in potential for missing or duplicate rows in the query result set.
[21 Feb 2017 7:03] Laurynas Biveinis
Contrary to the above, this bug has not been fixed in 5.6, filed doc bug 85094.

The fix for this bug has caused bug 84736
[24 Feb 2017 1:06] Paul DuBois
Posted by developer:
 
Correction:
Fixed in 5.7.3 only (not 5.6.15).