Merge 10.0 into 10.1
This commit is contained in:
commit
03dca7a333
@ -1,6 +1,7 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
Copyright (c) 1995, 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
|
||||||
@ -1373,7 +1374,7 @@ loop:
|
|||||||
++flush_failures;
|
++flush_failures;
|
||||||
}
|
}
|
||||||
|
|
||||||
srv_stats.buf_pool_wait_free.add(n_iterations, 1);
|
srv_stats.buf_pool_wait_free.inc();
|
||||||
|
|
||||||
n_iterations++;
|
n_iterations++;
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||||
Copyright (c) 2008, Google Inc.
|
Copyright (c) 2008, Google Inc.
|
||||||
|
Copyright (c) 2017, MariaDB Corporation.
|
||||||
|
|
||||||
Portions of this file contain modifications contributed and copyrighted by
|
Portions of this file contain modifications contributed and copyrighted by
|
||||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||||
@ -36,14 +37,13 @@ Created 9/6/1995 Heikki Tuuri
|
|||||||
|
|
||||||
#include "univ.i"
|
#include "univ.i"
|
||||||
#include "ut0lst.h"
|
#include "ut0lst.h"
|
||||||
#include "sync0types.h"
|
|
||||||
|
|
||||||
#if defined __i386__ || defined __x86_64__ || defined _M_IX86 \
|
/** CPU cache line size */
|
||||||
|| defined _M_X64 || defined __WIN__
|
#ifdef __powerpc__
|
||||||
|
#define CACHE_LINE_SIZE 128
|
||||||
#define IB_STRONG_MEMORY_MODEL
|
#else
|
||||||
|
#define CACHE_LINE_SIZE 64
|
||||||
#endif /* __i386__ || __x86_64__ || _M_IX86 || _M_X64 || __WIN__ */
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_WINDOWS_ATOMICS
|
#ifdef HAVE_WINDOWS_ATOMICS
|
||||||
typedef LONG lock_word_t; /*!< On Windows, InterlockedExchange operates
|
typedef LONG lock_word_t; /*!< On Windows, InterlockedExchange operates
|
||||||
@ -889,6 +889,51 @@ for synchronization */
|
|||||||
"Memory barrier is not used"
|
"Memory barrier is not used"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/** Simple counter aligned to CACHE_LINE_SIZE
|
||||||
|
@tparam Type the integer type of the counter
|
||||||
|
@tparam atomic whether to use atomic memory access */
|
||||||
|
template <typename Type = ulint, bool atomic = false>
|
||||||
|
struct MY_ALIGNED(CACHE_LINE_SIZE) simple_counter
|
||||||
|
{
|
||||||
|
/** Increment the counter */
|
||||||
|
Type inc() { return add(1); }
|
||||||
|
/** Decrement the counter */
|
||||||
|
Type dec() { return sub(1); }
|
||||||
|
|
||||||
|
/** Add to the counter
|
||||||
|
@param[in] i amount to be added
|
||||||
|
@return the value of the counter after adding */
|
||||||
|
Type add(Type i)
|
||||||
|
{
|
||||||
|
compile_time_assert(!atomic || sizeof(Type) == sizeof(ulint));
|
||||||
|
if (atomic) {
|
||||||
|
return os_atomic_increment_ulint(&m_counter, i);
|
||||||
|
} else {
|
||||||
|
return m_counter += i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/** Subtract from the counter
|
||||||
|
@param[in] i amount to be subtracted
|
||||||
|
@return the value of the counter after adding */
|
||||||
|
Type sub(Type i)
|
||||||
|
{
|
||||||
|
compile_time_assert(!atomic || sizeof(Type) == sizeof(ulint));
|
||||||
|
if (atomic) {
|
||||||
|
return os_atomic_decrement_ulint(&m_counter, i);
|
||||||
|
} else {
|
||||||
|
return m_counter -= i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @return the value of the counter (non-atomic access)! */
|
||||||
|
operator Type() const { return m_counter; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** The counter */
|
||||||
|
Type m_counter;
|
||||||
|
};
|
||||||
|
|
||||||
#ifndef UNIV_NONINL
|
#ifndef UNIV_NONINL
|
||||||
#include "os0sync.ic"
|
#include "os0sync.ic"
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
|
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
Copyright (c) 2008, 2009, Google Inc.
|
Copyright (c) 2008, 2009, Google Inc.
|
||||||
Copyright (c) 2009, Percona Inc.
|
Copyright (c) 2009, Percona Inc.
|
||||||
Copyright (c) 2013, 2017, MariaDB Corporation Ab. All Rights Reserved.
|
Copyright (c) 2013, 2017, MariaDB Corporation.
|
||||||
|
|
||||||
Portions of this file contain modifications contributed and copyrighted by
|
Portions of this file contain modifications contributed and copyrighted by
|
||||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||||
@ -55,11 +55,10 @@ Created 10/10/1995 Heikki Tuuri
|
|||||||
|
|
||||||
/* Global counters used inside InnoDB. */
|
/* Global counters used inside InnoDB. */
|
||||||
struct srv_stats_t {
|
struct srv_stats_t {
|
||||||
typedef ib_counter_t<lsn_t, 1, single_indexer_t> lsn_ctr_1_t;
|
|
||||||
typedef ib_counter_t<ulint, 1, single_indexer_t> ulint_ctr_1_t;
|
|
||||||
typedef ib_counter_t<lint, 1, single_indexer_t> lint_ctr_1_t;
|
|
||||||
typedef ib_counter_t<ulint, 64> ulint_ctr_64_t;
|
typedef ib_counter_t<ulint, 64> ulint_ctr_64_t;
|
||||||
typedef ib_counter_t<ib_int64_t, 1, single_indexer_t> ib_int64_ctr_1_t;
|
typedef simple_counter<lsn_t> lsn_ctr_1_t;
|
||||||
|
typedef simple_counter<ulint> ulint_ctr_1_t;
|
||||||
|
typedef simple_counter<ib_int64_t> ib_int64_ctr_1_t;
|
||||||
|
|
||||||
/** Count the amount of data written in total (in bytes) */
|
/** Count the amount of data written in total (in bytes) */
|
||||||
ulint_ctr_1_t data_written;
|
ulint_ctr_1_t data_written;
|
||||||
@ -73,8 +72,9 @@ struct srv_stats_t {
|
|||||||
/** Amount of data written to the log files in bytes */
|
/** Amount of data written to the log files in bytes */
|
||||||
lsn_ctr_1_t os_log_written;
|
lsn_ctr_1_t os_log_written;
|
||||||
|
|
||||||
/** Number of writes being done to the log files */
|
/** Number of writes being done to the log files.
|
||||||
lint_ctr_1_t os_log_pending_writes;
|
Protected by log_sys->write_mutex. */
|
||||||
|
ulint_ctr_1_t os_log_pending_writes;
|
||||||
|
|
||||||
/** We increase this counter, when we don't have enough
|
/** We increase this counter, when we don't have enough
|
||||||
space in the log buffer and have to flush it */
|
space in the log buffer and have to flush it */
|
||||||
@ -148,7 +148,7 @@ struct srv_stats_t {
|
|||||||
ulint_ctr_1_t n_lock_wait_count;
|
ulint_ctr_1_t n_lock_wait_count;
|
||||||
|
|
||||||
/** Number of threads currently waiting on database locks */
|
/** Number of threads currently waiting on database locks */
|
||||||
lint_ctr_1_t n_lock_wait_current_count;
|
simple_counter<ulint, true> n_lock_wait_current_count;
|
||||||
|
|
||||||
/** Number of rows read. */
|
/** Number of rows read. */
|
||||||
ulint_ctr_64_t n_rows_read;
|
ulint_ctr_64_t n_rows_read;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Copyright (c) 2012, Oracle and/or its affiliates. All Rights Reserved.
|
Copyright (c) 2012, 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
|
||||||
@ -30,13 +31,7 @@ Created 2012/04/12 by Sunny Bains
|
|||||||
#include "univ.i"
|
#include "univ.i"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "os0thread.h"
|
#include "os0thread.h"
|
||||||
|
#include "os0sync.h"
|
||||||
/** CPU cache line size */
|
|
||||||
#ifdef __powerpc__
|
|
||||||
#define CACHE_LINE_SIZE 128
|
|
||||||
#else
|
|
||||||
#define CACHE_LINE_SIZE 64
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Default number of slots to use in ib_counter_t */
|
/** Default number of slots to use in ib_counter_t */
|
||||||
#define IB_N_SLOTS 64
|
#define IB_N_SLOTS 64
|
||||||
@ -44,8 +39,6 @@ Created 2012/04/12 by Sunny Bains
|
|||||||
/** Get the offset into the counter array. */
|
/** Get the offset into the counter array. */
|
||||||
template <typename Type, int N>
|
template <typename Type, int N>
|
||||||
struct generic_indexer_t {
|
struct generic_indexer_t {
|
||||||
/** Default constructor/destructor should be OK. */
|
|
||||||
|
|
||||||
/** @return offset within m_counter */
|
/** @return offset within m_counter */
|
||||||
size_t offset(size_t index) const UNIV_NOTHROW {
|
size_t offset(size_t index) const UNIV_NOTHROW {
|
||||||
return(((index % N) + 1) * (CACHE_LINE_SIZE / sizeof(Type)));
|
return(((index % N) + 1) * (CACHE_LINE_SIZE / sizeof(Type)));
|
||||||
@ -58,8 +51,6 @@ struct generic_indexer_t {
|
|||||||
use the thread id. */
|
use the thread id. */
|
||||||
template <typename Type, int N>
|
template <typename Type, int N>
|
||||||
struct get_sched_indexer_t : public generic_indexer_t<Type, N> {
|
struct get_sched_indexer_t : public generic_indexer_t<Type, N> {
|
||||||
/** Default constructor/destructor should be OK. */
|
|
||||||
|
|
||||||
/* @return result from sched_getcpu(), the thread id if it fails. */
|
/* @return result from sched_getcpu(), the thread id if it fails. */
|
||||||
size_t get_rnd_index() const UNIV_NOTHROW {
|
size_t get_rnd_index() const UNIV_NOTHROW {
|
||||||
|
|
||||||
@ -76,31 +67,17 @@ struct get_sched_indexer_t : public generic_indexer_t<Type, N> {
|
|||||||
/** Use the thread id to index into the counter array. */
|
/** Use the thread id to index into the counter array. */
|
||||||
template <typename Type, int N>
|
template <typename Type, int N>
|
||||||
struct thread_id_indexer_t : public generic_indexer_t<Type, N> {
|
struct thread_id_indexer_t : public generic_indexer_t<Type, N> {
|
||||||
/** Default constructor/destructor should are OK. */
|
|
||||||
|
|
||||||
/* @return a random number, currently we use the thread id. Where
|
/* @return a random number, currently we use the thread id. Where
|
||||||
thread id is represented as a pointer, it may not work as
|
thread id is represented as a pointer, it may not work as
|
||||||
effectively. */
|
effectively. */
|
||||||
size_t get_rnd_index() const UNIV_NOTHROW {
|
size_t get_rnd_index() const UNIV_NOTHROW {
|
||||||
return((lint) os_thread_get_curr_id());
|
return((lint) os_thread_get_curr_id());
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
/** For counters wher N=1 */
|
/** @return a random offset to the array */
|
||||||
template <typename Type, int N=1>
|
size_t get_rnd_offset() const UNIV_NOTHROW
|
||||||
struct single_indexer_t {
|
{
|
||||||
/** Default constructor/destructor should are OK. */
|
return(generic_indexer_t<Type, N>::offset(get_rnd_index()));
|
||||||
|
|
||||||
/** @return offset within m_counter */
|
|
||||||
size_t offset(size_t index) const UNIV_NOTHROW {
|
|
||||||
ut_ad(N == 1);
|
|
||||||
return((CACHE_LINE_SIZE / sizeof(Type)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* @return 1 */
|
|
||||||
size_t get_rnd_index() const UNIV_NOTHROW {
|
|
||||||
ut_ad(N == 1);
|
|
||||||
return(1);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -112,17 +89,11 @@ template <
|
|||||||
typename Type,
|
typename Type,
|
||||||
int N = IB_N_SLOTS,
|
int N = IB_N_SLOTS,
|
||||||
template<typename, int> class Indexer = thread_id_indexer_t>
|
template<typename, int> class Indexer = thread_id_indexer_t>
|
||||||
class ib_counter_t {
|
struct MY_ALIGNED(CACHE_LINE_SIZE) ib_counter_t
|
||||||
public:
|
{
|
||||||
ib_counter_t() { memset(m_counter, 0x0, sizeof(m_counter)); }
|
#ifdef UNIV_DEBUG
|
||||||
|
|
||||||
~ib_counter_t()
|
~ib_counter_t()
|
||||||
{
|
{
|
||||||
ut_ad(validate());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool validate() UNIV_NOTHROW {
|
|
||||||
#ifdef UNIV_DEBUG
|
|
||||||
size_t n = (CACHE_LINE_SIZE / sizeof(Type));
|
size_t n = (CACHE_LINE_SIZE / sizeof(Type));
|
||||||
|
|
||||||
/* Check that we aren't writing outside our defined bounds. */
|
/* Check that we aren't writing outside our defined bounds. */
|
||||||
@ -131,27 +102,23 @@ public:
|
|||||||
ut_ad(m_counter[i + j] == 0);
|
ut_ad(m_counter[i + j] == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* UNIV_DEBUG */
|
|
||||||
return(true);
|
|
||||||
}
|
}
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
|
|
||||||
/** If you can't use a good index id. Increment by 1. */
|
/** Increment the counter by 1. */
|
||||||
void inc() UNIV_NOTHROW { add(1); }
|
void inc() UNIV_NOTHROW { add(1); }
|
||||||
|
|
||||||
/** If you can't use a good index id.
|
/** Increment the counter by 1.
|
||||||
* @param n - is the amount to increment */
|
@param[in] index a reasonably thread-unique identifier */
|
||||||
void add(Type n) UNIV_NOTHROW {
|
void inc(size_t index) UNIV_NOTHROW { add(index, 1); }
|
||||||
size_t i = m_policy.offset(m_policy.get_rnd_index());
|
|
||||||
|
|
||||||
ut_ad(i < UT_ARR_SIZE(m_counter));
|
/** Add to the counter.
|
||||||
|
@param[in] n amount to be added */
|
||||||
|
void add(Type n) UNIV_NOTHROW { add(m_policy.get_rnd_offset(), n); }
|
||||||
|
|
||||||
m_counter[i] += n;
|
/** Add to the counter.
|
||||||
}
|
@param[in] index a reasonably thread-unique identifier
|
||||||
|
@param[in] n amount to be added */
|
||||||
/** Use this if you can use a unique indentifier, saves a
|
|
||||||
call to get_rnd_index().
|
|
||||||
@param i - index into a slot
|
|
||||||
@param n - amount to increment */
|
|
||||||
void add(size_t index, Type n) UNIV_NOTHROW {
|
void add(size_t index, Type n) UNIV_NOTHROW {
|
||||||
size_t i = m_policy.offset(index);
|
size_t i = m_policy.offset(index);
|
||||||
|
|
||||||
@ -160,31 +127,6 @@ public:
|
|||||||
m_counter[i] += n;
|
m_counter[i] += n;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** If you can't use a good index id. Decrement by 1. */
|
|
||||||
void dec() UNIV_NOTHROW { sub(1); }
|
|
||||||
|
|
||||||
/** If you can't use a good index id.
|
|
||||||
* @param - n is the amount to decrement */
|
|
||||||
void sub(Type n) UNIV_NOTHROW {
|
|
||||||
size_t i = m_policy.offset(m_policy.get_rnd_index());
|
|
||||||
|
|
||||||
ut_ad(i < UT_ARR_SIZE(m_counter));
|
|
||||||
|
|
||||||
m_counter[i] -= n;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Use this if you can use a unique indentifier, saves a
|
|
||||||
call to get_rnd_index().
|
|
||||||
@param i - index into a slot
|
|
||||||
@param n - amount to decrement */
|
|
||||||
void sub(size_t index, Type n) UNIV_NOTHROW {
|
|
||||||
size_t i = m_policy.offset(index);
|
|
||||||
|
|
||||||
ut_ad(i < UT_ARR_SIZE(m_counter));
|
|
||||||
|
|
||||||
m_counter[i] -= n;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* @return total value - not 100% accurate, since it is not atomic. */
|
/* @return total value - not 100% accurate, since it is not atomic. */
|
||||||
operator Type() const UNIV_NOTHROW {
|
operator Type() const UNIV_NOTHROW {
|
||||||
Type total = 0;
|
Type total = 0;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
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. All Rights Reserved.
|
Copyright (c) 2014, 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
|
||||||
@ -273,6 +273,9 @@ lock_wait_suspend_thread(
|
|||||||
|
|
||||||
slot = lock_wait_table_reserve_slot(thr, lock_wait_timeout);
|
slot = lock_wait_table_reserve_slot(thr, lock_wait_timeout);
|
||||||
|
|
||||||
|
lock_wait_mutex_exit();
|
||||||
|
trx_mutex_exit(trx);
|
||||||
|
|
||||||
if (thr->lock_state == QUE_THR_LOCK_ROW) {
|
if (thr->lock_state == QUE_THR_LOCK_ROW) {
|
||||||
srv_stats.n_lock_wait_count.inc();
|
srv_stats.n_lock_wait_count.inc();
|
||||||
srv_stats.n_lock_wait_current_count.inc();
|
srv_stats.n_lock_wait_current_count.inc();
|
||||||
@ -284,19 +287,21 @@ lock_wait_suspend_thread(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lock_wait_mutex_exit();
|
|
||||||
trx_mutex_exit(trx);
|
|
||||||
|
|
||||||
ulint lock_type = ULINT_UNDEFINED;
|
ulint lock_type = ULINT_UNDEFINED;
|
||||||
|
|
||||||
lock_mutex_enter();
|
/* The wait_lock can be cleared by another thread when the
|
||||||
|
lock is released. But the wait can only be initiated by the
|
||||||
|
current thread which owns the transaction. Only acquire the
|
||||||
|
mutex if the wait_lock is still active. */
|
||||||
if (const lock_t* wait_lock = trx->lock.wait_lock) {
|
if (const lock_t* wait_lock = trx->lock.wait_lock) {
|
||||||
lock_type = lock_get_type_low(wait_lock);
|
lock_mutex_enter();
|
||||||
|
wait_lock = trx->lock.wait_lock;
|
||||||
|
if (wait_lock) {
|
||||||
|
lock_type = lock_get_type_low(wait_lock);
|
||||||
|
}
|
||||||
|
lock_mutex_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
lock_mutex_exit();
|
|
||||||
|
|
||||||
had_dict_lock = trx->dict_operation_lock_mode;
|
had_dict_lock = trx->dict_operation_lock_mode;
|
||||||
|
|
||||||
switch (had_dict_lock) {
|
switch (had_dict_lock) {
|
||||||
|
@ -1509,9 +1509,9 @@ error_exit:
|
|||||||
que_thr_stop_for_mysql_no_error(thr, trx);
|
que_thr_stop_for_mysql_no_error(thr, trx);
|
||||||
|
|
||||||
if (table->is_system_db) {
|
if (table->is_system_db) {
|
||||||
srv_stats.n_system_rows_inserted.add((size_t)trx->id, 1);
|
srv_stats.n_system_rows_inserted.inc(size_t(trx->id));
|
||||||
} else {
|
} else {
|
||||||
srv_stats.n_rows_inserted.add((size_t)trx->id, 1);
|
srv_stats.n_rows_inserted.inc(size_t(trx->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Not protected by dict_table_stats_lock() for performance
|
/* Not protected by dict_table_stats_lock() for performance
|
||||||
@ -1892,18 +1892,16 @@ run_again:
|
|||||||
dict_table_n_rows_dec(prebuilt->table);
|
dict_table_n_rows_dec(prebuilt->table);
|
||||||
|
|
||||||
if (table->is_system_db) {
|
if (table->is_system_db) {
|
||||||
srv_stats.n_system_rows_deleted.add(
|
srv_stats.n_system_rows_deleted.inc(size_t(trx->id));
|
||||||
(size_t)trx->id, 1);
|
|
||||||
} else {
|
} else {
|
||||||
srv_stats.n_rows_deleted.add((size_t)trx->id, 1);
|
srv_stats.n_rows_deleted.inc(size_t(trx->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (table->is_system_db) {
|
if (table->is_system_db) {
|
||||||
srv_stats.n_system_rows_updated.add(
|
srv_stats.n_system_rows_updated.inc(size_t(trx->id));
|
||||||
(size_t)trx->id, 1);
|
|
||||||
} else {
|
} else {
|
||||||
srv_stats.n_rows_updated.add((size_t)trx->id, 1);
|
srv_stats.n_rows_updated.inc(size_t(trx->id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2136,17 +2134,15 @@ run_again:
|
|||||||
dict_table_n_rows_dec(table);
|
dict_table_n_rows_dec(table);
|
||||||
|
|
||||||
if (table->is_system_db) {
|
if (table->is_system_db) {
|
||||||
srv_stats.n_system_rows_deleted.add(
|
srv_stats.n_system_rows_deleted.inc(size_t(trx->id));
|
||||||
(size_t)trx->id, 1);
|
|
||||||
} else {
|
} else {
|
||||||
srv_stats.n_rows_deleted.add((size_t)trx->id, 1);
|
srv_stats.n_rows_deleted.inc(size_t(trx->id));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (table->is_system_db) {
|
if (table->is_system_db) {
|
||||||
srv_stats.n_system_rows_updated.add(
|
srv_stats.n_system_rows_updated.inc(size_t(trx->id));
|
||||||
(size_t)trx->id, 1);
|
|
||||||
} else {
|
} else {
|
||||||
srv_stats.n_rows_updated.add((size_t)trx->id, 1);
|
srv_stats.n_rows_updated.inc(size_t(trx->id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3035,11 +3035,12 @@ row_sel_get_clust_rec_for_mysql(
|
|||||||
dberr_t err;
|
dberr_t err;
|
||||||
trx_t* trx;
|
trx_t* trx;
|
||||||
|
|
||||||
srv_stats.n_sec_rec_cluster_reads.inc();
|
|
||||||
|
|
||||||
*out_rec = NULL;
|
*out_rec = NULL;
|
||||||
trx = thr_get_trx(thr);
|
trx = thr_get_trx(thr);
|
||||||
|
|
||||||
|
srv_stats.n_sec_rec_cluster_reads.inc(
|
||||||
|
thd_get_thread_id(trx->mysql_thd));
|
||||||
|
|
||||||
row_build_row_ref_in_tuple(prebuilt->clust_ref, rec,
|
row_build_row_ref_in_tuple(prebuilt->clust_ref, rec,
|
||||||
sec_index, *offsets, trx);
|
sec_index, *offsets, trx);
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
Copyright (c) 1995, 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
|
||||||
@ -1501,7 +1502,7 @@ loop:
|
|||||||
|
|
||||||
n_iterations++;
|
n_iterations++;
|
||||||
|
|
||||||
srv_stats.buf_pool_wait_free.add(n_iterations, 1);
|
srv_stats.buf_pool_wait_free.inc();
|
||||||
|
|
||||||
/* In case of backoff, do not ever attempt single page flushes
|
/* In case of backoff, do not ever attempt single page flushes
|
||||||
and wait for the cleaner to free some pages instead. */
|
and wait for the cleaner to free some pages instead. */
|
||||||
@ -1595,7 +1596,7 @@ loop:
|
|||||||
++flush_failures;
|
++flush_failures;
|
||||||
}
|
}
|
||||||
|
|
||||||
srv_stats.buf_pool_wait_free.add(n_iterations, 1);
|
srv_stats.buf_pool_wait_free.inc();
|
||||||
|
|
||||||
n_iterations++;
|
n_iterations++;
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||||
Copyright (c) 2008, Google Inc.
|
Copyright (c) 2008, Google Inc.
|
||||||
|
Copyright (c) 2017, MariaDB Corporation.
|
||||||
|
|
||||||
Portions of this file contain modifications contributed and copyrighted by
|
Portions of this file contain modifications contributed and copyrighted by
|
||||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||||
@ -38,12 +39,12 @@ Created 9/6/1995 Heikki Tuuri
|
|||||||
#include "ut0lst.h"
|
#include "ut0lst.h"
|
||||||
#include "sync0types.h"
|
#include "sync0types.h"
|
||||||
|
|
||||||
#if defined __i386__ || defined __x86_64__ || defined _M_IX86 \
|
/** CPU cache line size */
|
||||||
|| defined _M_X64 || defined __WIN__
|
#ifdef __powerpc__
|
||||||
|
#define CACHE_LINE_SIZE 128
|
||||||
#define IB_STRONG_MEMORY_MODEL
|
#else
|
||||||
|
#define CACHE_LINE_SIZE 64
|
||||||
#endif /* __i386__ || __x86_64__ || _M_IX86 || _M_X64 || __WIN__ */
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_WINDOWS_ATOMICS
|
#ifdef HAVE_WINDOWS_ATOMICS
|
||||||
typedef LONG lock_word_t; /*!< On Windows, InterlockedExchange operates
|
typedef LONG lock_word_t; /*!< On Windows, InterlockedExchange operates
|
||||||
@ -940,6 +941,51 @@ for synchronization */
|
|||||||
"Memory barrier is not used"
|
"Memory barrier is not used"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/** Simple counter aligned to CACHE_LINE_SIZE
|
||||||
|
@tparam Type the integer type of the counter
|
||||||
|
@tparam atomic whether to use atomic memory access */
|
||||||
|
template <typename Type = ulint, bool atomic = false>
|
||||||
|
struct MY_ALIGNED(CACHE_LINE_SIZE) simple_counter
|
||||||
|
{
|
||||||
|
/** Increment the counter */
|
||||||
|
Type inc() { return add(1); }
|
||||||
|
/** Decrement the counter */
|
||||||
|
Type dec() { return sub(1); }
|
||||||
|
|
||||||
|
/** Add to the counter
|
||||||
|
@param[in] i amount to be added
|
||||||
|
@return the value of the counter after adding */
|
||||||
|
Type add(Type i)
|
||||||
|
{
|
||||||
|
compile_time_assert(!atomic || sizeof(Type) == sizeof(ulint));
|
||||||
|
if (atomic) {
|
||||||
|
return os_atomic_increment_ulint(&m_counter, i);
|
||||||
|
} else {
|
||||||
|
return m_counter += i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/** Subtract from the counter
|
||||||
|
@param[in] i amount to be subtracted
|
||||||
|
@return the value of the counter after adding */
|
||||||
|
Type sub(Type i)
|
||||||
|
{
|
||||||
|
compile_time_assert(!atomic || sizeof(Type) == sizeof(ulint));
|
||||||
|
if (atomic) {
|
||||||
|
return os_atomic_decrement_ulint(&m_counter, i);
|
||||||
|
} else {
|
||||||
|
return m_counter -= i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @return the value of the counter (non-atomic access)! */
|
||||||
|
operator Type() const { return m_counter; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** The counter */
|
||||||
|
Type m_counter;
|
||||||
|
};
|
||||||
|
|
||||||
#ifndef UNIV_NONINL
|
#ifndef UNIV_NONINL
|
||||||
#include "os0sync.ic"
|
#include "os0sync.ic"
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
|
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
Copyright (c) 2008, 2009, Google Inc.
|
Copyright (c) 2008, 2009, Google Inc.
|
||||||
Copyright (c) 2009, Percona Inc.
|
Copyright (c) 2009, Percona Inc.
|
||||||
Copyright (c) 2013, 2017, MariaDB Corporation Ab. All Rights Reserved.
|
Copyright (c) 2013, 2017, MariaDB Corporation.
|
||||||
|
|
||||||
Portions of this file contain modifications contributed and copyrighted by
|
Portions of this file contain modifications contributed and copyrighted by
|
||||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||||
@ -55,11 +55,10 @@ Created 10/10/1995 Heikki Tuuri
|
|||||||
|
|
||||||
/* Global counters used inside InnoDB. */
|
/* Global counters used inside InnoDB. */
|
||||||
struct srv_stats_t {
|
struct srv_stats_t {
|
||||||
typedef ib_counter_t<lsn_t, 1, single_indexer_t> lsn_ctr_1_t;
|
|
||||||
typedef ib_counter_t<ulint, 1, single_indexer_t> ulint_ctr_1_t;
|
|
||||||
typedef ib_counter_t<lint, 1, single_indexer_t> lint_ctr_1_t;
|
|
||||||
typedef ib_counter_t<ulint, 64> ulint_ctr_64_t;
|
typedef ib_counter_t<ulint, 64> ulint_ctr_64_t;
|
||||||
typedef ib_counter_t<ib_int64_t, 1, single_indexer_t> ib_int64_ctr_1_t;
|
typedef simple_counter<lsn_t> lsn_ctr_1_t;
|
||||||
|
typedef simple_counter<ulint> ulint_ctr_1_t;
|
||||||
|
typedef simple_counter<ib_int64_t> ib_int64_ctr_1_t;
|
||||||
|
|
||||||
/** Count the amount of data written in total (in bytes) */
|
/** Count the amount of data written in total (in bytes) */
|
||||||
ulint_ctr_1_t data_written;
|
ulint_ctr_1_t data_written;
|
||||||
@ -73,8 +72,9 @@ struct srv_stats_t {
|
|||||||
/** Amount of data written to the log files in bytes */
|
/** Amount of data written to the log files in bytes */
|
||||||
lsn_ctr_1_t os_log_written;
|
lsn_ctr_1_t os_log_written;
|
||||||
|
|
||||||
/** Number of writes being done to the log files */
|
/** Number of writes being done to the log files.
|
||||||
lint_ctr_1_t os_log_pending_writes;
|
Protected by log_sys->write_mutex. */
|
||||||
|
ulint_ctr_1_t os_log_pending_writes;
|
||||||
|
|
||||||
/** We increase this counter, when we don't have enough
|
/** We increase this counter, when we don't have enough
|
||||||
space in the log buffer and have to flush it */
|
space in the log buffer and have to flush it */
|
||||||
@ -148,7 +148,7 @@ struct srv_stats_t {
|
|||||||
ulint_ctr_1_t n_lock_wait_count;
|
ulint_ctr_1_t n_lock_wait_count;
|
||||||
|
|
||||||
/** Number of threads currently waiting on database locks */
|
/** Number of threads currently waiting on database locks */
|
||||||
lint_ctr_1_t n_lock_wait_current_count;
|
simple_counter<ulint, true> n_lock_wait_current_count;
|
||||||
|
|
||||||
/** Number of rows read. */
|
/** Number of rows read. */
|
||||||
ulint_ctr_64_t n_rows_read;
|
ulint_ctr_64_t n_rows_read;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Copyright (c) 2012, Oracle and/or its affiliates. All Rights Reserved.
|
Copyright (c) 2012, 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
|
||||||
@ -30,13 +31,7 @@ Created 2012/04/12 by Sunny Bains
|
|||||||
#include "univ.i"
|
#include "univ.i"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "os0thread.h"
|
#include "os0thread.h"
|
||||||
|
#include "os0sync.h"
|
||||||
/** CPU cache line size */
|
|
||||||
#ifdef __powerpc__
|
|
||||||
#define CACHE_LINE_SIZE 128
|
|
||||||
#else
|
|
||||||
#define CACHE_LINE_SIZE 64
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Default number of slots to use in ib_counter_t */
|
/** Default number of slots to use in ib_counter_t */
|
||||||
#define IB_N_SLOTS 64
|
#define IB_N_SLOTS 64
|
||||||
@ -44,8 +39,6 @@ Created 2012/04/12 by Sunny Bains
|
|||||||
/** Get the offset into the counter array. */
|
/** Get the offset into the counter array. */
|
||||||
template <typename Type, int N>
|
template <typename Type, int N>
|
||||||
struct generic_indexer_t {
|
struct generic_indexer_t {
|
||||||
/** Default constructor/destructor should be OK. */
|
|
||||||
|
|
||||||
/** @return offset within m_counter */
|
/** @return offset within m_counter */
|
||||||
size_t offset(size_t index) const UNIV_NOTHROW {
|
size_t offset(size_t index) const UNIV_NOTHROW {
|
||||||
return(((index % N) + 1) * (CACHE_LINE_SIZE / sizeof(Type)));
|
return(((index % N) + 1) * (CACHE_LINE_SIZE / sizeof(Type)));
|
||||||
@ -58,8 +51,6 @@ struct generic_indexer_t {
|
|||||||
use the thread id. */
|
use the thread id. */
|
||||||
template <typename Type, int N>
|
template <typename Type, int N>
|
||||||
struct get_sched_indexer_t : public generic_indexer_t<Type, N> {
|
struct get_sched_indexer_t : public generic_indexer_t<Type, N> {
|
||||||
/** Default constructor/destructor should be OK. */
|
|
||||||
|
|
||||||
/* @return result from sched_getcpu(), the thread id if it fails. */
|
/* @return result from sched_getcpu(), the thread id if it fails. */
|
||||||
size_t get_rnd_index() const UNIV_NOTHROW {
|
size_t get_rnd_index() const UNIV_NOTHROW {
|
||||||
|
|
||||||
@ -76,31 +67,17 @@ struct get_sched_indexer_t : public generic_indexer_t<Type, N> {
|
|||||||
/** Use the thread id to index into the counter array. */
|
/** Use the thread id to index into the counter array. */
|
||||||
template <typename Type, int N>
|
template <typename Type, int N>
|
||||||
struct thread_id_indexer_t : public generic_indexer_t<Type, N> {
|
struct thread_id_indexer_t : public generic_indexer_t<Type, N> {
|
||||||
/** Default constructor/destructor should are OK. */
|
|
||||||
|
|
||||||
/* @return a random number, currently we use the thread id. Where
|
/* @return a random number, currently we use the thread id. Where
|
||||||
thread id is represented as a pointer, it may not work as
|
thread id is represented as a pointer, it may not work as
|
||||||
effectively. */
|
effectively. */
|
||||||
size_t get_rnd_index() const UNIV_NOTHROW {
|
size_t get_rnd_index() const UNIV_NOTHROW {
|
||||||
return((lint) os_thread_get_curr_id());
|
return((lint) os_thread_get_curr_id());
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
/** For counters wher N=1 */
|
/** @return a random offset to the array */
|
||||||
template <typename Type, int N=1>
|
size_t get_rnd_offset() const UNIV_NOTHROW
|
||||||
struct single_indexer_t {
|
{
|
||||||
/** Default constructor/destructor should are OK. */
|
return(generic_indexer_t<Type, N>::offset(get_rnd_index()));
|
||||||
|
|
||||||
/** @return offset within m_counter */
|
|
||||||
size_t offset(size_t index) const UNIV_NOTHROW {
|
|
||||||
ut_ad(N == 1);
|
|
||||||
return((CACHE_LINE_SIZE / sizeof(Type)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* @return 1 */
|
|
||||||
size_t get_rnd_index() const UNIV_NOTHROW {
|
|
||||||
ut_ad(N == 1);
|
|
||||||
return(1);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -112,17 +89,11 @@ template <
|
|||||||
typename Type,
|
typename Type,
|
||||||
int N = IB_N_SLOTS,
|
int N = IB_N_SLOTS,
|
||||||
template<typename, int> class Indexer = thread_id_indexer_t>
|
template<typename, int> class Indexer = thread_id_indexer_t>
|
||||||
class ib_counter_t {
|
struct MY_ALIGNED(CACHE_LINE_SIZE) ib_counter_t
|
||||||
public:
|
{
|
||||||
ib_counter_t() { memset(m_counter, 0x0, sizeof(m_counter)); }
|
#ifdef UNIV_DEBUG
|
||||||
|
|
||||||
~ib_counter_t()
|
~ib_counter_t()
|
||||||
{
|
{
|
||||||
ut_ad(validate());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool validate() UNIV_NOTHROW {
|
|
||||||
#ifdef UNIV_DEBUG
|
|
||||||
size_t n = (CACHE_LINE_SIZE / sizeof(Type));
|
size_t n = (CACHE_LINE_SIZE / sizeof(Type));
|
||||||
|
|
||||||
/* Check that we aren't writing outside our defined bounds. */
|
/* Check that we aren't writing outside our defined bounds. */
|
||||||
@ -131,27 +102,23 @@ public:
|
|||||||
ut_ad(m_counter[i + j] == 0);
|
ut_ad(m_counter[i + j] == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* UNIV_DEBUG */
|
|
||||||
return(true);
|
|
||||||
}
|
}
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
|
|
||||||
/** If you can't use a good index id. Increment by 1. */
|
/** Increment the counter by 1. */
|
||||||
void inc() UNIV_NOTHROW { add(1); }
|
void inc() UNIV_NOTHROW { add(1); }
|
||||||
|
|
||||||
/** If you can't use a good index id.
|
/** Increment the counter by 1.
|
||||||
* @param n - is the amount to increment */
|
@param[in] index a reasonably thread-unique identifier */
|
||||||
void add(Type n) UNIV_NOTHROW {
|
void inc(size_t index) UNIV_NOTHROW { add(index, 1); }
|
||||||
size_t i = m_policy.offset(m_policy.get_rnd_index());
|
|
||||||
|
|
||||||
ut_ad(i < UT_ARR_SIZE(m_counter));
|
/** Add to the counter.
|
||||||
|
@param[in] n amount to be added */
|
||||||
|
void add(Type n) UNIV_NOTHROW { add(m_policy.get_rnd_offset(), n); }
|
||||||
|
|
||||||
m_counter[i] += n;
|
/** Add to the counter.
|
||||||
}
|
@param[in] index a reasonably thread-unique identifier
|
||||||
|
@param[in] n amount to be added */
|
||||||
/** Use this if you can use a unique indentifier, saves a
|
|
||||||
call to get_rnd_index().
|
|
||||||
@param i - index into a slot
|
|
||||||
@param n - amount to increment */
|
|
||||||
void add(size_t index, Type n) UNIV_NOTHROW {
|
void add(size_t index, Type n) UNIV_NOTHROW {
|
||||||
size_t i = m_policy.offset(index);
|
size_t i = m_policy.offset(index);
|
||||||
|
|
||||||
@ -160,31 +127,6 @@ public:
|
|||||||
m_counter[i] += n;
|
m_counter[i] += n;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** If you can't use a good index id. Decrement by 1. */
|
|
||||||
void dec() UNIV_NOTHROW { sub(1); }
|
|
||||||
|
|
||||||
/** If you can't use a good index id.
|
|
||||||
* @param - n is the amount to decrement */
|
|
||||||
void sub(Type n) UNIV_NOTHROW {
|
|
||||||
size_t i = m_policy.offset(m_policy.get_rnd_index());
|
|
||||||
|
|
||||||
ut_ad(i < UT_ARR_SIZE(m_counter));
|
|
||||||
|
|
||||||
m_counter[i] -= n;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Use this if you can use a unique indentifier, saves a
|
|
||||||
call to get_rnd_index().
|
|
||||||
@param i - index into a slot
|
|
||||||
@param n - amount to decrement */
|
|
||||||
void sub(size_t index, Type n) UNIV_NOTHROW {
|
|
||||||
size_t i = m_policy.offset(index);
|
|
||||||
|
|
||||||
ut_ad(i < UT_ARR_SIZE(m_counter));
|
|
||||||
|
|
||||||
m_counter[i] -= n;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* @return total value - not 100% accurate, since it is not atomic. */
|
/* @return total value - not 100% accurate, since it is not atomic. */
|
||||||
operator Type() const UNIV_NOTHROW {
|
operator Type() const UNIV_NOTHROW {
|
||||||
Type total = 0;
|
Type total = 0;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
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. All Rights Reserved.
|
Copyright (c) 2014, 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
|
||||||
@ -273,6 +273,9 @@ lock_wait_suspend_thread(
|
|||||||
|
|
||||||
slot = lock_wait_table_reserve_slot(thr, lock_wait_timeout);
|
slot = lock_wait_table_reserve_slot(thr, lock_wait_timeout);
|
||||||
|
|
||||||
|
lock_wait_mutex_exit();
|
||||||
|
trx_mutex_exit(trx);
|
||||||
|
|
||||||
if (thr->lock_state == QUE_THR_LOCK_ROW) {
|
if (thr->lock_state == QUE_THR_LOCK_ROW) {
|
||||||
srv_stats.n_lock_wait_count.inc();
|
srv_stats.n_lock_wait_count.inc();
|
||||||
srv_stats.n_lock_wait_current_count.inc();
|
srv_stats.n_lock_wait_current_count.inc();
|
||||||
@ -284,19 +287,21 @@ lock_wait_suspend_thread(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lock_wait_mutex_exit();
|
|
||||||
trx_mutex_exit(trx);
|
|
||||||
|
|
||||||
ulint lock_type = ULINT_UNDEFINED;
|
ulint lock_type = ULINT_UNDEFINED;
|
||||||
|
|
||||||
lock_mutex_enter();
|
/* The wait_lock can be cleared by another thread when the
|
||||||
|
lock is released. But the wait can only be initiated by the
|
||||||
|
current thread which owns the transaction. Only acquire the
|
||||||
|
mutex if the wait_lock is still active. */
|
||||||
if (const lock_t* wait_lock = trx->lock.wait_lock) {
|
if (const lock_t* wait_lock = trx->lock.wait_lock) {
|
||||||
lock_type = lock_get_type_low(wait_lock);
|
lock_mutex_enter();
|
||||||
|
wait_lock = trx->lock.wait_lock;
|
||||||
|
if (wait_lock) {
|
||||||
|
lock_type = lock_get_type_low(wait_lock);
|
||||||
|
}
|
||||||
|
lock_mutex_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
lock_mutex_exit();
|
|
||||||
|
|
||||||
had_dict_lock = trx->dict_operation_lock_mode;
|
had_dict_lock = trx->dict_operation_lock_mode;
|
||||||
|
|
||||||
switch (had_dict_lock) {
|
switch (had_dict_lock) {
|
||||||
|
@ -1514,11 +1514,10 @@ error_exit:
|
|||||||
que_thr_stop_for_mysql_no_error(thr, trx);
|
que_thr_stop_for_mysql_no_error(thr, trx);
|
||||||
|
|
||||||
if (UNIV_LIKELY(!(trx->fake_changes))) {
|
if (UNIV_LIKELY(!(trx->fake_changes))) {
|
||||||
|
|
||||||
if (table->is_system_db) {
|
if (table->is_system_db) {
|
||||||
srv_stats.n_system_rows_inserted.add((size_t)trx->id, 1);
|
srv_stats.n_system_rows_inserted.inc(size_t(trx->id));
|
||||||
} else {
|
} else {
|
||||||
srv_stats.n_rows_inserted.add((size_t)trx->id, 1);
|
srv_stats.n_rows_inserted.inc(size_t(trx->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prebuilt->clust_index_was_generated) {
|
if (prebuilt->clust_index_was_generated) {
|
||||||
@ -1907,17 +1906,15 @@ run_again:
|
|||||||
dict_table_n_rows_dec(prebuilt->table);
|
dict_table_n_rows_dec(prebuilt->table);
|
||||||
|
|
||||||
if (table->is_system_db) {
|
if (table->is_system_db) {
|
||||||
srv_stats.n_system_rows_deleted.add(
|
srv_stats.n_system_rows_deleted.inc(size_t(trx->id));
|
||||||
(size_t)trx->id, 1);
|
|
||||||
} else {
|
} else {
|
||||||
srv_stats.n_rows_deleted.add((size_t)trx->id, 1);
|
srv_stats.n_rows_deleted.inc(size_t(trx->id));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (table->is_system_db) {
|
if (table->is_system_db) {
|
||||||
srv_stats.n_system_rows_updated.add(
|
srv_stats.n_system_rows_updated.inc(size_t(trx->id));
|
||||||
(size_t)trx->id, 1);
|
|
||||||
} else {
|
} else {
|
||||||
srv_stats.n_rows_updated.add((size_t)trx->id, 1);
|
srv_stats.n_rows_updated.inc(size_t(trx->id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2155,17 +2152,15 @@ run_again:
|
|||||||
dict_table_n_rows_dec(table);
|
dict_table_n_rows_dec(table);
|
||||||
|
|
||||||
if (table->is_system_db) {
|
if (table->is_system_db) {
|
||||||
srv_stats.n_system_rows_deleted.add(
|
srv_stats.n_system_rows_deleted.inc(size_t(trx->id));
|
||||||
(size_t)trx->id, 1);
|
|
||||||
} else {
|
} else {
|
||||||
srv_stats.n_rows_deleted.add((size_t)trx->id, 1);
|
srv_stats.n_rows_deleted.inc(size_t(trx->id));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (table->is_system_db) {
|
if (table->is_system_db) {
|
||||||
srv_stats.n_system_rows_updated.add(
|
srv_stats.n_system_rows_updated.inc(size_t(trx->id));
|
||||||
(size_t)trx->id, 1);
|
|
||||||
} else {
|
} else {
|
||||||
srv_stats.n_rows_updated.add((size_t)trx->id, 1);
|
srv_stats.n_rows_updated.inc(size_t(trx->id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3047,11 +3047,12 @@ row_sel_get_clust_rec_for_mysql(
|
|||||||
dberr_t err;
|
dberr_t err;
|
||||||
trx_t* trx;
|
trx_t* trx;
|
||||||
|
|
||||||
srv_stats.n_sec_rec_cluster_reads.inc();
|
|
||||||
|
|
||||||
*out_rec = NULL;
|
*out_rec = NULL;
|
||||||
trx = thr_get_trx(thr);
|
trx = thr_get_trx(thr);
|
||||||
|
|
||||||
|
srv_stats.n_sec_rec_cluster_reads.inc(
|
||||||
|
thd_get_thread_id(trx->mysql_thd));
|
||||||
|
|
||||||
row_build_row_ref_in_tuple(prebuilt->clust_ref, rec,
|
row_build_row_ref_in_tuple(prebuilt->clust_ref, rec,
|
||||||
sec_index, *offsets, trx);
|
sec_index, *offsets, trx);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user