summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-03-21 10:14:23 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2019-03-21 10:14:23 +0200
commit5a780f2ec80ae48af44176157ab76ec104f209c0 (patch)
treea520e4a884a8cc505ff253f4c9c0033ffe2f247c /storage
parentf41166133ba942b46bbab450a90511cee95f2496 (diff)
parent1caec9c8982a73f3db78fabc570934b837658109 (diff)
downloadmariadb-git-5a780f2ec80ae48af44176157ab76ec104f209c0.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/handler/ha_innodb.cc8
-rw-r--r--storage/innobase/include/trx0rseg.h5
-rw-r--r--storage/innobase/row/row0merge.cc1
-rw-r--r--storage/innobase/row/row0purge.cc3
-rw-r--r--storage/innobase/trx/trx0purge.cc16
-rw-r--r--storage/innobase/trx/trx0rseg.cc51
-rw-r--r--storage/innobase/trx/trx0sys.cc9
-rw-r--r--storage/innobase/ut/ut0rbt.cc2
8 files changed, 44 insertions, 51 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 38da1025a24..682cc5be9a3 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -7769,7 +7769,6 @@ ha_innobase::build_template(
/* Include the fields that are not needed in index condition
pushdown. */
for (ulint i = 0; i < n_fields; i++) {
- mysql_row_templ_t* templ;
const Field* field = table->field[i];
const bool is_v = !field->stored_in_db();
if (is_v && skip_virtual) {
@@ -7800,7 +7799,8 @@ ha_innobase::build_template(
}
}
- templ = build_template_field(
+ ut_d(mysql_row_templ_t* templ =)
+ build_template_field(
m_prebuilt, clust_index, index,
table, field, i - num_v, num_v);
ut_ad(templ->is_virtual == (ulint)is_v);
@@ -7814,7 +7814,6 @@ ha_innobase::build_template(
m_prebuilt->idx_cond = this;
} else {
no_icp:
- mysql_row_templ_t* templ;
/* No index condition pushdown */
m_prebuilt->idx_cond = NULL;
ut_ad(num_v == 0);
@@ -7874,7 +7873,8 @@ no_icp:
}
}
- templ = build_template_field(
+ ut_d(mysql_row_templ_t* templ =)
+ build_template_field(
m_prebuilt, clust_index, index,
table, field, i - num_v, num_v);
ut_ad(templ->is_virtual == (ulint)is_v);
diff --git a/storage/innobase/include/trx0rseg.h b/storage/innobase/include/trx0rseg.h
index a89b82c7a43..caa415500d5 100644
--- a/storage/innobase/include/trx0rseg.h
+++ b/storage/innobase/include/trx0rseg.h
@@ -73,8 +73,9 @@ trx_rsegf_undo_find_free(const trx_rsegf_t* rsegf);
@param[in] rseg_id rollback segment identifier
@param[in,out] sys_header the TRX_SYS page (NULL for temporary rseg)
@param[in,out] mtr mini-transaction
-@return page number of the created segment, FIL_NULL if fail */
-ulint
+@return the created rollback segment
+@retval NULL on failure */
+buf_block_t*
trx_rseg_header_create(
fil_space_t* space,
ulint rseg_id,
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index f5a690ce2f2..3a3985415c8 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -4625,6 +4625,7 @@ row_merge_build_indexes(
DBUG_RETURN(DB_OUT_OF_MEMORY);
}
+ crypt_pfx.m_size = 0; /* silence bogus -Wmaybe-uninitialized */
TRASH_ALLOC(&crypt_pfx, sizeof crypt_pfx);
if (log_tmp_is_encrypted()) {
diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc
index af53a3bc153..3b12fbfdbb9 100644
--- a/storage/innobase/row/row0purge.cc
+++ b/storage/innobase/row/row0purge.cc
@@ -1059,11 +1059,10 @@ try_again:
node->table = dict_table_open_on_id(
table_id, FALSE, DICT_TABLE_OP_NORMAL);
- trx_id_t trx_id;
+ trx_id_t trx_id = TRX_ID_MAX;
if (node->table == NULL) {
/* The table has been dropped: no need to do purge */
- trx_id = TRX_ID_MAX;
goto err_exit;
}
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index eb8deb58e24..defe2c08507 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -981,15 +981,11 @@ not_found:
buf_block_t* sys_header = trx_sysf_get(&mtr);
for (ulint i = 0; i < undo_trunc->rsegs_size(); ++i) {
- trx_rsegf_t* rseg_header;
-
trx_rseg_t* rseg = undo_trunc->get_ith_rseg(i);
-
- rseg->page_no = trx_rseg_header_create(
+ buf_block_t* rblock = trx_rseg_header_create(
space, rseg->id, sys_header, &mtr);
-
- rseg_header = trx_rsegf_get_new(
- space_id, rseg->page_no, &mtr);
+ ut_ad(rblock);
+ rseg->page_no = rblock ? rblock->page.id.page_no() : FIL_NULL;
/* Before re-initialization ensure that we free the existing
structure. There can't be any active transactions. */
@@ -1013,8 +1009,10 @@ not_found:
UT_LIST_INIT(rseg->old_insert_list, &trx_undo_t::undo_list);
/* These were written by trx_rseg_header_create(). */
- ut_ad(!mach_read_from_4(rseg_header + TRX_RSEG_FORMAT));
- ut_ad(!mach_read_from_4(rseg_header + TRX_RSEG_HISTORY_SIZE));
+ ut_ad(!mach_read_from_4(TRX_RSEG + TRX_RSEG_FORMAT
+ + rblock->frame));
+ ut_ad(!mach_read_from_4(TRX_RSEG + TRX_RSEG_HISTORY_SIZE
+ + rblock->frame));
/* Initialize the undo log lists according to the rseg header */
rseg->curr_size = 1;
diff --git a/storage/innobase/trx/trx0rseg.cc b/storage/innobase/trx/trx0rseg.cc
index 4a3102d225f..10092375ebd 100644
--- a/storage/innobase/trx/trx0rseg.cc
+++ b/storage/innobase/trx/trx0rseg.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2019, 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
@@ -265,16 +265,15 @@ void trx_rseg_format_upgrade(trx_rsegf_t* rseg_header, mtr_t* mtr)
@param[in] rseg_id rollback segment identifier
@param[in,out] sys_header the TRX_SYS page (NULL for temporary rseg)
@param[in,out] mtr mini-transaction
-@return page number of the created segment, FIL_NULL if fail */
-ulint
+@return the created rollback segment
+@retval NULL on failure */
+buf_block_t*
trx_rseg_header_create(
fil_space_t* space,
ulint rseg_id,
buf_block_t* sys_header,
mtr_t* mtr)
{
- ulint page_no;
- trx_rsegf_t* rsegf;
buf_block_t* block;
ut_ad(mtr_memo_contains(mtr, &space->latch, MTR_MEMO_X_LOCK));
@@ -285,29 +284,25 @@ trx_rseg_header_create(
if (block == NULL) {
/* No space left */
-
- return(FIL_NULL);
+ return block;
}
buf_block_dbg_add_level(block, SYNC_RSEG_HEADER_NEW);
- page_no = block->page.id.page_no();
-
- /* Get the rollback segment file page */
- rsegf = trx_rsegf_get_new(space->id, page_no, mtr);
-
- mlog_write_ulint(rsegf + TRX_RSEG_FORMAT, 0, MLOG_4BYTES, mtr);
+ mlog_write_ulint(TRX_RSEG + TRX_RSEG_FORMAT + block->frame, 0,
+ MLOG_4BYTES, mtr);
/* Initialize the history list */
- mlog_write_ulint(rsegf + TRX_RSEG_HISTORY_SIZE, 0, MLOG_4BYTES, mtr);
- flst_init(rsegf + TRX_RSEG_HISTORY, mtr);
+ mlog_write_ulint(TRX_RSEG + TRX_RSEG_HISTORY_SIZE + block->frame, 0,
+ MLOG_4BYTES, mtr);
+ flst_init(TRX_RSEG + TRX_RSEG_HISTORY + block->frame, mtr);
+ trx_rsegf_t* rsegf = TRX_RSEG + block->frame;
/* Reset the undo log slots */
for (ulint i = 0; i < TRX_RSEG_N_SLOTS; i++) {
- /* FIXME: This is generating a lot of redo log.
- Why not just let it remain zero-initialized,
- and adjust trx_rsegf_undo_find_free() and friends? */
+ /* This is generating a lot of redo log. MariaDB 10.4
+ introduced MLOG_MEMSET to reduce the redo log volume. */
trx_rsegf_set_nth_undo(rsegf, i, FIL_NULL, mtr);
}
@@ -324,10 +319,10 @@ trx_rseg_header_create(
+ TRX_SYS_RSEG_PAGE_NO
+ rseg_id * TRX_SYS_RSEG_SLOT_SIZE
+ sys_header->frame,
- page_no, MLOG_4BYTES, mtr);
+ block->page.id.page_no(), MLOG_4BYTES, mtr);
}
- return(page_no);
+ return block;
}
/** Free a rollback segment in memory. */
@@ -604,14 +599,14 @@ trx_rseg_create(ulint space_id)
if (buf_block_t* sys_header = trx_sysf_get(&mtr)) {
ulint rseg_id = trx_sys_rseg_find_free(sys_header);
- ulint page_no = rseg_id == ULINT_UNDEFINED
- ? FIL_NULL
- : trx_rseg_header_create(space, rseg_id, sys_header,
- &mtr);
- if (page_no != FIL_NULL) {
+ if (buf_block_t* rblock = rseg_id == ULINT_UNDEFINED
+ ? NULL
+ : trx_rseg_header_create(space, rseg_id, sys_header,
+ &mtr)) {
ut_ad(trx_sysf_rseg_get_space(sys_header, rseg_id)
== space_id);
- rseg = trx_rseg_mem_create(rseg_id, space, page_no);
+ rseg = trx_rseg_mem_create(rseg_id, space,
+ rblock->page.id.page_no());
ut_ad(rseg->id == rseg_id);
ut_ad(rseg->is_persistent());
ut_ad(!trx_sys.rseg_array[rseg->id]);
@@ -635,10 +630,10 @@ trx_temp_rseg_create()
mtr.set_log_mode(MTR_LOG_NO_REDO);
mtr_x_lock(&fil_system.temp_space->latch, &mtr);
- ulint page_no = trx_rseg_header_create(
+ buf_block_t* rblock = trx_rseg_header_create(
fil_system.temp_space, i, NULL, &mtr);
trx_rseg_t* rseg = trx_rseg_mem_create(
- i, fil_system.temp_space, page_no);
+ i, fil_system.temp_space, rblock->page.id.page_no());
ut_ad(!rseg->is_persistent());
ut_ad(!trx_sys.temp_rsegs[i]);
trx_sys.temp_rsegs[i] = rseg;
diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc
index b46805eef4b..341708abcb0 100644
--- a/storage/innobase/trx/trx0sys.cc
+++ b/storage/innobase/trx/trx0sys.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2019, 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
@@ -148,7 +148,6 @@ trx_sysf_create(
ulint slot_no;
buf_block_t* block;
page_t* page;
- ulint page_no;
byte* ptr;
ut_ad(mtr);
@@ -197,11 +196,11 @@ trx_sysf_create(
/* Create the first rollback segment in the SYSTEM tablespace */
slot_no = trx_sys_rseg_find_free(block);
- page_no = trx_rseg_header_create(fil_system.sys_space, slot_no, block,
- mtr);
+ buf_block_t* rblock = trx_rseg_header_create(fil_system.sys_space,
+ slot_no, block, mtr);
ut_a(slot_no == TRX_SYS_SYSTEM_RSEG_ID);
- ut_a(page_no == FSP_FIRST_RSEG_PAGE_NO);
+ ut_a(rblock->page.id.page_no() == FSP_FIRST_RSEG_PAGE_NO);
}
/** Create the instance */
diff --git a/storage/innobase/ut/ut0rbt.cc b/storage/innobase/ut/ut0rbt.cc
index 0da924fed43..fe53cef7b2d 100644
--- a/storage/innobase/ut/ut0rbt.cc
+++ b/storage/innobase/ut/ut0rbt.cc
@@ -89,7 +89,6 @@ rbt_check_ordering(
return(TRUE);
}
-#endif /* UNIV_DEBUG || IB_RBT_TESTING */
/**********************************************************************//**
Check that every path from the root to the leaves has the same count.
@@ -138,6 +137,7 @@ rbt_count_black_nodes(
return(result);
}
+#endif /* UNIV_DEBUG || IB_RBT_TESTING */
/**********************************************************************//**
Turn the node's right child's left sub-tree into node's right sub-tree.