summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2020-07-03 23:31:12 +0300
committerMonty <monty@mariadb.org>2020-07-03 23:31:12 +0300
commit0fd89a1a89da73cec8e87e1f007637eaec51dcc0 (patch)
tree2198830733091087ae4d342d56c93540698ec325 /storage
parent70684afef2ce6d797f78db192c4472260cd22660 (diff)
parente9f06b19e09319d11c346943871254aaf755af24 (diff)
downloadmariadb-git-0fd89a1a89da73cec8e87e1f007637eaec51dcc0.tar.gz
Merge remote-tracking branch 'origin/10.4' into 10.5
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/btr/btr0cur.cc6
-rw-r--r--storage/innobase/buf/buf0buddy.cc2
-rw-r--r--storage/innobase/buf/buf0buf.cc8
-rw-r--r--storage/innobase/buf/buf0lru.cc8
-rw-r--r--storage/innobase/data/data0data.cc4
-rw-r--r--storage/innobase/handler/ha_innodb.cc4
-rw-r--r--storage/innobase/include/buf0buf.ic2
-rw-r--r--storage/innobase/include/dict0stats.ic4
-rw-r--r--storage/innobase/include/mem0mem.ic2
-rw-r--r--storage/innobase/include/srv0mon.h6
-rw-r--r--storage/innobase/include/ut0pool.h14
-rw-r--r--storage/innobase/mtr/mtr0mtr.cc4
-rw-r--r--storage/innobase/page/page0cur.cc8
-rw-r--r--storage/innobase/page/page0zip.cc6
-rw-r--r--storage/innobase/row/row0ftsort.cc4
-rw-r--r--storage/innobase/row/row0ins.cc2
-rw-r--r--storage/innobase/row/row0log.cc18
-rw-r--r--storage/innobase/row/row0merge.cc14
-rw-r--r--storage/innobase/row/row0sel.cc10
-rw-r--r--storage/innobase/row/row0upd.cc2
-rw-r--r--storage/innobase/sync/sync0arr.cc2
-rw-r--r--storage/innobase/trx/trx0trx.cc11
-rw-r--r--storage/tokudb/ha_tokudb.cc5
23 files changed, 43 insertions, 103 deletions
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index a282826b8de..550e3f36c6c 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -1299,12 +1299,10 @@ btr_cur_search_to_nth_level_func(
ut_ad(!(index->type & DICT_FTS));
ut_ad(index->page != FIL_NULL);
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(&cursor->up_match, sizeof cursor->up_match);
MEM_UNDEFINED(&cursor->up_bytes, sizeof cursor->up_bytes);
MEM_UNDEFINED(&cursor->low_match, sizeof cursor->low_match);
MEM_UNDEFINED(&cursor->low_bytes, sizeof cursor->low_bytes);
-#endif /* HAVE_valgrind_or_MSAN */
#ifdef UNIV_DEBUG
cursor->up_match = ULINT_UNDEFINED;
cursor->low_match = ULINT_UNDEFINED;
@@ -3367,12 +3365,12 @@ btr_cur_optimistic_insert(
|| (flags & BTR_CREATE_FLAG));
ut_ad(dtuple_check_typed(entry));
-#ifdef HAVE_valgrind_or_MSAN
+#ifdef HAVE_valgrind
if (block->page.zip.data) {
MEM_CHECK_DEFINED(page, srv_page_size);
MEM_CHECK_DEFINED(block->page.zip.data, block->zip_size());
}
-#endif /* HAVE_valgrind_or_MSAN */
+#endif /* HAVE_valgrind */
leaf = page_is_leaf(page);
diff --git a/storage/innobase/buf/buf0buddy.cc b/storage/innobase/buf/buf0buddy.cc
index bedf00441ec..8280377b42a 100644
--- a/storage/innobase/buf/buf0buddy.cc
+++ b/storage/innobase/buf/buf0buddy.cc
@@ -364,9 +364,7 @@ buf_buddy_block_free(void* buf)
HASH_DELETE(buf_page_t, hash, &buf_pool.zip_hash, fold, bpage);
ut_d(memset(buf, 0, srv_page_size));
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(buf, srv_page_size);
-#endif /* HAVE_valgrind_or_MSAN */
block = (buf_block_t*) bpage;
buf_LRU_block_free_non_file_page(block);
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index 1e2abc2e04d..4deb34efc74 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -1356,6 +1356,8 @@ inline bool buf_pool_t::chunk_t::create(size_t bytes)
if (UNIV_UNLIKELY(!mem))
return false;
+ MEM_MAKE_ADDRESSABLE(mem, mem_size());
+
#ifdef HAVE_LIBNUMA
if (srv_numa_interleave)
{
@@ -1736,9 +1738,7 @@ inline bool buf_pool_t::realloc(buf_block_t *block)
"not perfect alignment");
memset_aligned<2>(block->frame
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, 0xff, 4);
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(block->frame, srv_page_size);
-#endif /* HAVE_valgrind_or_MSAN */
block->page.set_state(BUF_BLOCK_REMOVE_HASH);
/* Relocate flush_list. */
@@ -2257,6 +2257,8 @@ withdraw_retry:
ulint sum_freed = 0;
while (chunk < echunk) {
+ MEM_MAKE_ADDRESSABLE(chunk->mem, chunk->size);
+
buf_block_t* block = chunk->blocks;
for (ulint j = chunk->size; j--; block++) {
@@ -3382,9 +3384,7 @@ evict_from_pool:
block->page.set_io_fix(BUF_IO_READ);
rw_lock_x_lock_inline(&block->lock, 0, file, line);
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(bpage, sizeof *bpage);
-#endif /* HAVE_valgrind_or_MSAN */
mutex_exit(&buf_pool.mutex);
hash_lock->write_unlock();
diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc
index 41d1e40a730..577f1dae91c 100644
--- a/storage/innobase/buf/buf0lru.cc
+++ b/storage/innobase/buf/buf0lru.cc
@@ -626,7 +626,7 @@ buf_block_t* buf_LRU_get_free_only()
assert_block_ahi_empty(block);
block->page.set_state(BUF_BLOCK_MEMORY);
- MEM_UNDEFINED(block->frame, srv_page_size);
+ MEM_MAKE_ADDRESSABLE(block->frame, srv_page_size);
break;
}
@@ -1307,13 +1307,9 @@ func_exit:
order to avoid bogus Valgrind or MSAN warnings.*/
buf_block_t* block = reinterpret_cast<buf_block_t*>(bpage);
-#ifdef HAVE_valgrind_or_MSAN
MEM_MAKE_DEFINED(block->frame, srv_page_size);
-#endif /* HAVE_valgrind_or_MSAN */
btr_search_drop_page_hash_index(block);
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(block->frame, srv_page_size);
-#endif /* HAVE_valgrind_or_MSAN */
if (UNIV_LIKELY_NULL(b)) {
ut_ad(b->zip_size());
@@ -1511,9 +1507,7 @@ static bool buf_LRU_block_remove_hashed(buf_page_t *bpage, const page_id_t id,
"not perfect alignment");
memset_aligned<2>(reinterpret_cast<buf_block_t*>(bpage)->frame
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, 0xff, 4);
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(((buf_block_t*) bpage)->frame, srv_page_size);
-#endif /* HAVE_valgrind_or_MSAN */
bpage->set_state(BUF_BLOCK_REMOVE_HASH);
/* Question: If we release hash_lock here
diff --git a/storage/innobase/data/data0data.cc b/storage/innobase/data/data0data.cc
index 0fb9f5e66af..1341136d8d6 100644
--- a/storage/innobase/data/data0data.cc
+++ b/storage/innobase/data/data0data.cc
@@ -234,7 +234,7 @@ dtuple_validate(
const dtuple_t* tuple) /*!< in: tuple */
{
ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N);
-#ifdef HAVE_valgrind_or_MSAN
+#ifdef HAVE_valgrind
const ulint n_fields = dtuple_get_n_fields(tuple);
for (ulint i = 0; i < n_fields; i++) {
@@ -245,7 +245,7 @@ dtuple_validate(
dfield_get_len(field));
}
}
-#endif /* HAVE_valgrind_or_MSAN */
+#endif /* HAVE_valgrind */
ut_ad(dtuple_check_typed(tuple));
return(TRUE);
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 9344ec660b9..858fefaf2de 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -7033,9 +7033,7 @@ build_template_field(
ut_ad(clust_index->table == index->table);
templ = prebuilt->mysql_template + prebuilt->n_template++;
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(templ, sizeof *templ);
-#endif /* HAVE_valgrind_or_MSAN */
templ->is_virtual = !field->stored_in_db();
if (!templ->is_virtual) {
@@ -8146,9 +8144,7 @@ calc_row_difference(
/* The field has changed */
ufield = uvect->fields + n_changed;
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(ufield, sizeof *ufield);
-#endif /* HAVE_valgrind_or_MSAN */
/* Let us use a dummy dfield to make the conversion
from the MySQL column format to the InnoDB format */
diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
index 242c9cbb65d..cda7d435725 100644
--- a/storage/innobase/include/buf0buf.ic
+++ b/storage/innobase/include/buf0buf.ic
@@ -185,9 +185,7 @@ buf_page_alloc_descriptor(void)
bpage = (buf_page_t*) ut_zalloc_nokey(sizeof *bpage);
ut_ad(bpage);
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(bpage, sizeof *bpage);
-#endif /* HAVE_valgrind_or_MSAN */
return(bpage);
}
diff --git a/storage/innobase/include/dict0stats.ic b/storage/innobase/include/dict0stats.ic
index dbdbceab9ba..0b8c57a5eba 100644
--- a/storage/innobase/include/dict0stats.ic
+++ b/storage/innobase/include/dict0stats.ic
@@ -187,7 +187,7 @@ dict_stats_deinit(
table->stat_initialized = FALSE;
-#ifdef HAVE_valgrind_or_MSAN
+#ifdef HAVE_valgrind
MEM_UNDEFINED(&table->stat_n_rows, sizeof table->stat_n_rows);
MEM_UNDEFINED(&table->stat_clustered_index_size,
sizeof table->stat_clustered_index_size);
@@ -220,7 +220,7 @@ dict_stats_deinit(
&index->stat_n_leaf_pages,
sizeof(index->stat_n_leaf_pages));
}
-#endif /* HAVE_valgrind_or_MSAN */
+#endif /* HAVE_valgrind */
rw_lock_x_unlock(&table->stats_latch);
}
diff --git a/storage/innobase/include/mem0mem.ic b/storage/innobase/include/mem0mem.ic
index c1e7348a548..9236bbef05d 100644
--- a/storage/innobase/include/mem0mem.ic
+++ b/storage/innobase/include/mem0mem.ic
@@ -203,7 +203,7 @@ mem_heap_alloc(
mem_block_set_free(block, free + MEM_SPACE_NEEDED(n));
buf = buf + REDZONE_SIZE;
- MEM_UNDEFINED(buf, n - REDZONE_SIZE);
+ MEM_MAKE_ADDRESSABLE(buf, n - REDZONE_SIZE);
return(buf);
}
diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h
index 8e833642ee0..325bb3a2cee 100644
--- a/storage/innobase/include/srv0mon.h
+++ b/storage/innobase/include/srv0mon.h
@@ -651,14 +651,14 @@ Use MONITOR_DEC if appropriate mutex protection exists.
} \
}
-#ifdef HAVE_valgrind_or_MSAN
+#ifdef HAVE_valgrind
# define MONITOR_CHECK_DEFINED(value) do { \
mon_type_t m = value; \
MEM_CHECK_DEFINED(&m, sizeof m); \
} while (0)
-#else /* HAVE_valgrind_or_MSAN */
+#else /* HAVE_valgrind */
# define MONITOR_CHECK_DEFINED(value) (void) 0
-#endif /* HAVE_valgrind_or_MSAN */
+#endif /* HAVE_valgrind */
#define MONITOR_INC_VALUE(monitor, value) \
MONITOR_CHECK_DEFINED(value); \
diff --git a/storage/innobase/include/ut0pool.h b/storage/innobase/include/ut0pool.h
index 703a07a23f2..4a5f58f6fae 100644
--- a/storage/innobase/include/ut0pool.h
+++ b/storage/innobase/include/ut0pool.h
@@ -89,13 +89,12 @@ struct Pool {
ut_ad(elem->m_pool == this);
#ifdef __SANITIZE_ADDRESS__
/* Unpoison the memory for AddressSanitizer */
- MEM_UNDEFINED(&elem->m_type, sizeof elem->m_type);
+ MEM_MAKE_ADDRESSABLE(&elem->m_type,
+ sizeof elem->m_type);
#endif
-#ifdef HAVE_valgrind
- /* Declare the contents as initialized for Valgrind;
+ /* Declare the contents initialized;
we checked this in mem_free(). */
MEM_MAKE_DEFINED(&elem->m_type, sizeof elem->m_type);
-#endif
Factory::destroy(&elem->m_type);
}
@@ -134,14 +133,13 @@ struct Pool {
if (elem) {
# ifdef __SANITIZE_ADDRESS__
/* Unpoison the memory for AddressSanitizer */
- MEM_UNDEFINED(&elem->m_type, sizeof elem->m_type);
+ MEM_MAKE_ADDRESSABLE(&elem->m_type,
+ sizeof elem->m_type);
# endif
-# ifdef HAVE_valgrind
- /* Declare the memory initialized for Valgrind.
+ /* Declare the memory initialized.
The trx_t that are released to the pool are
actually initialized; we checked that by
MEM_CHECK_DEFINED() in mem_free() below. */
-# endif
MEM_MAKE_DEFINED(&elem->m_type, sizeof elem->m_type);
}
#endif
diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc
index 16a0ecc051c..940429b2cd6 100644
--- a/storage/innobase/mtr/mtr0mtr.cc
+++ b/storage/innobase/mtr/mtr0mtr.cc
@@ -354,10 +354,9 @@ struct mtr_write_log_t {
/** Start a mini-transaction. */
void mtr_t::start()
{
-#ifdef HAVE_valgrind_or_MSAN
+ ut_ad(!m_freed_pages);
MEM_UNDEFINED(this, sizeof *this);
MEM_MAKE_DEFINED(&m_freed_pages, sizeof(m_freed_pages));
-#endif /* HAVE_valgrind_or_MSAN */
ut_d(m_start= true);
ut_d(m_commit= false);
@@ -376,7 +375,6 @@ void mtr_t::start()
m_user_space= nullptr;
m_commit_lsn= 0;
m_freed_in_system_tablespace= m_trim_pages= false;
- ut_ad(!m_freed_pages);
}
/** Release the resources */
diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc
index 92e7ce5e60d..36fdde82cb3 100644
--- a/storage/innobase/page/page0cur.cc
+++ b/storage/innobase/page/page0cur.cc
@@ -1302,7 +1302,7 @@ page_cur_insert_rec_low(
/* 1. Get the size of the physical record in the page */
const ulint rec_size= rec_offs_size(offsets);
-#ifdef HAVE_valgrind_or_MSAN
+#ifdef HAVE_valgrind
{
const void *rec_start= rec - rec_offs_extra_size(offsets);
ulint extra_size= rec_offs_extra_size(offsets) -
@@ -1314,7 +1314,7 @@ page_cur_insert_rec_low(
/* The variable-length header must be valid. */
MEM_CHECK_DEFINED(rec_start, extra_size);
}
-#endif /* HAVE_valgrind_or_MSAN */
+#endif /* HAVE_valgrind */
/* 2. Try to find suitable space from page memory management */
bool reuse= false;
@@ -1702,7 +1702,7 @@ page_cur_insert_rec_zip(
/* 1. Get the size of the physical record in the page */
const ulint rec_size= rec_offs_size(offsets);
-#ifdef HAVE_valgrind_or_MSAN
+#ifdef HAVE_valgrind
{
const void *rec_start= rec - rec_offs_extra_size(offsets);
ulint extra_size= rec_offs_extra_size(offsets) - REC_N_NEW_EXTRA_BYTES;
@@ -1711,7 +1711,7 @@ page_cur_insert_rec_zip(
/* The variable-length header must be valid. */
MEM_CHECK_DEFINED(rec_start, extra_size);
}
-#endif /* HAVE_valgrind_or_MSAN */
+#endif /* HAVE_valgrind */
const bool reorg_before_insert= page_has_garbage(cursor->block->frame) &&
rec_size > page_get_max_insert_size(cursor->block->frame, 1) &&
rec_size <= page_get_max_insert_size_after_reorganize(cursor->block->frame,
diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc
index a89ae5b3a64..0f6a1c33e54 100644
--- a/storage/innobase/page/page0zip.cc
+++ b/storage/innobase/page/page0zip.cc
@@ -1552,11 +1552,11 @@ err_exit:
ut_ad(buf + c_stream.total_out == c_stream.next_out);
ut_ad((ulint) (storage - c_stream.next_out) >= c_stream.avail_out);
-#ifdef HAVE_valgrind
+#if defined HAVE_valgrind && !__has_feature(memory_sanitizer)
/* Valgrind believes that zlib does not initialize some bits
in the last 7 or 8 bytes of the stream. Make Valgrind happy. */
MEM_MAKE_DEFINED(buf, c_stream.total_out);
-#endif /* HAVE_valgrind */
+#endif /* HAVE_valgrind && !memory_sanitizer */
/* Zero out the area reserved for the modification log.
Space for the end marker of the modification log is not
@@ -3076,9 +3076,7 @@ page_zip_decompress_low(
/* Clear the uncompressed page, except the header. */
memset(PAGE_DATA + page, 0x55, srv_page_size - PAGE_DATA);
#endif /* UNIV_ZIP_DEBUG */
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(PAGE_DATA + page, srv_page_size - PAGE_DATA);
-#endif /* HAVE_valgrind_or_MSAN */
/* Copy the page directory. */
if (UNIV_UNLIKELY(!page_zip_dir_decode(page_zip, page, recs,
diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc
index 4698f25428c..29197fde46b 100644
--- a/storage/innobase/row/row0ftsort.cc
+++ b/storage/innobase/row/row0ftsort.cc
@@ -982,14 +982,14 @@ exit:
goto func_exit;
}
-#ifdef HAVE_valgrind_or_MSAN
+#ifdef HAVE_valgrind
MEM_UNDEFINED(block[i], srv_sort_buf_size);
if (crypt_block[i]) {
MEM_UNDEFINED(crypt_block[i],
srv_sort_buf_size);
}
-#endif /* HAVE_valgrind_or_MSAN */
+#endif /* HAVE_valgrind */
}
buf[i] = row_merge_buf_empty(buf[i]);
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index 5f3cdb4356e..0f1e8007d36 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -1240,10 +1240,8 @@ row_ins_foreign_check_on_constraint(
update->info_bits = 0;
update->n_fields = foreign->n_fields;
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(update->fields,
update->n_fields * sizeof *update->fields);
-#endif /* HAVE_valgrind_or_MSAN */
bool affects_fulltext = false;
diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc
index 78f605c373d..4db1b7cfa7f 100644
--- a/storage/innobase/row/row0log.cc
+++ b/storage/innobase/row/row0log.cc
@@ -375,9 +375,7 @@ row_log_online_op(
goto err_exit;
}
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(log->tail.buf, sizeof log->tail.buf);
-#endif /* HAVE_valgrind_or_MSAN */
ut_ad(log->tail.bytes < srv_sort_buf_size);
avail_size = srv_sort_buf_size - log->tail.bytes;
@@ -462,10 +460,8 @@ write_failed:
index->type |= DICT_CORRUPT;
}
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(log->tail.block, srv_sort_buf_size);
MEM_UNDEFINED(buf, srv_sort_buf_size);
-#endif /* HAVE_valgrind_or_MSAN */
memcpy(log->tail.block, log->tail.buf + avail_size,
mrec_size - avail_size);
@@ -475,9 +471,7 @@ write_failed:
ut_ad(b == log->tail.block + log->tail.bytes);
}
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(log->tail.buf, sizeof log->tail.buf);
-#endif /* HAVE_valgrind_or_MSAN */
err_exit:
mutex_exit(&log->mutex);
}
@@ -509,9 +503,7 @@ row_log_table_open(
{
mutex_enter(&log->mutex);
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(log->tail.buf, sizeof log->tail.buf);
-#endif /* HAVE_valgrind_or_MSAN */
if (log->error != DB_SUCCESS) {
err_exit:
@@ -603,10 +595,9 @@ row_log_table_close_func(
write_failed:
log->error = DB_ONLINE_LOG_TOO_BIG;
}
-#ifdef HAVE_valgrind_or_MSAN
+
MEM_UNDEFINED(log->tail.block, srv_sort_buf_size);
MEM_UNDEFINED(buf, srv_sort_buf_size);
-#endif /* HAVE_valgrind_or_MSAN */
memcpy(log->tail.block, log->tail.buf + avail, size - avail);
log->tail.bytes = size - avail;
} else {
@@ -615,9 +606,7 @@ write_failed:
}
log->tail.total += size;
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(log->tail.buf, sizeof log->tail.buf);
-#endif /* HAVE_valgrind_or_MSAN */
err_exit:
mutex_exit(&log->mutex);
@@ -2789,9 +2778,7 @@ row_log_table_apply_ops(
ut_ad(new_trx_id_col > 0);
ut_ad(new_trx_id_col != ULINT_UNDEFINED);
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(&mrec_end, sizeof mrec_end);
-#endif /* HAVE_valgrind_or_MSAN */
offsets = static_cast<rec_offs*>(ut_malloc_nokey(i * sizeof *offsets));
rec_offs_set_n_alloc(offsets, i);
@@ -3703,9 +3690,8 @@ row_log_apply_ops(
ut_ad(!index->is_committed());
ut_ad(rw_lock_own(dict_index_get_lock(index), RW_LOCK_X));
ut_ad(index->online_log);
-#ifdef HAVE_valgrind_or_MSAN
+
MEM_UNDEFINED(&mrec_end, sizeof mrec_end);
-#endif /* HAVE_valgrind_or_MSAN */
offsets = static_cast<rec_offs*>(ut_malloc_nokey(i * sizeof *offsets));
rec_offs_set_n_alloc(offsets, i);
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index d1074f74725..3e0ffcf28b9 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -1021,11 +1021,11 @@ row_merge_buf_write(
ut_a(b < &block[srv_sort_buf_size]);
ut_a(b == &block[0] + buf->total_size);
*b++ = 0;
-#ifdef HAVE_valgrind_or_MSAN
+#ifdef HAVE_valgrind
/* The rest of the block is uninitialized. Initialize it
to avoid bogus warnings. */
memset(b, 0xff, &block[srv_sort_buf_size] - b);
-#endif /* HAVE_valgrind_or_MSAN */
+#endif /* HAVE_valgrind */
DBUG_LOG("ib_merge_sort",
"write " << reinterpret_cast<const void*>(b) << ','
<< of->fd << ',' << of->offset << " EOF");
@@ -1418,9 +1418,7 @@ row_merge_write_rec(
return(NULL);
}
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(&block[0], srv_sort_buf_size);
-#endif /* HAVE_valgrind_or_MSAN */
/* Copy the rest. */
b = &block[0];
@@ -1471,9 +1469,7 @@ row_merge_write_eof(
DBUG_RETURN(NULL);
}
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(&block[0], srv_sort_buf_size);
-#endif
DBUG_RETURN(&block[0]);
}
@@ -2661,10 +2657,8 @@ write_buffers:
break;
}
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(
&block[0], srv_sort_buf_size);
-#endif /* HAVE_valgrind_or_MSAN */
}
}
merge_buf[i] = row_merge_buf_empty(buf);
@@ -3164,9 +3158,7 @@ row_merge(
foffs0 = 0;
foffs1 = ihalf;
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(run_offset, *num_run * sizeof *run_offset);
-#endif /* HAVE_valgrind_or_MSAN */
for (; foffs0 < ihalf && foffs1 < file->offset; foffs0++, foffs1++) {
@@ -3247,9 +3239,7 @@ row_merge(
*tmpfd = file->fd;
*file = of;
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(&block[0], 3 * srv_sort_buf_size);
-#endif /* HAVE_valgrind_or_MSAN */
return(DB_SUCCESS);
}
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index 8b46364c744..595a72eb415 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -974,11 +974,9 @@ row_sel_get_clust_rec(
switch (err) {
case DB_SUCCESS:
case DB_SUCCESS_LOCKED_REC:
-#ifdef HAVE_valgrind_or_MSAN
/* Declare the variable uninitialized.
It should be set to DB_SUCCESS at func_exit. */
MEM_UNDEFINED(&err, sizeof err);
-#endif /* HAVE_valgrind_or_MSAN */
break;
default:
goto err_exit;
@@ -2686,9 +2684,7 @@ row_sel_field_store_in_mysql_format_func(
ut_ad(len != UNIV_SQL_NULL);
MEM_CHECK_DEFINED(data, len);
MEM_CHECK_ADDRESSABLE(dest, templ->mysql_col_len);
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(dest, templ->mysql_col_len);
-#endif /* HAVE_valgrind_or_MSAN */
byte* pad = dest + len;
@@ -3615,9 +3611,7 @@ row_sel_copy_cached_field_for_mysql(
row_mysql_read_true_varchar(
&len, cache, templ->mysql_length_bytes);
len += templ->mysql_length_bytes;
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(buf, templ->mysql_col_len);
-#endif /* HAVE_valgrind_or_MSAN */
} else {
len = templ->mysql_col_len;
}
@@ -3693,9 +3687,7 @@ row_sel_dequeue_cached_row_for_mysql(
/* The record is long. Copy it field by field, in case
there are some long VARCHAR column of which only a
small length is being used. */
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(buf, prebuilt->mysql_prefix_len);
-#endif /* HAVE_valgrind_or_MSAN */
/* First copy the NULL bits. */
memcpy(buf, cached_rec, prebuilt->null_bitmap_len);
@@ -3779,10 +3771,8 @@ row_sel_fetch_last_buf(
}
ut_ad(prebuilt->fetch_cache_first == 0);
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(prebuilt->fetch_cache[prebuilt->n_fetch_cached],
prebuilt->mysql_row_len);
-#endif /* HAVE_valgrind_or_MSAN */
return(prebuilt->fetch_cache[prebuilt->n_fetch_cached]);
}
diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc
index 969d0017eeb..fe81cb46916 100644
--- a/storage/innobase/row/row0upd.cc
+++ b/storage/innobase/row/row0upd.cc
@@ -1542,9 +1542,7 @@ row_upd_changes_ord_field_binary_func(
/* Silence a compiler warning without
silencing a Valgrind error. */
dfield_len = 0;
-#ifdef HAVE_valgrind_or_MSAN
MEM_UNDEFINED(&dfield_len, sizeof dfield_len);
-#endif /* HAVE_valgrind_or_MSAN */
/* See if the column is stored externally. */
buf = row_ext_lookup(ext, col_no, &dfield_len);
diff --git a/storage/innobase/sync/sync0arr.cc b/storage/innobase/sync/sync0arr.cc
index a0203ca6bde..1e8ef62b429 100644
--- a/storage/innobase/sync/sync0arr.cc
+++ b/storage/innobase/sync/sync0arr.cc
@@ -891,7 +891,7 @@ sync_array_print_long_waits_low(
return(false);
}
-#ifdef HAVE_valgrind
+#if defined HAVE_valgrind && !__has_feature(memory_sanitizer)
/* Increase the timeouts if running under valgrind because it executes
extremely slowly. HAVE_valgrind does not necessary mean that
we are running under valgrind but we have no better way to tell.
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index eaf127b5a43..a8d3c2ed9b9 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -454,15 +454,11 @@ void trx_free(trx_t*& trx)
#ifdef __SANITIZE_ADDRESS__
/* Unpoison the memory for innodb_monitor_set_option;
it is operating also on the freed transaction objects. */
- MEM_UNDEFINED(&trx->mutex, sizeof trx->mutex);
+ MEM_MAKE_ADDRESSABLE(&trx->mutex, sizeof trx->mutex);
/* For innobase_kill_connection() */
-# ifdef WITH_WSREP
- MEM_UNDEFINED(&trx->wsrep, sizeof trx->wsrep);
-# endif
- MEM_UNDEFINED(&trx->state, sizeof trx->state);
- MEM_UNDEFINED(&trx->mysql_thd, sizeof trx->mysql_thd);
+ MEM_MAKE_ADDRESSABLE(&trx->state, sizeof trx->state);
+ MEM_MAKE_ADDRESSABLE(&trx->mysql_thd, sizeof trx->mysql_thd);
#endif
-#ifdef HAVE_valgrind_or_MSAN
/* Unpoison the memory for innodb_monitor_set_option;
it is operating also on the freed transaction objects.
We checked that these were initialized in
@@ -474,7 +470,6 @@ void trx_free(trx_t*& trx)
# endif
MEM_MAKE_DEFINED(&trx->state, sizeof trx->state);
MEM_MAKE_DEFINED(&trx->mysql_thd, sizeof trx->mysql_thd);
-#endif
trx = NULL;
}
diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc
index 0b74414a6ae..4555ab3a862 100644
--- a/storage/tokudb/ha_tokudb.cc
+++ b/storage/tokudb/ha_tokudb.cc
@@ -6123,6 +6123,11 @@ void ha_tokudb::position(const uchar * record) {
//
memcpy(ref, &key.size, sizeof(uint32_t));
}
+ /*
+ tokudb doesn't always write the last byte. Don't that cause problems with
+ MariaDB
+ */
+ MEM_MAKE_DEFINED(ref, ref_length);
TOKUDB_HANDLER_DBUG_VOID_RETURN;
}