From what I see, ma_test2 has the array key3[5000], used in a loop which sets
n3=rnd(5000);
and then reads
key3[n3] == ...
while rnd(uint max_value) is
return (uint) ((rand() & 32767)/32767.0*max_value);
which means with some luck it can return max_value itself.
Luck happens, rnd returns 5000, key3[n3] reads something entirely wrong (in my case the value of 'silent' variable which is int and set to 1 as the unit test is launched with -s), the entire condition check with key3[n3] gets twisted, the bogus error occurs.
The following change fixes the problem for me, although maybe there are more elegant solutions.
From what I see, ma_test2 has the array key3[5000], used in a loop which sets
n3=rnd(5000);
and then reads
key3[n3] == ...
while rnd(uint max_value) is 32767.0* max_value) ;
return (uint) ((rand() & 32767)/
which means with some luck it can return max_value itself.
Luck happens, rnd returns 5000, key3[n3] reads something entirely wrong (in my case the value of 'silent' variable which is int and set to 1 as the unit test is launched with -s), the entire condition check with key3[n3] gets twisted, the bogus error occurs.
The following change fixes the problem for me, although maybe there are more elegant solutions.
=== modified file 'storage/ maria/ma_ test2.c' maria/ma_ test2.c 2011-02-25 12:55:40 +0000 maria/ma_ test2.c 2012-04-20 10:05:45 +0000 (char*) record, "%6d:%4d: %8d:Pos: %4d ",n1,n2, n3,write_ count); record+ STANDARD_ LENGTH- 4,(long) i); length( record, (uint) STANDARD_ LENGTH+ rnd(60) );
--- storage/
+++ storage/
@@ -259,7 +259,7 @@
for (i=0 ; i < recant ; i++)
{
ulong blob_length;
- n1=rnd(1000); n2=rnd(100); n3=rnd(5000);
+ n1=rnd(1000); n2=rnd(100); n3=rnd(4999);
sprintf(
int4store(
fix_