Commit 8eff803a authored by Marko Mäkelä's avatar Marko Mäkelä

Revert "MDEV-14705: Do not rollback on InnoDB shutdown"

This reverts commit 76ec37f5.

This behaviour change will be done separately in:
MDEV-15832 With innodb_fast_shutdown=3, skip the rollback
of connected transactions
parent ecf6675c
/***************************************************************************** /*****************************************************************************
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, 2018, MariaDB Corporation. 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
...@@ -105,8 +105,11 @@ trx_undo_rec_release( ...@@ -105,8 +105,11 @@ trx_undo_rec_release(
/*=================*/ /*=================*/
trx_t* trx, /*!< in/out: transaction */ trx_t* trx, /*!< in/out: transaction */
undo_no_t undo_no);/*!< in: undo number */ undo_no_t undo_no);/*!< in: undo number */
/** Report progress when rolling back a row of a recovered transaction. */ /** Report progress when rolling back a row of a recovered transaction.
UNIV_INTERN void trx_roll_report_progress(); @return whether the rollback should be aborted due to pending shutdown */
UNIV_INTERN
bool
trx_roll_must_shutdown();
/*******************************************************************//** /*******************************************************************//**
Rollback or clean up any incomplete transactions which were Rollback or clean up any incomplete transactions which were
encountered in crash recovery. If the transaction already was encountered in crash recovery. If the transaction already was
......
...@@ -45,7 +45,6 @@ Created 1/8/1997 Heikki Tuuri ...@@ -45,7 +45,6 @@ Created 1/8/1997 Heikki Tuuri
#include "row0upd.h" #include "row0upd.h"
#include "row0mysql.h" #include "row0mysql.h"
#include "srv0srv.h" #include "srv0srv.h"
#include "srv0start.h"
/* How to undo row operations? /* How to undo row operations?
(1) For an insert, we have stored a prefix of the clustered index record (1) For an insert, we have stored a prefix of the clustered index record
...@@ -350,17 +349,13 @@ row_undo_step( ...@@ -350,17 +349,13 @@ row_undo_step(
ut_ad(que_node_get_type(node) == QUE_NODE_UNDO); ut_ad(que_node_get_type(node) == QUE_NODE_UNDO);
if (UNIV_UNLIKELY(trx_get_dict_operation(trx) == TRX_DICT_OP_NONE if (UNIV_UNLIKELY(trx == trx_roll_crash_recv_trx)
&& !srv_undo_sources && srv_fast_shutdown)) { && trx_roll_must_shutdown()) {
/* Shutdown has been initiated. */ /* Shutdown has been initiated. */
trx->error_state = DB_INTERRUPTED; trx->error_state = DB_INTERRUPTED;
return(NULL); return(NULL);
} }
if (UNIV_UNLIKELY(trx == trx_roll_crash_recv_trx)) {
trx_roll_report_progress();
}
err = row_undo(node, thr); err = row_undo(node, thr);
trx->error_state = err; trx->error_state = err;
......
...@@ -719,9 +719,21 @@ trx_rollback_resurrected( ...@@ -719,9 +719,21 @@ trx_rollback_resurrected(
goto func_exit; goto func_exit;
} }
/** Report progress when rolling back a row of a recovered transaction. */ /** Report progress when rolling back a row of a recovered transaction.
UNIV_INTERN void trx_roll_report_progress() @return whether the rollback should be aborted due to pending shutdown */
UNIV_INTERN
bool
trx_roll_must_shutdown()
{ {
const trx_t* trx = trx_roll_crash_recv_trx;
ut_ad(trx);
ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE));
if (trx_get_dict_operation(trx) == TRX_DICT_OP_NONE
&& !srv_undo_sources && srv_fast_shutdown) {
return true;
}
ib_time_t time = ut_time(); ib_time_t time = ut_time();
mutex_enter(&trx_sys->mutex); mutex_enter(&trx_sys->mutex);
mutex_enter(&recv_sys->mutex); mutex_enter(&recv_sys->mutex);
...@@ -755,6 +767,7 @@ UNIV_INTERN void trx_roll_report_progress() ...@@ -755,6 +767,7 @@ UNIV_INTERN void trx_roll_report_progress()
mutex_exit(&recv_sys->mutex); mutex_exit(&recv_sys->mutex);
mutex_exit(&trx_sys->mutex); mutex_exit(&trx_sys->mutex);
return false;
} }
/*******************************************************************//** /*******************************************************************//**
......
/***************************************************************************** /*****************************************************************************
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, 2018, MariaDB Corporation. 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
...@@ -106,8 +106,11 @@ trx_undo_rec_release( ...@@ -106,8 +106,11 @@ trx_undo_rec_release(
/*=================*/ /*=================*/
trx_t* trx, /*!< in/out: transaction */ trx_t* trx, /*!< in/out: transaction */
undo_no_t undo_no);/*!< in: undo number */ undo_no_t undo_no);/*!< in: undo number */
/** Report progress when rolling back a row of a recovered transaction. */ /** Report progress when rolling back a row of a recovered transaction.
UNIV_INTERN void trx_roll_report_progress(); @return whether the rollback should be aborted due to pending shutdown */
UNIV_INTERN
bool
trx_roll_must_shutdown();
/*******************************************************************//** /*******************************************************************//**
Rollback or clean up any incomplete transactions which were Rollback or clean up any incomplete transactions which were
encountered in crash recovery. If the transaction already was encountered in crash recovery. If the transaction already was
......
...@@ -45,7 +45,6 @@ Created 1/8/1997 Heikki Tuuri ...@@ -45,7 +45,6 @@ Created 1/8/1997 Heikki Tuuri
#include "row0upd.h" #include "row0upd.h"
#include "row0mysql.h" #include "row0mysql.h"
#include "srv0srv.h" #include "srv0srv.h"
#include "srv0start.h"
/* How to undo row operations? /* How to undo row operations?
(1) For an insert, we have stored a prefix of the clustered index record (1) For an insert, we have stored a prefix of the clustered index record
...@@ -350,17 +349,13 @@ row_undo_step( ...@@ -350,17 +349,13 @@ row_undo_step(
ut_ad(que_node_get_type(node) == QUE_NODE_UNDO); ut_ad(que_node_get_type(node) == QUE_NODE_UNDO);
if (UNIV_UNLIKELY(trx_get_dict_operation(trx) == TRX_DICT_OP_NONE if (UNIV_UNLIKELY(trx == trx_roll_crash_recv_trx)
&& !srv_undo_sources && srv_fast_shutdown)) { && trx_roll_must_shutdown()) {
/* Shutdown has been initiated. */ /* Shutdown has been initiated. */
trx->error_state = DB_INTERRUPTED; trx->error_state = DB_INTERRUPTED;
return(NULL); return(NULL);
} }
if (UNIV_UNLIKELY(trx == trx_roll_crash_recv_trx)) {
trx_roll_report_progress();
}
err = row_undo(node, thr); err = row_undo(node, thr);
trx->error_state = err; trx->error_state = err;
......
...@@ -731,9 +731,21 @@ trx_rollback_resurrected( ...@@ -731,9 +731,21 @@ trx_rollback_resurrected(
goto func_exit; goto func_exit;
} }
/** Report progress when rolling back a row of a recovered transaction. */ /** Report progress when rolling back a row of a recovered transaction.
UNIV_INTERN void trx_roll_report_progress() @return whether the rollback should be aborted due to pending shutdown */
UNIV_INTERN
bool
trx_roll_must_shutdown()
{ {
const trx_t* trx = trx_roll_crash_recv_trx;
ut_ad(trx);
ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE));
if (trx_get_dict_operation(trx) == TRX_DICT_OP_NONE
&& !srv_undo_sources && srv_fast_shutdown) {
return true;
}
ib_time_t time = ut_time(); ib_time_t time = ut_time();
mutex_enter(&trx_sys->mutex); mutex_enter(&trx_sys->mutex);
mutex_enter(&recv_sys->mutex); mutex_enter(&recv_sys->mutex);
...@@ -767,6 +779,7 @@ UNIV_INTERN void trx_roll_report_progress() ...@@ -767,6 +779,7 @@ UNIV_INTERN void trx_roll_report_progress()
mutex_exit(&recv_sys->mutex); mutex_exit(&recv_sys->mutex);
mutex_exit(&trx_sys->mutex); mutex_exit(&trx_sys->mutex);
return 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