summaryrefslogtreecommitdiff
path: root/storage/xtradb
diff options
context:
space:
mode:
Diffstat (limited to 'storage/xtradb')
-rw-r--r--storage/xtradb/buf/buf0dump.cc4
-rw-r--r--storage/xtradb/handler/ha_innodb.cc57
-rw-r--r--storage/xtradb/lock/lock0lock.cc5
-rw-r--r--storage/xtradb/log/log0log.cc13
-rw-r--r--storage/xtradb/srv/srv0srv.cc14
-rw-r--r--storage/xtradb/trx/trx0purge.cc18
6 files changed, 78 insertions, 33 deletions
diff --git a/storage/xtradb/buf/buf0dump.cc b/storage/xtradb/buf/buf0dump.cc
index 90358d34b04..e9168d9f5d5 100644
--- a/storage/xtradb/buf/buf0dump.cc
+++ b/storage/xtradb/buf/buf0dump.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2017, 2018, 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
@@ -334,7 +334,7 @@ buf_dump(
i + 1, srv_buf_pool_instances,
j + 1, n_pages);
}
- if ( (j % 1024) == 0) {
+ if (SHUTTING_DOWN() && !(j % 1024)) {
service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
"Dumping buffer pool "
ULINTPF "/" ULINTPF ", "
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 988b10522a4..c34f832d5f6 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -8951,8 +8951,25 @@ set_max_autoinc:
ulonglong increment;
dberr_t err;
- offset = prebuilt->autoinc_offset;
- increment = prebuilt->autoinc_increment;
+#ifdef WITH_WSREP
+ /* Applier threads which are
+ processing ROW events and don't go
+ through server level autoinc
+ processing, therefore m_prebuilt
+ autoinc values don't get
+ properly assigned. Fetch values from
+ server side. */
+ if (wsrep_on(current_thd) &&
+ wsrep_thd_exec_mode(current_thd) == REPL_RECV) {
+ wsrep_thd_auto_increment_variables(current_thd, &offset, &increment);
+ } else {
+#endif /* WITH_WSREP */
+ ut_a(prebuilt->autoinc_increment > 0);
+ offset = prebuilt->autoinc_offset;
+ increment = prebuilt->autoinc_increment;
+#ifdef WITH_WSREP
+ }
+#endif /* WITH_WSREP */
auto_inc = innobase_next_autoinc(
auto_inc,
@@ -9465,16 +9482,32 @@ ha_innobase::update_row(
/* We need the upper limit of the col type to check for
whether we update the table autoinc counter or not. */
- col_max_value = innobase_get_int_col_max_value(
- table->next_number_field);
+ col_max_value =
+ table->next_number_field->get_max_int_value();
if (auto_inc <= col_max_value && auto_inc != 0) {
ulonglong offset;
ulonglong increment;
- offset = prebuilt->autoinc_offset;
- increment = prebuilt->autoinc_increment;
+#ifdef WITH_WSREP
+ /* Applier threads which are processing
+ ROW events and don't go through server
+ level autoinc processing, therefore
+ m_prebuilt autoinc values don't get
+ properly assigned. Fetch values from
+ server side. */
+ if (wsrep_on(current_thd) &&
+ wsrep_thd_exec_mode(current_thd) == REPL_RECV) {
+ wsrep_thd_auto_increment_variables(
+ current_thd, &offset, &increment);
+ } else {
+#endif /* WITH_WSREP */
+ offset = prebuilt->autoinc_offset;
+ increment = prebuilt->autoinc_increment;
+#ifdef WITH_WSREP
+ }
+#endif /* WITH_WSREP */
auto_inc = innobase_next_autoinc(
auto_inc, 1, increment, offset, col_max_value);
@@ -16705,13 +16738,13 @@ ha_innobase::get_auto_increment(
increment,
thd_get_thread_id(ha_thd()),
current, autoinc);
- if (!wsrep_on(ha_thd()))
- {
- current = autoinc - prebuilt->autoinc_increment;
- }
- current = innobase_next_autoinc(
- current, 1, increment, offset, col_max_value);
+ if (!wsrep_on(ha_thd())) {
+ current = autoinc - prebuilt->autoinc_increment;
+
+ current = innobase_next_autoinc(
+ current, 1, increment, offset, col_max_value);
+ }
dict_table_autoinc_initialize(prebuilt->table, current);
diff --git a/storage/xtradb/lock/lock0lock.cc b/storage/xtradb/lock/lock0lock.cc
index 549cc411f69..2183d281b78 100644
--- a/storage/xtradb/lock/lock0lock.cc
+++ b/storage/xtradb/lock/lock0lock.cc
@@ -5003,7 +5003,7 @@ lock_table_create(
UT_LIST_ADD_LAST(trx_locks, trx->lock.trx_locks, lock);
#ifdef WITH_WSREP
- if (c_lock) {
+ if (c_lock && wsrep_on_trx(trx)) {
if (wsrep_thd_is_wsrep(trx->mysql_thd)
&& wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
UT_LIST_INSERT_AFTER(
@@ -5244,9 +5244,10 @@ lock_table_enqueue_waiting(
/* Enqueue the lock request that will wait to be granted */
#ifdef WITH_WSREP
- if (trx->lock.was_chosen_as_deadlock_victim) {
+ if (trx->lock.was_chosen_as_deadlock_victim && wsrep_on_trx(trx)) {
return(DB_DEADLOCK);
}
+
lock = lock_table_create(c_lock, table, mode | LOCK_WAIT, trx);
#else
lock = lock_table_create(table, mode | LOCK_WAIT, trx);
diff --git a/storage/xtradb/log/log0log.cc b/storage/xtradb/log/log0log.cc
index 1420f5a3a12..19b4ac3732a 100644
--- a/storage/xtradb/log/log0log.cc
+++ b/storage/xtradb/log/log0log.cc
@@ -1561,12 +1561,6 @@ log_write_up_to(
return;
}
- if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
- service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
- "log write up to: " LSN_PF,
- lsn);
- }
-
loop:
ut_ad(++loop_count < 100);
@@ -1679,6 +1673,13 @@ loop:
log_sys->buf_free += OS_FILE_LOG_BLOCK_SIZE;
log_sys->write_end_offset = log_sys->buf_free;
+ if (UNIV_UNLIKELY(srv_shutdown_state != SRV_SHUTDOWN_NONE)) {
+ service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
+ "InnoDB log write: "
+ LSN_PF "," LSN_PF,
+ log_sys->write_lsn, lsn);
+ }
+
group = UT_LIST_GET_FIRST(log_sys->log_groups);
/* Do the write to the log files */
diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc
index 3e3b44d9106..25f7e71a583 100644
--- a/storage/xtradb/srv/srv0srv.cc
+++ b/storage/xtradb/srv/srv0srv.cc
@@ -3231,9 +3231,17 @@ srv_purge_should_exit(ulint n_purged)
}
/* Slow shutdown was requested. */
if (n_purged) {
- service_manager_extend_timeout(
- INNODB_EXTEND_TIMEOUT_INTERVAL,
- "InnoDB " ULINTPF " pages purged", n_purged);
+#if defined HAVE_SYSTEMD && !defined EMBEDDED_LIBRARY
+ static ib_time_t progress_time;
+ ib_time_t time = ut_time();
+ if (time - progress_time >= 15) {
+ progress_time = time;
+ service_manager_extend_timeout(
+ INNODB_EXTEND_TIMEOUT_INTERVAL,
+ "InnoDB: to purge " ULINTPF " transactions",
+ trx_sys->rseg_history_len);
+ }
+#endif
/* The previous round still did some work. */
return(false);
}
diff --git a/storage/xtradb/trx/trx0purge.cc b/storage/xtradb/trx/trx0purge.cc
index cbf783628f9..893dc8f398c 100644
--- a/storage/xtradb/trx/trx0purge.cc
+++ b/storage/xtradb/trx/trx0purge.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2017, 2018, 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
@@ -247,18 +247,20 @@ trx_purge_add_update_undo_to_history(
hist_size + undo->size, MLOG_4BYTES, mtr);
}
- /* Before any transaction-generating background threads or the
+ /* After the purge thread has been given permission to exit,
+ we may roll back transactions (trx->undo_no==0)
+ in THD::cleanup() invoked from unlink_thd() in fast shutdown,
+ or in trx_rollback_resurrected() in slow shutdown.
+
+ Before any transaction-generating background threads or the
purge have been started, recv_recovery_rollback_active() can
start transactions in row_merge_drop_temp_indexes() and
- fts_drop_orphaned_tables(), and roll back recovered transactions.
- After the purge thread has been given permission to exit,
- in fast shutdown, we may roll back transactions (trx->undo_no==0)
- in THD::cleanup() invoked from unlink_thd(). */
+ fts_drop_orphaned_tables(), and roll back recovered transactions. */
ut_ad(srv_undo_sources
+ || trx->undo_no == 0
|| ((srv_startup_is_before_trx_rollback_phase
|| trx_rollback_or_clean_is_active)
- && purge_sys->state == PURGE_STATE_INIT)
- || (trx->undo_no == 0 && srv_fast_shutdown));
+ && purge_sys->state == PURGE_STATE_INIT));
/* Add the log as the first in the history list */
flst_add_first(rseg_header + TRX_RSEG_HISTORY,