summaryrefslogtreecommitdiff
path: root/storage/innobase/fsp
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-05-16 07:39:15 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-05-16 07:39:15 +0300
commit9e6e43551fc61bc34152f8d60f5d72f0d3814787 (patch)
tree67a834e1fee12ed5d4bf9897aa00146d728d936b /storage/innobase/fsp
parent4f29d776c756ac522ae49c481ea8975dee8787fe (diff)
parent3d0bb2b7f1eb39d1b3773e634499ff98576679f7 (diff)
downloadmariadb-git-9e6e43551fc61bc34152f8d60f5d72f0d3814787.tar.gz
Merge 10.3 into 10.4
We will expose some more std::atomic internals in Atomic_counter, so that dict_index_t::lock will support the default assignment operator.
Diffstat (limited to 'storage/innobase/fsp')
-rw-r--r--storage/innobase/fsp/fsp0fsp.cc114
1 files changed, 25 insertions, 89 deletions
diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc
index 809ad3ded4f..dcaf4138c89 100644
--- a/storage/innobase/fsp/fsp0fsp.cc
+++ b/storage/innobase/fsp/fsp0fsp.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, 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
the terms of the GNU General Public License as published by the Free Software
@@ -2721,8 +2721,6 @@ fseg_mark_page_used(
@param[in] seg_inode segment inode
@param[in,out] space tablespace
@param[in] offset page number
-@param[in] ahi whether we may need to drop the adaptive
-hash index
@param[in] log whether to write MLOG_INIT_FREE_PAGE record
@param[in,out] mtr mini-transaction */
static
@@ -2731,9 +2729,6 @@ fseg_free_page_low(
fseg_inode_t* seg_inode,
fil_space_t* space,
page_no_t offset,
-#ifdef BTR_CUR_HASH_ADAPT
- bool ahi,
-#endif /* BTR_CUR_HASH_ADAPT */
bool log,
mtr_t* mtr)
{
@@ -2749,15 +2744,6 @@ fseg_free_page_low(
== FSEG_MAGIC_N_VALUE);
ut_ad(!((page_offset(seg_inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE));
ut_d(space->modify_check(*mtr));
-#ifdef BTR_CUR_HASH_ADAPT
- /* Drop search system page hash index if the page is found in
- the pool and is hashed */
-
- if (ahi) {
- btr_search_drop_page_hash_when_freed(
- page_id_t(space->id, offset));
- }
-#endif /* BTR_CUR_HASH_ADAPT */
descr = xdes_get_descriptor(space, offset, mtr);
@@ -2842,27 +2828,17 @@ fseg_free_page_low(
}
}
-#ifndef BTR_CUR_HASH_ADAPT
-# define fseg_free_page_low(inode, space, offset, ahi, log, mtr) \
- fseg_free_page_low(inode, space, offset, log, mtr)
-#endif /* !BTR_CUR_HASH_ADAPT */
-
/** Free a page in a file segment.
@param[in,out] seg_header file segment header
@param[in,out] space tablespace
@param[in] offset page number
-@param[in] ahi whether we may need to drop the adaptive
-hash index
@param[in] log whether to write MLOG_INIT_FREE_PAGE record
@param[in,out] mtr mini-transaction */
void
-fseg_free_page_func(
+fseg_free_page(
fseg_header_t* seg_header,
fil_space_t* space,
ulint offset,
-#ifdef BTR_CUR_HASH_ADAPT
- bool ahi,
-#endif /* BTR_CUR_HASH_ADAPT */
bool log,
mtr_t* mtr)
{
@@ -2881,7 +2857,7 @@ fseg_free_page_func(
fil_block_check_type(*iblock, FIL_PAGE_INODE, mtr);
}
- fseg_free_page_low(seg_inode, space, offset, ahi, log, mtr);
+ fseg_free_page_low(seg_inode, space, offset, log, mtr);
ut_d(buf_page_set_file_page_was_freed(page_id_t(space->id, offset)));
@@ -2921,8 +2897,6 @@ fseg_page_is_free(fil_space_t* space, unsigned page)
@param[in,out] seg_inode segment inode
@param[in,out] space tablespace
@param[in] page page number in the extent
-@param[in] ahi whether we may need to drop
- the adaptive hash index
@param[in,out] mtr mini-transaction */
MY_ATTRIBUTE((nonnull))
static
@@ -2931,12 +2905,8 @@ fseg_free_extent(
fseg_inode_t* seg_inode,
fil_space_t* space,
ulint page,
-#ifdef BTR_CUR_HASH_ADAPT
- bool ahi,
-#endif /* BTR_CUR_HASH_ADAPT */
mtr_t* mtr)
{
- ulint first_page_in_extent;
xdes_t* descr;
ulint not_full_n_used;
ulint descr_n_used;
@@ -2951,24 +2921,9 @@ fseg_free_extent(
== FSEG_MAGIC_N_VALUE);
ut_d(space->modify_check(*mtr));
- first_page_in_extent = page - (page % FSP_EXTENT_SIZE);
-
-#ifdef BTR_CUR_HASH_ADAPT
- if (ahi) {
- for (ulint i = 0; i < FSP_EXTENT_SIZE; i++) {
- if (!xdes_mtr_get_bit(descr, XDES_FREE_BIT, i, mtr)) {
-
- /* Drop search system page hash index
- if the page is found in the pool and
- is hashed */
-
- btr_search_drop_page_hash_when_freed(
- page_id_t(space->id,
- first_page_in_extent + i));
- }
- }
- }
-#endif /* BTR_CUR_HASH_ADAPT */
+#if defined BTR_CUR_HASH_ADAPT || defined UNIV_DEBUG
+ const ulint first_page_in_extent = page - (page % FSP_EXTENT_SIZE);
+#endif /* BTR_CUR_HASH_ADAPT || UNIV_DEBUG */
if (xdes_is_full(descr, mtr)) {
flst_remove(seg_inode + FSEG_FULL,
@@ -3000,27 +2955,18 @@ fseg_free_extent(
#endif /* UNIV_DEBUG */
}
-#ifndef BTR_CUR_HASH_ADAPT
-# define fseg_free_extent(inode, space, page, ahi, mtr) \
- fseg_free_extent(inode, space, page, mtr)
-#endif /* !BTR_CUR_HASH_ADAPT */
-
/**********************************************************************//**
Frees part of a segment. This function can be used to free a segment by
repeatedly calling this function in different mini-transactions. Doing
the freeing in a single mini-transaction might result in too big a
mini-transaction.
-@return TRUE if freeing completed */
-ibool
-fseg_free_step_func(
+@return whether the freeing was completed */
+bool
+fseg_free_step(
fseg_header_t* header, /*!< in, own: segment header; NOTE: if the header
resides on the first page of the frag list
of the segment, this pointer becomes obsolete
after the last freeing step */
-#ifdef BTR_CUR_HASH_ADAPT
- bool ahi, /*!< in: whether we may need to drop
- the adaptive hash index */
-#endif /* BTR_CUR_HASH_ADAPT */
mtr_t* mtr) /*!< in/out: mini-transaction */
{
ulint n;
@@ -3051,7 +2997,7 @@ fseg_free_step_func(
if (inode == NULL) {
ib::info() << "Double free of inode from "
<< page_id_t(space_id, header_page);
- DBUG_RETURN(TRUE);
+ DBUG_RETURN(true);
}
if (!space->full_crc32()) {
@@ -3062,8 +3008,8 @@ fseg_free_step_func(
if (descr != NULL) {
/* Free the extent held by the segment */
page = xdes_get_offset(descr);
- fseg_free_extent(inode, space, page, ahi, mtr);
- DBUG_RETURN(FALSE);
+ fseg_free_extent(inode, space, page, mtr);
+ DBUG_RETURN(false);
}
/* Free a frag page */
@@ -3073,13 +3019,13 @@ fseg_free_step_func(
/* Freeing completed: free the segment inode */
fsp_free_seg_inode(space, inode, mtr);
- DBUG_RETURN(TRUE);
+ DBUG_RETURN(true);
}
fseg_free_page_low(
inode, space,
fseg_get_nth_frag_page_no(inode, n, mtr),
- ahi, true, mtr);
+ true, mtr);
n = fseg_find_last_used_frag_page_slot(inode, mtr);
@@ -3087,24 +3033,20 @@ fseg_free_step_func(
/* Freeing completed: free the segment inode */
fsp_free_seg_inode(space, inode, mtr);
- DBUG_RETURN(TRUE);
+ DBUG_RETURN(true);
}
- DBUG_RETURN(FALSE);
+ DBUG_RETURN(false);
}
/**********************************************************************//**
Frees part of a segment. Differs from fseg_free_step because this function
leaves the header page unfreed.
-@return TRUE if freeing completed, except the header page */
-ibool
-fseg_free_step_not_header_func(
+@return whether the freeing was completed, except for the header page */
+bool
+fseg_free_step_not_header(
fseg_header_t* header, /*!< in: segment header which must reside on
the first fragment page of the segment */
-#ifdef BTR_CUR_HASH_ADAPT
- bool ahi, /*!< in: whether we may need to drop
- the adaptive hash index */
-#endif /* BTR_CUR_HASH_ADAPT */
mtr_t* mtr) /*!< in/out: mini-transaction */
{
ulint n;
@@ -3131,30 +3073,24 @@ fseg_free_step_not_header_func(
if (descr != NULL) {
/* Free the extent held by the segment */
page = xdes_get_offset(descr);
-
- fseg_free_extent(inode, space, page, ahi, mtr);
-
- return(FALSE);
+ fseg_free_extent(inode, space, page, mtr);
+ return false;
}
/* Free a frag page */
n = fseg_find_last_used_frag_page_slot(inode, mtr);
- if (n == ULINT_UNDEFINED) {
- ut_error;
- }
+ ut_a(n != ULINT_UNDEFINED);
page_no = fseg_get_nth_frag_page_no(inode, n, mtr);
if (page_no == page_get_page_no(page_align(header))) {
-
- return(TRUE);
+ return true;
}
- fseg_free_page_low(inode, space, page_no, ahi, true, mtr);
-
- return(FALSE);
+ fseg_free_page_low(inode, space, page_no, true, mtr);
+ return false;
}
/** Returns the first extent descriptor for a segment.