summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/suite/innodb/r/log_file_size.result11
-rw-r--r--mysql-test/suite/innodb/t/log_file_size.test12
-rw-r--r--sql/sql_show.cc3
-rw-r--r--storage/innobase/trx/trx0sys.cc2
-rw-r--r--storage/innobase/trx/trx0trx.cc5
-rw-r--r--storage/innobase/trx/trx0undo.cc7
6 files changed, 31 insertions, 9 deletions
diff --git a/mysql-test/suite/innodb/r/log_file_size.result b/mysql-test/suite/innodb/r/log_file_size.result
index b73862af7c4..3f8f99fe8c7 100644
--- a/mysql-test/suite/innodb/r/log_file_size.result
+++ b/mysql-test/suite/innodb/r/log_file_size.result
@@ -11,9 +11,16 @@ DELETE FROM t1;
SELECT * FROM t1;
a
42
-INSERT INTO t1 VALUES (123);
+INSERT INTO t1 VALUES (0),(123);
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
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
diff --git a/mysql-test/suite/innodb/t/log_file_size.test b/mysql-test/suite/innodb/t/log_file_size.test
index 9d004991735..9145f2bf13c 100644
--- a/mysql-test/suite/innodb/t/log_file_size.test
+++ b/mysql-test/suite/innodb/t/log_file_size.test
@@ -49,7 +49,7 @@ let $restart_parameters = --innodb-log-files-in-group=3 --innodb-log-file-size=5
SELECT * FROM t1;
-INSERT INTO t1 VALUES (123);
+INSERT INTO t1 VALUES (0),(123);
let MYSQLD_DATADIR= `select @@datadir`;
let SEARCH_ABORT = NOT FOUND;
@@ -57,7 +57,15 @@ let SEARCH_RANGE= -50000;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
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
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 58fc2edc6f2..180856d9f16 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -7609,7 +7609,8 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
case MYSQL_TYPE_BLOB:
if (!(item= new (mem_root)
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);
}
diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc
index 94ea858f729..434e29bcf27 100644
--- a/storage/innobase/trx/trx0sys.cc
+++ b/storage/innobase/trx/trx0sys.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
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
the terms of the GNU General Public License as published by the Free Software
@@ -1097,6 +1098,7 @@ trx_sys_close(void)
/* 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
+ || !srv_was_started
|| srv_read_only_mode
|| srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO);
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index acb73e0ad33..94caf5bd4c0 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
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
the terms of the GNU General Public License as published by the Free Software
@@ -635,7 +635,8 @@ trx_free_prepared(
ut_a(trx_state_eq(trx, TRX_STATE_PREPARED)
|| (trx_state_eq(trx, TRX_STATE_ACTIVE)
&& trx->is_recovered
- && (srv_read_only_mode
+ && (!srv_was_started
+ || srv_read_only_mode
|| srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO)));
ut_a(trx->magic_n == TRX_MAGIC_N);
diff --git a/storage/innobase/trx/trx0undo.cc b/storage/innobase/trx/trx0undo.cc
index aaf0e397607..4bc40680c4b 100644
--- a/storage/innobase/trx/trx0undo.cc
+++ b/storage/innobase/trx/trx0undo.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
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
the terms of the GNU General Public License as published by the Free Software
@@ -2021,7 +2022,8 @@ trx_undo_free_prepared(
case TRX_UNDO_ACTIVE:
/* lock_trx_release_locks() assigns
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);
break;
default:
@@ -2042,7 +2044,8 @@ trx_undo_free_prepared(
case TRX_UNDO_ACTIVE:
/* lock_trx_release_locks() assigns
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);
break;
default: