Commit f9069a3d authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-12674 Post-merge fix: Include accidentally omitted changes

In 10.2, the definition of simple_counter resides in the file
sync0types.h, not in the file os0sync.h which has been removed.
parent b9474b5d
......@@ -57,10 +57,9 @@ Created 10/10/1995 Heikki Tuuri
#include "ut0counter.h"
#include "fil0fil.h"
struct fil_space_t;
/* Global counters used inside InnoDB. */
struct srv_stats_t {
/** Global counters used inside InnoDB. */
struct srv_stats_t
{
typedef ib_counter_t<ulint, 64> ulint_ctr_64_t;
typedef simple_counter<lsn_t> lsn_ctr_1_t;
typedef simple_counter<ulint> ulint_ctr_1_t;
......
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation. 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
......@@ -1266,4 +1266,48 @@ enum rw_lock_flag_t {
#define my_atomic_caslint my_atomic_caslong
#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(CPU_LEVEL1_DCACHE_LINESIZE) 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(lint));
if (atomic) {
return Type(my_atomic_addlint(&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(lint));
if (atomic) {
return Type(my_atomic_addlint(&m_counter, -lint(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;
};
#endif /* sync0types_h */
......@@ -56,8 +56,6 @@ struct generic_indexer_t {
to index into the counter array. See the comments for my_timer_cycles() */
template <typename Type=ulint, int N=1>
struct counter_indexer_t : public generic_indexer_t<Type, N> {
/** Default constructor/destructor should be OK. */
/** @return result from RDTSC or similar functions. */
static size_t get_rnd_index() UNIV_NOTHROW
{
......@@ -78,6 +76,12 @@ struct counter_indexer_t : public generic_indexer_t<Type, N> {
#endif /* !_WIN32 */
}
}
/** @return a random offset to the array */
static size_t get_rnd_offset() UNIV_NOTHROW
{
return(generic_indexer_t<Type, N>::offset(get_rnd_index()));
}
};
#define default_indexer_t counter_indexer_t
......
......@@ -2135,7 +2135,6 @@ row_update_for_mysql_using_upd_graph(
} else {
srv_stats.n_rows_deleted.inc(size_t(trx->id));
}
} else {
if (table->is_system_db) {
srv_stats.n_system_rows_updated.inc(size_t(trx->id));
......
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