Commit 9b1e83db authored by unknown's avatar unknown

porting Serg's fix for BUG#30094 to Maria. Now ma_test_all passes.

maria.test and ps_maria.test still fail.


mysys/mf_keycache.c:
  split string annoys some compilers
storage/maria/ha_maria.cc:
  fix for compiler warnings
storage/maria/ma_test1.c:
  porting Serg's fix for BUG#30094 to Maria
storage/maria/ma_test2.c:
  porting Serg's fix for BUG#30094 to Maria
storage/maria/ma_test3.c:
  porting Serg's fix for BUG#30094 to Maria
storage/maria/ma_test_recovery:
  don't print ma_test1's messages if no problem
parent a3d2ae46
...@@ -2977,8 +2977,8 @@ int key_cache_write(KEY_CACHE *keycache, ...@@ -2977,8 +2977,8 @@ int key_cache_write(KEY_CACHE *keycache,
int error=0; int error=0;
DBUG_ENTER("key_cache_write"); DBUG_ENTER("key_cache_write");
DBUG_PRINT("enter", DBUG_PRINT("enter",
("fd: %u pos: %lu length: %u block_length: %u key_block_length: ("fd: %u pos: %lu length: %u block_length: %u"
%u", " key_block_length: %u",
(uint) file, (ulong) filepos, length, block_length, (uint) file, (ulong) filepos, length, block_length,
keycache ? keycache->key_cache_block_size : 0)); keycache ? keycache->key_cache_block_size : 0));
......
...@@ -746,7 +746,6 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked) ...@@ -746,7 +746,6 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked)
if (!(file= maria_open(name, mode, test_if_locked | HA_OPEN_FROM_SQL_LAYER))) if (!(file= maria_open(name, mode, test_if_locked | HA_OPEN_FROM_SQL_LAYER)))
return (my_errno ? my_errno : -1); return (my_errno ? my_errno : -1);
#ifdef ASK_MONTY
/* /*
This is a protection for the case of a frm and MAI containing incompatible This is a protection for the case of a frm and MAI containing incompatible
table definitions (as in BUG#25908). This was merged from MyISAM. table definitions (as in BUG#25908). This was merged from MyISAM.
...@@ -764,9 +763,13 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked) ...@@ -764,9 +763,13 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked)
goto err; goto err;
/* purecov: end */ /* purecov: end */
} }
#ifdef ASK_MONTY
if (maria_check_definition(keyinfo, recinfo, table->s->keys, recs, if (maria_check_definition(keyinfo, recinfo, table->s->keys, recs,
file->s->keyinfo, file->s->columndef, file->s->keyinfo, file->s->columndef,
file->s->base.keys, file->s->base.fields, true)) file->s->base.keys, file->s->base.fields, true))
#else
if (0)
#endif
{ {
/* purecov: begin inspected */ /* purecov: begin inspected */
my_errno= HA_ERR_CRASHED; my_errno= HA_ERR_CRASHED;
...@@ -774,7 +777,6 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked) ...@@ -774,7 +777,6 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked)
/* purecov: end */ /* purecov: end */
} }
} }
#endif
if (test_if_locked & (HA_OPEN_IGNORE_IF_LOCKED | HA_OPEN_TMP_TABLE)) if (test_if_locked & (HA_OPEN_IGNORE_IF_LOCKED | HA_OPEN_TMP_TABLE))
VOID(maria_extra(file, HA_EXTRA_NO_WAIT_LOCK, 0)); VOID(maria_extra(file, HA_EXTRA_NO_WAIT_LOCK, 0));
......
...@@ -288,7 +288,8 @@ static int run_test(const char *filename) ...@@ -288,7 +288,8 @@ static int run_test(const char *filename)
continue; continue;
create_key(key,j); create_key(key,j);
my_errno=0; my_errno=0;
if ((error = maria_rkey(file,read_record,0,key,0,HA_READ_KEY_EXACT))) if ((error = maria_rkey(file, read_record, 0, key,
HA_WHOLE_KEY, HA_READ_KEY_EXACT)))
{ {
if (verbose || (flags[j] >= 1 || if (verbose || (flags[j] >= 1 ||
(error && my_errno != HA_ERR_KEY_NOT_FOUND))) (error && my_errno != HA_ERR_KEY_NOT_FOUND)))
...@@ -316,7 +317,7 @@ static int run_test(const char *filename) ...@@ -316,7 +317,7 @@ static int run_test(const char *filename)
{ {
create_key(key,i); create_key(key,i);
my_errno=0; my_errno=0;
error=maria_rkey(file,read_record,0,key,0,HA_READ_KEY_EXACT); error=maria_rkey(file,read_record,0,key,HA_WHOLE_KEY,HA_READ_KEY_EXACT);
if (verbose || if (verbose ||
(error == 0 && flags[i] == 0 && unique_key) || (error == 0 && flags[i] == 0 && unique_key) ||
(error && (flags[i] != 0 || my_errno != HA_ERR_KEY_NOT_FOUND))) (error && (flags[i] != 0 || my_errno != HA_ERR_KEY_NOT_FOUND)))
......
...@@ -288,7 +288,7 @@ int main(int argc, char *argv[]) ...@@ -288,7 +288,7 @@ int main(int argc, char *argv[])
if (!j) if (!j)
for (j=999 ; j>0 && key1[j] == 0 ; j--) ; for (j=999 ; j>0 && key1[j] == 0 ; j--) ;
sprintf(key,"%6d",j); sprintf(key,"%6d",j);
if (maria_rkey(file,read_record,0,key,0,HA_READ_KEY_EXACT)) if (maria_rkey(file,read_record,0,key,HA_WHOLE_KEY,HA_READ_KEY_EXACT))
{ {
printf("Test in loop: Can't find key: \"%s\"\n",key); printf("Test in loop: Can't find key: \"%s\"\n",key);
goto err; goto err;
...@@ -321,7 +321,7 @@ int main(int argc, char *argv[]) ...@@ -321,7 +321,7 @@ int main(int argc, char *argv[])
if (j != 0) if (j != 0)
{ {
sprintf(key,"%6d",j); sprintf(key,"%6d",j);
if (maria_rkey(file,read_record,0,key,0,HA_READ_KEY_EXACT)) if (maria_rkey(file,read_record,0,key,HA_WHOLE_KEY,HA_READ_KEY_EXACT))
{ {
printf("can't find key1: \"%s\"\n",key); printf("can't find key1: \"%s\"\n",key);
goto err; goto err;
...@@ -364,7 +364,7 @@ int main(int argc, char *argv[]) ...@@ -364,7 +364,7 @@ int main(int argc, char *argv[])
if (j != 0) if (j != 0)
{ {
sprintf(key,"%6d",j); sprintf(key,"%6d",j);
if (maria_rkey(file,read_record,0,key,0,HA_READ_KEY_EXACT)) if (maria_rkey(file,read_record,0,key,HA_WHOLE_KEY,HA_READ_KEY_EXACT))
{ {
printf("can't find key1: \"%s\"\n",key); printf("can't find key1: \"%s\"\n",key);
goto err; goto err;
...@@ -427,7 +427,7 @@ int main(int argc, char *argv[]) ...@@ -427,7 +427,7 @@ int main(int argc, char *argv[])
DBUG_PRINT("progpos",("first - next -> last - prev -> first")); DBUG_PRINT("progpos",("first - next -> last - prev -> first"));
if (verbose) printf(" Using key: \"%s\" Keys: %d\n",key,dupp_keys); if (verbose) printf(" Using key: \"%s\" Keys: %d\n",key,dupp_keys);
if (maria_rkey(file,read_record,0,key,0,HA_READ_KEY_EXACT)) if (maria_rkey(file,read_record,0,key,HA_WHOLE_KEY,HA_READ_KEY_EXACT))
goto err; goto err;
if (maria_rsame(file,read_record2,-1)) if (maria_rsame(file,read_record2,-1))
goto err; goto err;
...@@ -474,7 +474,7 @@ int main(int argc, char *argv[]) ...@@ -474,7 +474,7 @@ int main(int argc, char *argv[])
} }
/* Check of maria_rnext_same */ /* Check of maria_rnext_same */
if (maria_rkey(file,read_record,0,key,0,HA_READ_KEY_EXACT)) if (maria_rkey(file,read_record,0,key,HA_WHOLE_KEY,HA_READ_KEY_EXACT))
goto err; goto err;
ant=1; ant=1;
while (!maria_rnext_same(file,read_record3) && ant < dupp_keys+10) while (!maria_rnext_same(file,read_record3) && ant < dupp_keys+10)
...@@ -548,7 +548,7 @@ int main(int argc, char *argv[]) ...@@ -548,7 +548,7 @@ int main(int argc, char *argv[])
goto err; goto err;
if (bcmp(read_record2,read_record3,reclength)) if (bcmp(read_record2,read_record3,reclength))
printf("Can't find last record\n"); printf("Can't find last record\n");
#ifdef NOT_ANYMORE
if (!silent) if (!silent)
puts("- Test read key-part"); puts("- Test read key-part");
strmov(key2,key); strmov(key2,key);
...@@ -566,12 +566,14 @@ int main(int argc, char *argv[]) ...@@ -566,12 +566,14 @@ int main(int argc, char *argv[])
goto err; goto err;
} }
} }
#endif
if (dupp_keys > 2) if (dupp_keys > 2)
{ {
if (!silent) if (!silent)
printf("- Read key (first) - next - delete - next -> last\n"); printf("- Read key (first) - next - delete - next -> last\n");
DBUG_PRINT("progpos",("first - next - delete - next -> last")); DBUG_PRINT("progpos",("first - next - delete - next -> last"));
if (maria_rkey(file,read_record,0,key,0,HA_READ_KEY_EXACT)) goto err; if (maria_rkey(file,read_record,0,key,HA_WHOLE_KEY,HA_READ_KEY_EXACT))
goto err;
if (maria_rnext(file,read_record3,0)) goto err; if (maria_rnext(file,read_record3,0)) goto err;
if (maria_delete(file,read_record3)) goto err; if (maria_delete(file,read_record3)) goto err;
opt_delete++; opt_delete++;
...@@ -607,7 +609,8 @@ int main(int argc, char *argv[]) ...@@ -607,7 +609,8 @@ int main(int argc, char *argv[])
if (!silent) if (!silent)
printf("- Read first - delete - next -> last\n"); printf("- Read first - delete - next -> last\n");
DBUG_PRINT("progpos",("first - delete - next -> last")); DBUG_PRINT("progpos",("first - delete - next -> last"));
if (maria_rkey(file,read_record3,0,key,0,HA_READ_KEY_EXACT)) goto err; if (maria_rkey(file,read_record3,0,key,HA_WHOLE_KEY,HA_READ_KEY_EXACT))
goto err;
if (maria_delete(file,read_record3)) goto err; if (maria_delete(file,read_record3)) goto err;
opt_delete++; opt_delete++;
ant=1; ant=1;
...@@ -681,10 +684,10 @@ int main(int argc, char *argv[]) ...@@ -681,10 +684,10 @@ int main(int argc, char *argv[])
copy_key(file,(uint) i,(uchar*) read_record,(uchar*) key); copy_key(file,(uint) i,(uchar*) read_record,(uchar*) key);
copy_key(file,(uint) i,(uchar*) read_record2,(uchar*) key2); copy_key(file,(uint) i,(uchar*) read_record2,(uchar*) key2);
min_key.key= key; min_key.key= key;
min_key.length= USE_WHOLE_KEY; min_key.keypart_map= HA_WHOLE_KEY;
min_key.flag= HA_READ_KEY_EXACT; min_key.flag= HA_READ_KEY_EXACT;
max_key.key= key2; max_key.key= key2;
max_key.length= USE_WHOLE_KEY; max_key.keypart_map= HA_WHOLE_KEY;
max_key.flag= HA_READ_AFTER_KEY; max_key.flag= HA_READ_AFTER_KEY;
range_records= maria_records_in_range(file,(int) i, &min_key, &max_key); range_records= maria_records_in_range(file,(int) i, &min_key, &max_key);
......
...@@ -243,7 +243,7 @@ int test_read(MARIA_HA *file,int id) ...@@ -243,7 +243,7 @@ int test_read(MARIA_HA *file,int id)
{ {
find=rnd(100000); find=rnd(100000);
if (!maria_rkey(file,record.id,1,(uchar*) &find, if (!maria_rkey(file,record.id,1,(uchar*) &find,
sizeof(find),HA_READ_KEY_EXACT)) HA_WHOLE_KEY,HA_READ_KEY_EXACT))
found++; found++;
else else
{ {
...@@ -426,7 +426,7 @@ int test_update(MARIA_HA *file,int id,int lock_type) ...@@ -426,7 +426,7 @@ int test_update(MARIA_HA *file,int id,int lock_type)
tmp=rnd(100000); tmp=rnd(100000);
int4store(find,tmp); int4store(find,tmp);
if (!maria_rkey(file,record.id,1,(uchar*) find, if (!maria_rkey(file,record.id,1,(uchar*) find,
sizeof(find),HA_READ_KEY_EXACT)) HA_WHOLE_KEY,HA_READ_KEY_EXACT))
found++; found++;
else else
{ {
......
set -e set -e
silent="-s"
if [ -z "$maria_path" ] if [ -z "$maria_path" ]
then then
maria_path="." maria_path="."
...@@ -13,7 +13,7 @@ echo "MARIA RECOVERY TESTS - success is if exit code is 0" ...@@ -13,7 +13,7 @@ echo "MARIA RECOVERY TESTS - success is if exit code is 0"
# Does not test the index file as we don't have logging for it yet. # Does not test the index file as we don't have logging for it yet.
rm -f maria_log* rm -f maria_log*
prog="$maria_path/ma_test1 -M -T --skip-update" prog="$maria_path/ma_test1 $silent -M -T --skip-update"
echo "TEST WITH $prog" echo "TEST WITH $prog"
$prog $prog
mv -f test1.MAD test1.MAD.good mv -f test1.MAD test1.MAD.good
...@@ -24,7 +24,7 @@ cmp test1.MAD test1.MAD.good ...@@ -24,7 +24,7 @@ cmp test1.MAD test1.MAD.good
rm -f test1.* rm -f test1.*
rm -f maria_log* rm -f maria_log*
prog="$maria_path/ma_test2 -s -L -K -W -P -M -T -g" prog="$maria_path/ma_test2 $silent -L -K -W -P -M -T -g"
echo "TEST WITH $prog" echo "TEST WITH $prog"
$prog $prog
mv -f test2.MAD test2.MAD.good mv -f test2.MAD test2.MAD.good
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment