summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-05-12 15:44:17 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-05-12 15:44:17 +0300
commitf9069a3dc0a957191587f3809ca6a444ec22c89f (patch)
tree5eb1fc6856f09c0a1230a24a63547b5507b4f933
parentb9474b5d5185f8ddb639952c1c86d1dd1d42da35 (diff)
downloadmariadb-git-f9069a3dc0a957191587f3809ca6a444ec22c89f.tar.gz
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.
-rw-r--r--storage/innobase/include/srv0srv.h7
-rw-r--r--storage/innobase/include/sync0types.h46
-rw-r--r--storage/innobase/include/ut0counter.h8
-rw-r--r--storage/innobase/row/row0mysql.cc1
4 files changed, 54 insertions, 8 deletions
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index d66593c686c..9d8e736beb1 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -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;
diff --git a/storage/innobase/include/sync0types.h b/storage/innobase/include/sync0types.h
index 1d11bfa7811..c3d413e71df 100644
--- a/storage/innobase/include/sync0types.h
+++ b/storage/innobase/include/sync0types.h
@@ -1,7 +1,7 @@
/*****************************************************************************
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 */
diff --git a/storage/innobase/include/ut0counter.h b/storage/innobase/include/ut0counter.h
index aa710a5ae96..f1a9384667e 100644
--- a/storage/innobase/include/ut0counter.h
+++ b/storage/innobase/include/ut0counter.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
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 8cb146c40f3..4062103b1e8 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -2135,7 +2135,6 @@ run_again:
} 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));