Commit e3da48ba authored by Sergei Golubchik's avatar Sergei Golubchik

merged

parents 141a75fa 92c42182
...@@ -63,5 +63,31 @@ ok ...@@ -63,5 +63,31 @@ ok
* compared t1 to old version * compared t1 to old version
use mysqltest; use mysqltest;
drop table t1; drop table t1;
create table t1 engine=maria select 1;
* copied t1 for feeding_recovery
set global maria_checkpoint_interval=0;
insert into t1 values(2);
truncate table t1;
flush table t1;
* copied t1 for comparison
truncate table t1;
SET SESSION debug="+d,maria_flush_whole_log,maria_crash_create_table";
* crashing mysqld intentionally
truncate table t1;
ERROR HY000: Lost connection to MySQL server during query
* recovery happens
check table t1 extended;
Table Op Msg_type Msg_text
mysqltest.t1 check warning Size of indexfile is: 372 Should be: 8192
mysqltest.t1 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
use mysqltest;
truncate table t1;
check table t1 extended;
Table Op Msg_type Msg_text
mysqltest.t1 check status OK
drop table t1;
drop database mysqltest_for_comparison; drop database mysqltest_for_comparison;
drop database mysqltest; drop database mysqltest;
...@@ -88,6 +88,28 @@ check table t1 extended; ...@@ -88,6 +88,28 @@ check table t1 extended;
-- source include/maria_verify_recovery.inc -- source include/maria_verify_recovery.inc
drop table t1; drop table t1;
# Test for BUG#42112 "Maria: recovery failure (pushbuild2) Assertion
# `rownr == 0 && new_page' failed"
let $mvr_restore_old_snapshot=0;
let $mms_compare_physically=0;
create table t1 engine=maria select 1;
-- source include/maria_make_snapshot_for_feeding_recovery.inc
set global maria_checkpoint_interval=0; # no checkpoints
insert into t1 values(2);
truncate table t1;
-- source include/maria_make_snapshot_for_comparison.inc
let $mvr_crash_statement= truncate table t1;
let $mvr_debug_option="+d,maria_flush_whole_log,maria_crash_create_table";
truncate table t1;
-- source include/maria_verify_recovery.inc
# Table is bad but at least Recovery didn't crash and a new truncate
# can succeed:
truncate table t1;
check table t1 extended;
drop table t1;
# clean up everything # clean up everything
let $mms_purpose=comparison; let $mms_purpose=comparison;
eval drop database mysqltest_for_$mms_purpose; eval drop database mysqltest_for_$mms_purpose;
......
...@@ -751,6 +751,13 @@ int maria_create(const char *name, enum data_file_type datafile_type, ...@@ -751,6 +751,13 @@ int maria_create(const char *name, enum data_file_type datafile_type,
(via maria_recreate_table()) and it does not have a log. (via maria_recreate_table()) and it does not have a log.
*/ */
sync_dir= MY_SYNC_DIR; sync_dir= MY_SYNC_DIR;
/*
If crash between _ma_state_info_write_sub() and
_ma_update_state__lsns_sub(), table should be ignored by Recovery (or
old REDOs would fail), so we cannot let LSNs be 0:
*/
share.state.skip_redo_lsn= share.state.is_of_horizon=
share.state.create_rename_lsn= LSN_MAX;
} }
if (datafile_type == DYNAMIC_RECORD) if (datafile_type == DYNAMIC_RECORD)
...@@ -1060,11 +1067,21 @@ int maria_create(const char *name, enum data_file_type datafile_type, ...@@ -1060,11 +1067,21 @@ int maria_create(const char *name, enum data_file_type datafile_type,
log_array, NULL, NULL) || log_array, NULL, NULL) ||
translog_flush(lsn))) translog_flush(lsn)))
goto err; goto err;
share.kfile.file= file;
DBUG_EXECUTE_IF("maria_flush_whole_log",
{
DBUG_PRINT("maria_flush_whole_log", ("now"));
translog_flush(translog_get_horizon());
});
DBUG_EXECUTE_IF("maria_crash_create_table",
{
DBUG_PRINT("maria_crash_create_table", ("now"));
DBUG_ABORT();
});
/* /*
store LSN into file, needed for Recovery to not be confused if a store LSN into file, needed for Recovery to not be confused if a
DROP+CREATE happened (applying REDOs to the wrong table). DROP+CREATE happened (applying REDOs to the wrong table).
*/ */
share.kfile.file= file;
if (_ma_update_state_lsns_sub(&share, lsn, trnman_get_min_safe_trid(), if (_ma_update_state_lsns_sub(&share, lsn, trnman_get_min_safe_trid(),
FALSE, TRUE)) FALSE, TRUE))
goto err; goto err;
......
...@@ -115,6 +115,12 @@ int maria_delete_all_rows(MARIA_HA *info) ...@@ -115,6 +115,12 @@ int maria_delete_all_rows(MARIA_HA *info)
but redo_insert are skipped (dirty pages list is empty). but redo_insert are skipped (dirty pages list is empty).
To avoid this, we need to set skip_redo_lsn now, and thus need to sync To avoid this, we need to set skip_redo_lsn now, and thus need to sync
files. files.
Also fixes the problem of:
bulk insert; insert; delete_all; crash:
"bulk insert" is skipped (no REDOs), so if "insert" would not be skipped
(if we didn't update skip_redo_lsn below) then "insert" would be tried
and fail, saying that it sees that the first page has to be created
though the inserted row has rownr>0.
*/ */
my_bool error= _ma_state_info_write(share, 1|4) || my_bool error= _ma_state_info_write(share, 1|4) ||
_ma_update_state_lsns(share, lsn, trnman_get_min_trid(), FALSE, FALSE) || _ma_update_state_lsns(share, lsn, trnman_get_min_trid(), FALSE, FALSE) ||
......
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