Commit d2992ecb authored by unknown's avatar unknown

Fixed bug when using maria_chk --safe-recover with packed tables

Fixed bug when using maria_chk --safe-recover and getting duplicated keys
Fixed bug when using maria_pack --join


storage/maria/ma_check.c:
  Fixed bug when using --safe-recover with packed tables
  Fixed bug when using --safe-recover and getting duplicated keys
storage/maria/maria_pack.c:
  Fixed bug when using --join
storage/maria/unittest/ma_test_all-t:
  Added test to check maria_pack --join
parent dcdda610
......@@ -2249,7 +2249,7 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info,
if (reenable_logging)
_ma_tmp_disable_logging_for_table(info, 0);
sort_param.filepos= new_header_length=
sort_param.current_filepos= sort_param.filepos= new_header_length=
((param->testflag & T_UNPACK) ? 0L : share->pack.header_length);
if (!rep_quick)
......@@ -2389,9 +2389,9 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info,
_ma_check_print_error(param,"Couldn't delete duplicate row");
goto err;
}
continue;
}
/* purecov: end */
continue;
}
if (!block_record)
{
......@@ -2501,7 +2501,7 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info,
got_error= 0;
/* If invoked by external program that uses thr_lock */
if (&share->state.state != info->state)
memcpy( &share->state.state, info->state, sizeof(*info->state));
memcpy(&share->state.state, info->state, sizeof(*info->state));
err:
if (scan_inited)
......@@ -3606,7 +3606,7 @@ int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info,
got_error=0;
if (&share->state.state != info->state)
memcpy( &share->state.state, info->state, sizeof(*info->state));
memcpy(&share->state.state, info->state, sizeof(*info->state));
err:
if (scan_inited)
......
......@@ -3021,10 +3021,17 @@ static int save_state_mrg(File file,PACK_MRG_INFO *mrg,my_off_t new_length,
options= (mi_uint2korr(state.header.options) | HA_OPTION_COMPRESS_RECORD |
HA_OPTION_READ_ONLY_DATA);
mi_int2store(state.header.options,options);
/* Save the original file type of we have to undo the packing later */
state.header.org_data_file_type= state.header.data_file_type;
state.header.data_file_type= COMPRESSED_RECORD;
state.state.data_file_length=new_length;
state.state.del=0;
state.state.empty=0;
state.state.records=state.split=(ha_rows) mrg->records;
state.create_rename_lsn= state.is_of_horizon= state.skip_redo_lsn=
LSN_REPAIRED_BY_MARIA_CHK;
/* See comment above in save_state about key_file_length handling. */
if (mrg->src_file_has_indexes_disabled)
{
......
......@@ -359,7 +359,15 @@ sub run_pack_tests()
"$maria_path/maria_chk$suffix -se test2",
"$maria_path/maria_pack$suffix --force -s test1",
"$maria_path/maria_chk$suffix -s --unpack --parallel-recover test2",
"$maria_path/maria_chk$suffix -se test2"
"$maria_path/maria_chk$suffix -se test2",
$NEW_TEST,
"$maria_path/ma_test1$suffix $silent -c $row_type",
"cp test1.MAD test2.MAD",
"cp test1.MAI test2.MAI",
"$maria_path/maria_pack$suffix --force -s --join=test3 test1 test2",
"$maria_path/maria_chk -s test3",
"$maria_path/maria_chk -s --safe-recover test3",
"$maria_path/maria_chk -s test3"
);
return &count_tests(\@t) if ($count);
......
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