summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
authorEugene Kosov <claprix@yandex.ru>2020-05-17 16:24:40 +0300
committerEugene Kosov <eugene.kosov@mariadb.com>2020-05-27 02:34:25 +0300
commit18d8f06f31cbe3913e1c80c0c5120f23e036bd3e (patch)
treeebb650888e486af83960e9e6b419de07f4099b2b /storage/innobase
parent403dacf6a9a373c25a808a1be9169ab2cd001448 (diff)
downloadmariadb-git-18d8f06f31cbe3913e1c80c0c5120f23e036bd3e.tar.gz
intrusive::list fixes
namespace intrusive: removed split class into two: ilist<T> and sized_ilist<T> which has a size field. ilist<T> no more NULLify pointers to bring a slignly better performance. As a consequence, fil_space_t::is_in_unflushed_spaces and fil_space_t::is_in_rotation_list boolean members are needed now.
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/fil/fil0crypt.cc3
-rw-r--r--storage/innobase/fil/fil0fil.cc52
-rw-r--r--storage/innobase/include/dyn0buf.h8
-rw-r--r--storage/innobase/include/fil0fil.h22
4 files changed, 36 insertions, 49 deletions
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index a28c9f63797..f06aa7606ee 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -2261,7 +2261,7 @@ static void fil_crypt_rotation_list_fill()
space != NULL;
space = UT_LIST_GET_NEXT(space_list, space)) {
if (space->purpose != FIL_TYPE_TABLESPACE
- || space->is_in_rotation_list()
+ || space->is_in_rotation_list
|| space->is_stopping()
|| UT_LIST_GET_LEN(space->chain) == 0) {
continue;
@@ -2306,6 +2306,7 @@ static void fil_crypt_rotation_list_fill()
}
fil_system->rotation_list.push_back(*space);
+ space->is_in_rotation_list = true;
}
}
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index d4b0d3f4377..bb7fc0d015f 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2019, MariaDB Corporation.
+Copyright (c) 2014, 2020, 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
@@ -832,7 +832,7 @@ static void fil_flush_low(fil_space_t* space, bool metadata = false)
/* No need to flush. User has explicitly disabled
buffering. */
- ut_ad(!space->is_in_unflushed_spaces());
+ ut_ad(!space->is_in_unflushed_spaces);
ut_ad(fil_space_is_flushed(space));
ut_ad(space->n_pending_flushes == 0);
@@ -895,10 +895,11 @@ static void fil_flush_low(fil_space_t* space, bool metadata = false)
skip_flush:
#endif /* _WIN32 */
if (!node->needs_flush) {
- if (space->is_in_unflushed_spaces()
+ if (space->is_in_unflushed_spaces
&& fil_space_is_flushed(space)) {
fil_system->unflushed_spaces.remove(*space);
+ space->is_in_unflushed_spaces = false;
}
}
@@ -1193,13 +1194,14 @@ fil_node_close_to_free(
if (fil_buffering_disabled(space)) {
- ut_ad(!space->is_in_unflushed_spaces());
+ ut_ad(!space->is_in_unflushed_spaces);
ut_ad(fil_space_is_flushed(space));
- } else if (space->is_in_unflushed_spaces()
+ } else if (space->is_in_unflushed_spaces
&& fil_space_is_flushed(space)) {
fil_system->unflushed_spaces.remove(*space);
+ space->is_in_unflushed_spaces = false;
}
fil_node_close_file(node);
@@ -1226,16 +1228,18 @@ fil_space_detach(
HASH_DELETE(fil_space_t, name_hash, fil_system->name_hash,
ut_fold_string(space->name), space);
- if (space->is_in_unflushed_spaces()) {
+ if (space->is_in_unflushed_spaces) {
ut_ad(!fil_buffering_disabled(space));
fil_system->unflushed_spaces.remove(*space);
+ space->is_in_unflushed_spaces = false;
}
- if (space->is_in_rotation_list()) {
+ if (space->is_in_rotation_list) {
fil_system->rotation_list.remove(*space);
+ space->is_in_rotation_list = false;
}
UT_LIST_REMOVE(fil_system->space_list, space);
@@ -1462,6 +1466,7 @@ fil_space_create(
/* Key rotation is not enabled, need to inform background
encryption threads. */
fil_system->rotation_list.push_back(*space);
+ space->is_in_rotation_list = true;
mutex_exit(&fil_system->mutex);
mutex_enter(&fil_crypt_threads_mutex);
os_event_set(fil_crypt_threads_event);
@@ -4751,16 +4756,17 @@ fil_node_complete_io(fil_node_t* node, const IORequest& type)
/* We don't need to keep track of unflushed
changes as user has explicitly disabled
buffering. */
- ut_ad(!node->space->is_in_unflushed_spaces());
+ ut_ad(!node->space->is_in_unflushed_spaces);
ut_ad(node->needs_flush == false);
} else {
node->needs_flush = true;
- if (!node->space->is_in_unflushed_spaces()) {
+ if (!node->space->is_in_unflushed_spaces) {
fil_system->unflushed_spaces.push_front(
*node->space);
+ node->space->is_in_unflushed_spaces = true;
}
}
}
@@ -5247,7 +5253,7 @@ fil_flush_file_spaces(
n_space_ids = 0;
- for (intrusive::list<fil_space_t, unflushed_spaces_tag_t>::iterator it
+ for (sized_ilist<fil_space_t, unflushed_spaces_tag_t>::iterator it
= fil_system->unflushed_spaces.begin(),
end = fil_system->unflushed_spaces.end();
it != end; ++it) {
@@ -5974,9 +5980,10 @@ fil_space_remove_from_keyrotation(fil_space_t* space)
ut_ad(mutex_own(&fil_system->mutex));
ut_ad(space);
- if (space->n_pending_ops == 0 && space->is_in_rotation_list()) {
+ if (space->n_pending_ops == 0 && space->is_in_rotation_list) {
ut_a(!fil_system->rotation_list.empty());
fil_system->rotation_list.remove(*space);
+ space->is_in_rotation_list = false;
}
}
@@ -6005,7 +6012,7 @@ fil_space_t *fil_system_t::keyrotate_next(fil_space_t *prev_space,
don't remove the last processed tablespace from the rotation list. */
const bool remove= (!recheck || prev_space->crypt_data) &&
!key_version == !srv_encrypt_tables;
- intrusive::list<fil_space_t, rotation_list_tag_t>::iterator it=
+ sized_ilist<fil_space_t, rotation_list_tag_t>::iterator it=
prev_space == NULL ? fil_system->rotation_list.end() : prev_space;
if (it == fil_system->rotation_list.end())
@@ -6117,24 +6124,3 @@ fil_space_set_punch_hole(
{
node->space->punch_hole = val;
}
-
-/** Checks that this tablespace in a list of unflushed tablespaces.
-@return true if in a list */
-bool fil_space_t::is_in_unflushed_spaces() const
-{
- ut_ad(mutex_own(&fil_system->mutex));
-
- return static_cast<const intrusive::list_node<unflushed_spaces_tag_t> *>(
- this)
- ->next;
-}
-
-/** Checks that this tablespace needs key rotation.
-@return true if in a rotation list */
-bool fil_space_t::is_in_rotation_list() const
-{
- ut_ad(mutex_own(&fil_system->mutex));
-
- return static_cast<const intrusive::list_node<rotation_list_tag_t> *>(this)
- ->next;
-}
diff --git a/storage/innobase/include/dyn0buf.h b/storage/innobase/include/dyn0buf.h
index 311f6518943..b3302409e5f 100644
--- a/storage/innobase/include/dyn0buf.h
+++ b/storage/innobase/include/dyn0buf.h
@@ -29,7 +29,7 @@ Created 2013-03-16 Sunny Bains
#include "mem0mem.h"
#include "dyn0types.h"
-#include "intrusive_list.h"
+#include "ilist.h"
/** Class that manages dynamic buffers. It uses a UT_LIST of
@@ -43,7 +43,7 @@ template <size_t SIZE = DYN_ARRAY_DATA_SIZE>
class dyn_buf_t {
public:
- class block_t : public intrusive::list_node<> {
+ class block_t : public ilist_node<> {
public:
block_t()
@@ -153,7 +153,7 @@ public:
/** SIZE - sizeof(m_node) + sizeof(m_used) */
enum {
MAX_DATA_SIZE = SIZE
- - sizeof(intrusive::list_node<>)
+ - sizeof(ilist_node<>)
+ sizeof(ib_uint32_t)
};
@@ -167,7 +167,7 @@ public:
friend class dyn_buf_t;
};
- typedef intrusive::list<block_t> list_t;
+ typedef sized_ilist<block_t> list_t;
enum { MAX_DATA_SIZE = block_t::MAX_DATA_SIZE};
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index 9c722944665..62d87ce2c06 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -33,7 +33,7 @@ Created 10/25/1995 Heikki Tuuri
#include "dict0types.h"
#include "page0size.h"
#include "ibuf0types.h"
-#include "intrusive_list.h"
+#include "ilist.h"
#include <list>
@@ -82,8 +82,8 @@ fil_type_is_data(
struct fil_node_t;
/** Tablespace or log data space */
-struct fil_space_t : intrusive::list_node<unflushed_spaces_tag_t>,
- intrusive::list_node<rotation_list_tag_t>
+struct fil_space_t : ilist_node<unflushed_spaces_tag_t>,
+ ilist_node<rotation_list_tag_t>
{
ulint id; /*!< space id */
hash_node_t hash; /*!< hash chain node */
@@ -165,18 +165,18 @@ struct fil_space_t : intrusive::list_node<unflushed_spaces_tag_t>,
UT_LIST_NODE_T(fil_space_t) named_spaces;
/*!< list of spaces for which MLOG_FILE_NAME
records have been issued */
- /** Checks that this tablespace in a list of unflushed tablespaces.
- @return true if in a list */
- bool is_in_unflushed_spaces() const;
UT_LIST_NODE_T(fil_space_t) space_list;
/*!< list of all spaces */
- /** Checks that this tablespace needs key rotation.
- @return true if in a rotation list */
- bool is_in_rotation_list() const;
/** MariaDB encryption data */
fil_space_crypt_t* crypt_data;
+ /** Checks that this tablespace in a list of unflushed tablespaces. */
+ bool is_in_unflushed_spaces;
+
+ /** Checks that this tablespace needs key rotation. */
+ bool is_in_rotation_list;
+
/** True if the device this filespace is on supports atomic writes */
bool atomic_write_supported;
@@ -507,7 +507,7 @@ struct fil_system_t {
not put to this list: they are opened
after the startup, and kept open until
shutdown */
- intrusive::list<fil_space_t, unflushed_spaces_tag_t> unflushed_spaces;
+ sized_ilist<fil_space_t, unflushed_spaces_tag_t> unflushed_spaces;
/*!< list of those
tablespaces whose files contain
unflushed writes; those spaces have
@@ -530,7 +530,7 @@ struct fil_system_t {
record has been written since
the latest redo log checkpoint.
Protected only by log_sys->mutex. */
- intrusive::list<fil_space_t, rotation_list_tag_t> rotation_list;
+ ilist<fil_space_t, rotation_list_tag_t> rotation_list;
/*!< list of all file spaces needing
key rotation.*/