Merge 10.2 into 10.3
This commit is contained in:
commit
3568fad5c9
@ -1,7 +1,7 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Copyright (c) 2012, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
Copyright (c) 2012, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
||||||
Copyright (c) 2017, 2018, MariaDB Corporation.
|
Copyright (c) 2017, 2020, 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
|
||||||
@ -32,6 +32,7 @@ Created Apr 25, 2012 Vasil Dimov
|
|||||||
#include "srv0start.h"
|
#include "srv0start.h"
|
||||||
#include "fil0fil.h"
|
#include "fil0fil.h"
|
||||||
#ifdef WITH_WSREP
|
#ifdef WITH_WSREP
|
||||||
|
# include "trx0trx.h"
|
||||||
# include "mysql/service_wsrep.h"
|
# include "mysql/service_wsrep.h"
|
||||||
# include "wsrep.h"
|
# include "wsrep.h"
|
||||||
# include "log.h"
|
# include "log.h"
|
||||||
@ -147,12 +148,12 @@ dict_stats_recalc_pool_add(
|
|||||||
schedule new estimates for table and index statistics to be calculated.
|
schedule new estimates for table and index statistics to be calculated.
|
||||||
@param[in,out] table persistent or temporary table
|
@param[in,out] table persistent or temporary table
|
||||||
@param[in] thd current session */
|
@param[in] thd current session */
|
||||||
void dict_stats_update_if_needed(dict_table_t* table, THD* thd)
|
void dict_stats_update_if_needed(dict_table_t *table, const trx_t &trx)
|
||||||
#else
|
#else
|
||||||
/** Update the table modification counter and if necessary,
|
/** Update the table modification counter and if necessary,
|
||||||
schedule new estimates for table and index statistics to be calculated.
|
schedule new estimates for table and index statistics to be calculated.
|
||||||
@param[in,out] table persistent or temporary table */
|
@param[in,out] table persistent or temporary table */
|
||||||
void dict_stats_update_if_needed_func(dict_table_t* table)
|
void dict_stats_update_if_needed_func(dict_table_t *table)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
ut_ad(table->stat_initialized);
|
ut_ad(table->stat_initialized);
|
||||||
@ -179,10 +180,9 @@ void dict_stats_update_if_needed_func(dict_table_t* table)
|
|||||||
generated row locks and allow BF thread
|
generated row locks and allow BF thread
|
||||||
lock waits to be enqueued at head of waiting
|
lock waits to be enqueued at head of waiting
|
||||||
queue. */
|
queue. */
|
||||||
if (thd
|
if (trx.is_wsrep()
|
||||||
&& !wsrep_thd_is_applier(thd)
|
&& !wsrep_thd_is_applier(trx.mysql_thd)
|
||||||
&& wsrep_on(thd)
|
&& wsrep_thd_is_BF(trx.mysql_thd, 0)) {
|
||||||
&& wsrep_thd_is_BF(thd, 0)) {
|
|
||||||
WSREP_DEBUG("Avoiding background statistics"
|
WSREP_DEBUG("Avoiding background statistics"
|
||||||
" calculation for table %s.",
|
" calculation for table %s.",
|
||||||
table->name.m_name);
|
table->name.m_name);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Copyright (c) 2009, 2018, Oracle and/or its affiliates. All Rights Reserved.
|
Copyright (c) 2009, 2018, Oracle and/or its affiliates. All Rights Reserved.
|
||||||
Copyright (c) 2017, 2018, MariaDB Corporation.
|
Copyright (c) 2017, 2020, 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
|
||||||
@ -115,16 +115,16 @@ dict_stats_deinit(
|
|||||||
/** Update the table modification counter and if necessary,
|
/** Update the table modification counter and if necessary,
|
||||||
schedule new estimates for table and index statistics to be calculated.
|
schedule new estimates for table and index statistics to be calculated.
|
||||||
@param[in,out] table persistent or temporary table
|
@param[in,out] table persistent or temporary table
|
||||||
@param[in] thd current session */
|
@param[in] trx transaction */
|
||||||
void dict_stats_update_if_needed(dict_table_t* table, THD* thd)
|
void dict_stats_update_if_needed(dict_table_t *table, const trx_t &trx)
|
||||||
MY_ATTRIBUTE((nonnull(1)));
|
MY_ATTRIBUTE((nonnull));
|
||||||
#else
|
#else
|
||||||
/** Update the table modification counter and if necessary,
|
/** Update the table modification counter and if necessary,
|
||||||
schedule new estimates for table and index statistics to be calculated.
|
schedule new estimates for table and index statistics to be calculated.
|
||||||
@param[in,out] table persistent or temporary table */
|
@param[in,out] table persistent or temporary table */
|
||||||
void dict_stats_update_if_needed_func(dict_table_t* table)
|
void dict_stats_update_if_needed_func(dict_table_t *table)
|
||||||
MY_ATTRIBUTE((nonnull));
|
MY_ATTRIBUTE((nonnull));
|
||||||
# define dict_stats_update_if_needed(t,thd) dict_stats_update_if_needed_func(t)
|
# define dict_stats_update_if_needed(t,trx) dict_stats_update_if_needed_func(t)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*********************************************************************//**
|
/*********************************************************************//**
|
||||||
|
@ -1574,7 +1574,7 @@ error_exit:
|
|||||||
memcpy(prebuilt->row_id, node->sys_buf, DATA_ROW_ID_LEN);
|
memcpy(prebuilt->row_id, node->sys_buf, DATA_ROW_ID_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
dict_stats_update_if_needed(table, trx->mysql_thd);
|
dict_stats_update_if_needed(table, *trx);
|
||||||
trx->op_info = "";
|
trx->op_info = "";
|
||||||
|
|
||||||
if (blob_heap != NULL) {
|
if (blob_heap != NULL) {
|
||||||
@ -1958,7 +1958,7 @@ row_update_for_mysql(row_prebuilt_t* prebuilt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (update_statistics) {
|
if (update_statistics) {
|
||||||
dict_stats_update_if_needed(prebuilt->table, trx->mysql_thd);
|
dict_stats_update_if_needed(prebuilt->table, *trx);
|
||||||
} else {
|
} else {
|
||||||
/* Always update the table modification counter. */
|
/* Always update the table modification counter. */
|
||||||
prebuilt->table->stat_modified_counter++;
|
prebuilt->table->stat_modified_counter++;
|
||||||
@ -2208,7 +2208,7 @@ static dberr_t row_update_vers_insert(que_thr_t* thr, upd_node_t* node)
|
|||||||
case DB_SUCCESS:
|
case DB_SUCCESS:
|
||||||
srv_stats.n_rows_inserted.inc(
|
srv_stats.n_rows_inserted.inc(
|
||||||
static_cast<size_t>(trx->id));
|
static_cast<size_t>(trx->id));
|
||||||
dict_stats_update_if_needed(table, trx->mysql_thd);
|
dict_stats_update_if_needed(table, *trx);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2302,8 +2302,7 @@ row_update_cascade_for_mysql(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stats) {
|
if (stats) {
|
||||||
dict_stats_update_if_needed(node->table,
|
dict_stats_update_if_needed(node->table, *trx);
|
||||||
trx->mysql_thd);
|
|
||||||
} else {
|
} else {
|
||||||
/* Always update the table
|
/* Always update the table
|
||||||
modification counter. */
|
modification counter. */
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
||||||
Copyright (c) 2017, 2019, MariaDB Corporation.
|
Copyright (c) 2017, 2020, 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
|
||||||
@ -1194,8 +1194,7 @@ row_purge_record_func(
|
|||||||
if (node->table->stat_initialized
|
if (node->table->stat_initialized
|
||||||
&& srv_stats_include_delete_marked) {
|
&& srv_stats_include_delete_marked) {
|
||||||
dict_stats_update_if_needed(
|
dict_stats_update_if_needed(
|
||||||
node->table,
|
node->table, *thr->graph->trx);
|
||||||
thr->graph->trx->mysql_thd);
|
|
||||||
}
|
}
|
||||||
MONITOR_INC(MONITOR_N_DEL_ROW_PURGE);
|
MONITOR_INC(MONITOR_N_DEL_ROW_PURGE);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
||||||
Copyright (c) 2017, 2019, MariaDB Corporation.
|
Copyright (c) 2017, 2020, 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
|
||||||
@ -624,8 +624,8 @@ row_undo_ins(
|
|||||||
already be holding dict_sys->mutex, which
|
already be holding dict_sys->mutex, which
|
||||||
would be acquired when updating statistics. */
|
would be acquired when updating statistics. */
|
||||||
if (!dict_locked) {
|
if (!dict_locked) {
|
||||||
dict_stats_update_if_needed(
|
dict_stats_update_if_needed(node->table,
|
||||||
node->table, node->trx->mysql_thd);
|
*node->trx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1350,8 +1350,8 @@ rollback_clust:
|
|||||||
already be holding dict_sys->mutex, which
|
already be holding dict_sys->mutex, which
|
||||||
would be acquired when updating statistics. */
|
would be acquired when updating statistics. */
|
||||||
if (update_statistics && !dict_locked) {
|
if (update_statistics && !dict_locked) {
|
||||||
dict_stats_update_if_needed(
|
dict_stats_update_if_needed(node->table,
|
||||||
node->table, node->trx->mysql_thd);
|
*node->trx);
|
||||||
} else {
|
} else {
|
||||||
node->table->stat_modified_counter++;
|
node->table->stat_modified_counter++;
|
||||||
}
|
}
|
||||||
|
@ -450,9 +450,8 @@ trx_rollback_to_savepoint_for_mysql_low(
|
|||||||
trx->op_info = "";
|
trx->op_info = "";
|
||||||
|
|
||||||
#ifdef WITH_WSREP
|
#ifdef WITH_WSREP
|
||||||
if (wsrep_on(trx->mysql_thd) &&
|
if (trx->is_wsrep()) {
|
||||||
trx->lock.was_chosen_as_deadlock_victim) {
|
trx->lock.was_chosen_as_deadlock_victim = false;
|
||||||
trx->lock.was_chosen_as_deadlock_victim = FALSE;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return(err);
|
return(err);
|
||||||
@ -911,12 +910,6 @@ trx_roll_try_truncate(trx_t* trx)
|
|||||||
trx_undo_truncate_end(undo, undo_no, true);
|
trx_undo_truncate_end(undo, undo_no, true);
|
||||||
mutex_exit(&undo->rseg->mutex);
|
mutex_exit(&undo->rseg->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_WSREP_OUT
|
|
||||||
if (wsrep_on(trx->mysql_thd)) {
|
|
||||||
trx->lock.was_chosen_as_deadlock_victim = FALSE;
|
|
||||||
}
|
|
||||||
#endif /* WITH_WSREP */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************//**
|
/***********************************************************************//**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user