Bug #26136 mysql_store_result fails with (1032) Can't find record in <table>
Submitted: 7 Feb 2007 7:05 Modified: 2 Apr 2007 1:05
Reporter: Paul Querna Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S2 (Serious)
Version:5.1.14-beta OS:Linux (RHEL 4u3 x86_64)
Assigned to: Adam Dixon CPU Architecture:Any

[7 Feb 2007 7:05] Paul Querna
Description:
In a custom App using mysql_store_result will fail when using NDB.  Using an identical version against MyISAM or InnoDB works correctly.

An example query that fails:
SELECT id, version, value FROM unreads WHERE `ID` IN (12360080 ,39201181 ,12360243 ,12360800 ,42697346 ,14993933 ,38916186 ,28002765 ,14993934 ,12360815 ,15076724 ,15078341 ,18790122 ,16722279 ,18868064 ,12360858 ,12360892 ,20079807 ,15067837 ,32375302 ,15067838 ,34023968 ,15070832 ,12360900 ,15105015 ,15165319 ,34495036 ,34921488 ,34495037 ,34495049 ,12361482 ,35027445 ,12360231 ,12360830 ,12360981 ,12789852 ,12361449 ,12361450 ,13551777 ,13074937 ,14626266 ,14738706 ,16439209 ,14866006 ,15376725 ,15727588 ,17730889 ,16360430 ,19970948 ,17058510 ,17383361 ,17509621 ,17808271 ,17851526 ,21922582 ,18894420 ,21965936 ,19093499 ,20908984 ,21255454 ,21506732 ,23132796 ,21508213 ,21950631 ,23449002 ,22072497 ,23578251 ,23925112 ,24182787 ,24030897 ,24412978 ,24636069 ,24989962 ,26185259 ,25167109 ,25392933 ,28569065 ,29203772 ,30557415 ,30335181 ,31342607 ,30998366 ,32251740 ,32875306 ,32876449 ,33547378 ,33585667 ,33991933 ,34249779 ,33595001 ,34805385 ,36695045 ,39131283 ,33613680 ,40497020 ,40721984 ,42771191 ,43774215 ,43976616 ,44124964 ,34717223 ,45379784 ,23048357 ,23048358 ,23048383 ,23048397 ,23049375 ,23049492 ,23049504 ,23049517 ,23811937 ,14830620 ,16397216 ,17439616 ,12361340 ,12361410 ,38804371 ,12361341 ,15245257 ,15708905 ,15931699 ,15983212 ,17379792 ,19750404 ,22202987 ,22309517 ,24800053 ,25101750 ,25101951 ,30272269 ,33364910 ,34866977 ,34991777 ,36740521 ,38539548 ,43083420 ,44963702 ,12413583 ,12413596 ,12413612 ,12413683 ,17053829 ,22317340 ,22318514 ,18331784 ,18331785 ,36646985 ,41380136 ,22678078 ,23931553 ,28330199 ,28330619 ,18341952 ,28327087 ,28327088 ,28327149 ,28327157 ,32601385 ,16395283 ,18266514 ,12387453 ,12543888 ,14415468 ,14506802 ,14873873 ,15519590 ,16274662 ,17129480 ,19086546 ,21790168 ,12361298 ,12361299 ,16544683 ,17087503 ,17087519 ,12361064 ,12361070 ,12361082 ,12361111 ,12361148 ,12361157 ,12361216 ,12658289 ,12689079 ,18205113 ,23168368 ,16326679 ,18421261 ,16326680 ,16333669 ,17903745 ,18281524 ,18868454 ,18868494 ,18868514 ,19570221 ,20237393 ,20573069 ,21951261 ,24348221 ,31541237 ,32712499 ,15501937 ,16765910 ,17444813 ,13047769 ,15469112 ,16952411 ,17444797 ,18811896 ,20929475 ,44208031 ,12361357 ,11576498 ,11576551 ,12361869 ,12686663 ,14676487 ,14695614 ,14746702 ,14830943 ,17229422 ,17464032 ,21565991 ,38350762 ,39201184 ,41441703 ,17388196 ,17388197 ,17980546 ,18150113 ,18183047 ,18279305 ,18439583 ,18675741 ,20800770 ,21408726 ,22406164 ,23353008 ,23353016 ,27365972 ,28827451 ,31745026 ,34534311 ,37079078 ,39890894 ,40948397 ,42040420 ,17046152 ,17046153 ,17079807 ,17958597 ,19568301 ,20043174 ,21430599 ,22541373 ,33989157 ,38341094 ,12360122 ,33498230 ,39201186 ,12443735 ,22555354 ,18240539 ,16080892 ,12361448 ,23490179 ,25968472 ,17561027 ,14889395 ,12733418 ,12360169 ,22244080 ,18402729 ,12909581 ,12723701 ,12361254 ,23104735 ,12430848 ,23926003 ,17382240 ,12361406 ,25669669 ,18541713 ,12361095 ,12743521 ,22931317 ,12361405 ,12361770 ,12361403 ,18183015 ,30532466 ,12361411 ,18149036 ,18246157 ,31476685 ,30161069 ,22270031 ,20466211 ,31692359 ,16036310 ,28291984 ,12361407 ,27606214 ,25688239 ,18823766 ,18428934 ,12430841 ,17501271 ,33295258 ,21438613 ,22135170 ,22244114 ,34076927 ,12361409 ,42122834 ,41442827 ,42141971 ,43060786 ,44467984 ,44467992 ,15265228 ,15528415 ,15256007 ,16223239 ,17444144 ,17444165 ,17573019 ,17703835 ,18267349 ,22491068 ,22812378 ,22825393 ,31919869 ,43511939 ,43623564 );

ERR: mysql_store_results() failed with: (1032) Can't find record in 'unreads'

How to repeat:
Table Layout:
CREATE TABLESPACE ts1 ADD DATAFILE "datafile.dat" USE LOGFILE GROUP LG1
    INITIAL_SIZE 12M ENGINE=NDB;

CREATE TABLE `unreads` (
      id INT NOT NULL,
      version INT NOT NULL,
      value blob,
      PRIMARY KEY (`id`),
      INDEX(id)
) TABLESPACE ts1 STORAGE DISK ENGINE=NDBCLUSTER;

As an alternative, I tried to use a large OR based Where clause of this form "WHERE ID = n OR ID = z, ...." but it still had the same error.

Also testing with the mysql command line client, the query is not successful:
ERROR 1032 (HY000): Can't find record in 'unreads'

If I change the query, to only have one ID in the set, like this:
 SELECT id, version, hex(value) FROM unreads WHERE `ID` IN (12360080);
It returns correctly.

When I add any second ID, it fails.
[7 Feb 2007 7:25] Paul Querna
Two notes:
- This does not seem related to using on-disk-storage.  We have tried it without on-disk, and it does not make a difference.
- It does correctly return zero rows, if there are zero rows in the table. Once any rows are in the table, it fails.
[2 Apr 2007 0:28] Adam Dixon
I could not reproduce this on 5.1.17-beta from BK. Can you provide your config.ini, a sample dataset and steps to reproduce.
[2 Apr 2007 0:52] Paul Querna
This problem stopped when we upgraded to 5.1.15-beta.
[2 Apr 2007 1:05] Adam Dixon
Thank you for your bug report. This issue has already been fixed in the latest released version of that product, which you can download at

  http://www.mysql.com/downloads/