Commit 7af0de9f authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.3 into 10.4

parents 8dffaaef 482710b2
......@@ -2349,7 +2349,8 @@ static void rocksdb_copy_back() {
return;
char rocksdb_home_dir[FN_REFLEN];
if (xb_rocksdb_datadir && is_abs_path(xb_rocksdb_datadir)) {
strncpy(rocksdb_home_dir, xb_rocksdb_datadir, sizeof(rocksdb_home_dir));
strncpy(rocksdb_home_dir, xb_rocksdb_datadir, sizeof rocksdb_home_dir - 1);
rocksdb_home_dir[sizeof rocksdb_home_dir - 1] = '\0';
} else {
snprintf(rocksdb_home_dir, sizeof(rocksdb_home_dir), "%s/%s", mysql_data_home,
xb_rocksdb_datadir?trim_dotslash(xb_rocksdb_datadir): ROCKSDB_BACKUP_DIR);
......
......@@ -2552,8 +2552,9 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name=
goto error;
}
strncpy(dst_name, (dest_name)?dest_name : cursor.rel_path, sizeof(dst_name));
strncpy(dst_name, dest_name ? dest_name : cursor.rel_path,
sizeof dst_name - 1);
dst_name[sizeof dst_name - 1] = '\0';
/* Setup the page write filter */
if (xtrabackup_incremental) {
......@@ -2871,7 +2872,8 @@ static void dbug_mariabackup_event(const char *event,const char *key)
if (slash)
*slash = '_';
} else {
strncpy(envvar, event, sizeof(envvar));
strncpy(envvar, event, sizeof envvar - 1);
envvar[sizeof envvar - 1] = '\0';
}
char *sql = getenv(envvar);
if (sql) {
......@@ -3282,7 +3284,7 @@ static dberr_t xb_assign_undo_space_start()
byte* page;
bool ret;
dberr_t error = DB_SUCCESS;
ulint space, page_no __attribute__((unused));
ulint space;
int n_retries = 5;
ulint fsp_flags;
......@@ -3334,10 +3336,10 @@ static dberr_t xb_assign_undo_space_start()
/* 0th slot always points to system tablespace.
1st slot should point to first undotablespace which is minimum. */
page_no = mach_read_ulint(TRX_SYS + TRX_SYS_RSEGS
+ TRX_SYS_RSEG_SLOT_SIZE
+ TRX_SYS_RSEG_PAGE_NO + page, MLOG_4BYTES);
ut_ad(page_no != FIL_NULL);
ut_ad(mach_read_from_4(TRX_SYS + TRX_SYS_RSEGS
+ TRX_SYS_RSEG_SLOT_SIZE
+ TRX_SYS_RSEG_PAGE_NO + page)
!= FIL_NULL);
space = mach_read_ulint(TRX_SYS + TRX_SYS_RSEGS
+ TRX_SYS_RSEG_SLOT_SIZE
......@@ -4498,7 +4500,8 @@ void backup_fix_ddl(void)
const char *extension = is_remote ? ".isl" : ".ibd";
name.append(extension);
char buf[FN_REFLEN];
strncpy(buf, name.c_str(), sizeof(buf));
strncpy(buf, name.c_str(), sizeof buf - 1);
buf[sizeof buf - 1] = '\0';
const char *dbname = buf;
char *p = strchr(buf, '/');
if (p == 0) {
......
......@@ -7800,7 +7800,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) {
......@@ -7830,7 +7829,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);
......@@ -7845,7 +7845,6 @@ ha_innobase::build_template(
}
} else {
no_icp:
mysql_row_templ_t* templ;
/* No index condition pushdown */
m_prebuilt->idx_cond = NULL;
ut_ad(num_v == 0);
......@@ -7899,7 +7898,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);
......
......@@ -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,
......
......@@ -4624,6 +4624,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()) {
......
......@@ -1063,11 +1063,10 @@ row_purge_parse_undo_rec(
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;
}
......
......@@ -718,14 +718,14 @@ static void trx_purge_truncate_history()
ut_ad(rseg->is_persistent());
ut_d(const ulint old_page = rseg->page_no);
rseg->page_no = trx_rseg_header_create(
buf_block_t* rblock = trx_rseg_header_create(
purge_sys.truncate.current,
rseg->id, sys_header, &mtr);
ut_ad(rblock);
rseg->page_no = rblock
? rblock->page.id.page_no() : FIL_NULL;
ut_ad(old_page == rseg->page_no);
trx_rsegf_t* rseg_header = trx_rsegf_get_new(
space.id, rseg->page_no, &mtr);
/* Before re-initialization ensure that we
free the existing structure. There can't be
any active transactions. */
......@@ -752,10 +752,10 @@ static void trx_purge_truncate_history()
&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 */
......
/*****************************************************************************
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
......@@ -294,8 +294,9 @@ 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,
......@@ -312,8 +313,7 @@ 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);
......@@ -346,7 +346,7 @@ trx_rseg_header_create(
block->page.id.page_no(), MLOG_4BYTES, mtr);
}
return block->page.id.page_no();
return block;
}
/** Free a rollback segment in memory. */
......@@ -623,14 +623,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]);
......@@ -654,10 +654,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;
......
/*****************************************************************************
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);
......@@ -196,11 +195,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 */
......
......@@ -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.
......
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