Commit 66c6188a authored by Marko Mäkelä's avatar Marko Mäkelä

Relax assertions on shutdown after aborted startup.

A proper InnoDB shutdown after aborted startup was introduced
in commit 81b7fe9d.

Also related to this is MDEV-11985, making read-only shutdown more robust.

If startup was aborted, there may exist recovered transactions that were
not rolled back. Relax the assertions accordingly.
parent 070a8754
...@@ -11,9 +11,16 @@ DELETE FROM t1; ...@@ -11,9 +11,16 @@ DELETE FROM t1;
SELECT * FROM t1; SELECT * FROM t1;
a a
42 42
INSERT INTO t1 VALUES (123); INSERT INTO t1 VALUES (0),(123);
BEGIN; BEGIN;
DELETE FROM t1; DELETE FROM t1 WHERE a>0;
# Persist the state of the above incomplete transaction by
# causing a redo log write for another transaction.
connect con1, localhost, root;
SET GLOBAL innodb_flush_log_at_trx_commit=1;
DELETE FROM t1 WHERE a=0;
disconnect con1;
connection default;
# Kill the server # Kill the server
SELECT * FROM t1; SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB' ERROR 42000: Unknown storage engine 'InnoDB'
......
...@@ -49,7 +49,7 @@ let $restart_parameters = --innodb-log-files-in-group=3 --innodb-log-file-size=5 ...@@ -49,7 +49,7 @@ let $restart_parameters = --innodb-log-files-in-group=3 --innodb-log-file-size=5
SELECT * FROM t1; SELECT * FROM t1;
INSERT INTO t1 VALUES (123); INSERT INTO t1 VALUES (0),(123);
let MYSQLD_DATADIR= `select @@datadir`; let MYSQLD_DATADIR= `select @@datadir`;
let SEARCH_ABORT = NOT FOUND; let SEARCH_ABORT = NOT FOUND;
...@@ -57,7 +57,15 @@ let SEARCH_RANGE= -50000; ...@@ -57,7 +57,15 @@ let SEARCH_RANGE= -50000;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
BEGIN; BEGIN;
DELETE FROM t1; DELETE FROM t1 WHERE a>0;
--echo # Persist the state of the above incomplete transaction by
--echo # causing a redo log write for another transaction.
--connect(con1, localhost, root)
SET GLOBAL innodb_flush_log_at_trx_commit=1;
DELETE FROM t1 WHERE a=0;
--disconnect con1
--connection default
--source include/kill_mysqld.inc --source include/kill_mysqld.inc
......
...@@ -7609,7 +7609,8 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list) ...@@ -7609,7 +7609,8 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
case MYSQL_TYPE_BLOB: case MYSQL_TYPE_BLOB:
if (!(item= new (mem_root) if (!(item= new (mem_root)
Item_blob(thd, fields_info->field_name, Item_blob(thd, fields_info->field_name,
fields_info->field_length))) std::min(unsigned (strlen(fields_info->field_name)),
fields_info->field_length))))
{ {
DBUG_RETURN(0); DBUG_RETURN(0);
} }
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -1097,6 +1098,7 @@ trx_sys_close(void) ...@@ -1097,6 +1098,7 @@ trx_sys_close(void)
/* Only prepared transactions may be left in the system. Free them. */ /* Only prepared transactions may be left in the system. Free them. */
ut_a(UT_LIST_GET_LEN(trx_sys->rw_trx_list) == trx_sys->n_prepared_trx ut_a(UT_LIST_GET_LEN(trx_sys->rw_trx_list) == trx_sys->n_prepared_trx
|| !srv_was_started
|| srv_read_only_mode || srv_read_only_mode
|| srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO); || srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO);
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2016, MariaDB Corporation. Copyright (c) 2015, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -635,7 +635,8 @@ trx_free_prepared( ...@@ -635,7 +635,8 @@ trx_free_prepared(
ut_a(trx_state_eq(trx, TRX_STATE_PREPARED) ut_a(trx_state_eq(trx, TRX_STATE_PREPARED)
|| (trx_state_eq(trx, TRX_STATE_ACTIVE) || (trx_state_eq(trx, TRX_STATE_ACTIVE)
&& trx->is_recovered && trx->is_recovered
&& (srv_read_only_mode && (!srv_was_started
|| srv_read_only_mode
|| srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO))); || srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO)));
ut_a(trx->magic_n == TRX_MAGIC_N); ut_a(trx->magic_n == TRX_MAGIC_N);
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -2021,7 +2022,8 @@ trx_undo_free_prepared( ...@@ -2021,7 +2022,8 @@ trx_undo_free_prepared(
case TRX_UNDO_ACTIVE: case TRX_UNDO_ACTIVE:
/* lock_trx_release_locks() assigns /* lock_trx_release_locks() assigns
trx->is_recovered=false */ trx->is_recovered=false */
ut_a(srv_read_only_mode ut_a(!srv_was_started
|| srv_read_only_mode
|| srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO); || srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO);
break; break;
default: default:
...@@ -2042,7 +2044,8 @@ trx_undo_free_prepared( ...@@ -2042,7 +2044,8 @@ trx_undo_free_prepared(
case TRX_UNDO_ACTIVE: case TRX_UNDO_ACTIVE:
/* lock_trx_release_locks() assigns /* lock_trx_release_locks() assigns
trx->is_recovered=false */ trx->is_recovered=false */
ut_a(srv_read_only_mode ut_a(!srv_was_started
|| srv_read_only_mode
|| srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO); || srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO);
break; break;
default: default:
......
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