summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-11-06 09:40:39 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2018-11-06 09:40:39 +0200
commitdf563e0c037f9b2cdb22e145575f92a121b4b529 (patch)
tree31d39796cebcef916eb7e0888537c18f946170ff /storage/innobase
parente058a251c10350f3727ca1df022dc5786933535b (diff)
parentbdfe2784d5b73a1fdcdacb3d9adcc9dc71af344b (diff)
downloadmariadb-git-df563e0c037f9b2cdb22e145575f92a121b4b529.tar.gz
Merge 10.2 into 10.3
main.derived_cond_pushdown: Move all 10.3 tests to the end, trim trailing white space, and add an "End of 10.3 tests" marker. Add --sorted_result to tests where the ordering is not deterministic. main.win_percentile: Add --sorted_result to tests where the ordering is no longer deterministic.
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/btr/btr0btr.cc6
-rw-r--r--storage/innobase/btr/btr0cur.cc2
-rw-r--r--storage/innobase/btr/btr0sea.cc2
-rw-r--r--storage/innobase/buf/buf0buf.cc57
-rw-r--r--storage/innobase/buf/buf0dblwr.cc2
-rw-r--r--storage/innobase/buf/buf0flu.cc4
-rw-r--r--storage/innobase/buf/buf0lru.cc3
-rw-r--r--storage/innobase/buf/buf0rea.cc10
-rw-r--r--storage/innobase/dict/dict0crea.cc15
-rw-r--r--storage/innobase/dict/dict0dict.cc8
-rw-r--r--storage/innobase/dict/dict0mem.cc4
-rw-r--r--storage/innobase/fil/fil0fil.cc27
-rw-r--r--storage/innobase/fsp/fsp0fsp.cc32
-rw-r--r--storage/innobase/fts/fts0fts.cc2
-rw-r--r--storage/innobase/fts/fts0que.cc2
-rw-r--r--storage/innobase/gis/gis0sea.cc5
-rw-r--r--storage/innobase/handler/ha_innodb.cc17
-rw-r--r--storage/innobase/handler/ha_innodb.h3
-rw-r--r--storage/innobase/handler/handler0alter.cc33
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.cc28
-rw-r--r--storage/innobase/include/btr0btr.h8
-rw-r--r--storage/innobase/include/btr0btr.ic4
-rw-r--r--storage/innobase/include/btr0cur.h2
-rw-r--r--storage/innobase/include/btr0sea.h2
-rw-r--r--storage/innobase/include/buf0buf.h114
-rw-r--r--storage/innobase/include/buf0buf.ic26
-rw-r--r--storage/innobase/include/buf0rea.h8
-rw-r--r--storage/innobase/include/fil0fil.h63
-rw-r--r--storage/innobase/include/fsp0fsp.h40
-rw-r--r--storage/innobase/include/fsp0fsp.ic2
-rw-r--r--storage/innobase/include/fts0fts.h2
-rw-r--r--storage/innobase/include/fts0types.h4
-rw-r--r--storage/innobase/include/ha_prototypes.h3
-rw-r--r--storage/innobase/include/ibuf0ibuf.h12
-rw-r--r--storage/innobase/include/ibuf0ibuf.ic2
-rw-r--r--storage/innobase/include/mtr0mtr.h28
-rw-r--r--storage/innobase/include/page0page.h2
-rw-r--r--storage/innobase/include/trx0rec.h3
-rw-r--r--storage/innobase/include/trx0sys.h4
-rw-r--r--storage/innobase/include/trx0undo.h4
-rw-r--r--storage/innobase/include/trx0undo.ic4
-rw-r--r--storage/innobase/include/univ.i2
-rw-r--r--storage/innobase/log/log0recv.cc5
-rw-r--r--storage/innobase/mtr/mtr0mtr.cc27
-rw-r--r--storage/innobase/page/page0page.cc2
-rw-r--r--storage/innobase/que/que0que.cc3
-rw-r--r--storage/innobase/row/row0import.cc5
-rw-r--r--storage/innobase/row/row0ins.cc63
-rw-r--r--storage/innobase/row/row0merge.cc20
-rw-r--r--storage/innobase/row/row0mysql.cc196
-rw-r--r--storage/innobase/row/row0row.cc4
-rw-r--r--storage/innobase/row/row0upd.cc2
-rw-r--r--storage/innobase/srv/srv0start.cc8
-rw-r--r--storage/innobase/trx/trx0purge.cc2
-rw-r--r--storage/innobase/trx/trx0rec.cc3
-rw-r--r--storage/innobase/trx/trx0trx.cc7
56 files changed, 401 insertions, 547 deletions
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index 31e9a4cad1c..6d0e44ce80d 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -1149,7 +1149,7 @@ btr_free_root_invalidate(
static MY_ATTRIBUTE((warn_unused_result))
buf_block_t*
btr_free_root_check(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
index_id_t index_id,
mtr_t* mtr)
@@ -1418,7 +1418,7 @@ top_loop:
@param[in,out] mtr mini-transaction */
void
btr_free_if_exists(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
index_id_t index_id,
mtr_t* mtr)
@@ -1442,7 +1442,7 @@ btr_free_if_exists(
@param[in] page_size page size */
void
btr_free(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size)
{
mtr_t mtr;
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index 27975abe0ab..e68ce65b09b 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -217,7 +217,7 @@ btr_rec_free_externally_stored_fields(
btr_latch_leaves_t
btr_cur_latch_leaves(
buf_block_t* block,
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
ulint latch_mode,
btr_cur_t* cursor,
diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc
index 0cb7611b433..aead20aa588 100644
--- a/storage/innobase/btr/btr0sea.cc
+++ b/storage/innobase/btr/btr0sea.cc
@@ -1273,7 +1273,7 @@ cleanup:
/** Drop possible adaptive hash index entries when a page is evicted
from the buffer pool or freed in a file, or the index is being dropped.
@param[in] page_id page id */
-void btr_search_drop_page_hash_when_freed(const page_id_t& page_id)
+void btr_search_drop_page_hash_when_freed(const page_id_t page_id)
{
buf_block_t* block;
mtr_t mtr;
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index bd64334c3ba..0b796d439d4 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -2323,7 +2323,8 @@ buf_page_realloc(
memset(block->frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, 0xff, 4);
UNIV_MEM_INVALID(block->frame, srv_page_size);
buf_block_set_state(block, BUF_BLOCK_REMOVE_HASH);
- block->page.id.reset();
+ block->page.id
+ = page_id_t(ULINT32_UNDEFINED, ULINT32_UNDEFINED);
/* Relocate buf_pool->flush_list. */
if (block->page.oldest_modification) {
@@ -3550,7 +3551,7 @@ hash_lock and reacquire it.
static
buf_page_t*
buf_pool_watch_set(
- const page_id_t& page_id,
+ const page_id_t page_id,
rw_lock_t** hash_lock)
{
buf_page_t* bpage;
@@ -3628,7 +3629,7 @@ page_found:
buf_block_t::mutex or buf_pool->zip_mutex or both. */
bpage->state = BUF_BLOCK_ZIP_PAGE;
- bpage->id.copy_from(page_id);
+ bpage->id = page_id;
bpage->buf_fix_count = 1;
ut_d(bpage->in_page_hash = TRUE);
@@ -3692,9 +3693,7 @@ buf_pool_watch_remove(
/** Stop watching if the page has been read in.
buf_pool_watch_set(same_page_id) must have returned NULL before.
@param[in] page_id page id */
-void
-buf_pool_watch_unset(
- const page_id_t& page_id)
+void buf_pool_watch_unset(const page_id_t page_id)
{
buf_page_t* bpage;
buf_pool_t* buf_pool = buf_pool_get(page_id);
@@ -3726,12 +3725,10 @@ buf_pool_watch_unset(
This may only be called after buf_pool_watch_set(same_page_id)
has returned NULL and before invoking buf_pool_watch_unset(same_page_id).
@param[in] page_id page id
-@return FALSE if the given page was not read in, TRUE if it was */
-ibool
-buf_pool_watch_occurred(
- const page_id_t& page_id)
+@return false if the given page was not read in, true if it was */
+bool buf_pool_watch_occurred(const page_id_t page_id)
{
- ibool ret;
+ bool ret;
buf_page_t* bpage;
buf_pool_t* buf_pool = buf_pool_get(page_id);
rw_lock_t* hash_lock = buf_page_hash_lock_get(buf_pool, page_id);
@@ -3801,9 +3798,7 @@ debug version to check that it is not accessed any more unless
reallocated.
@param[in] page_id page id
@return control block if found in page hash table, otherwise NULL */
-buf_page_t*
-buf_page_set_file_page_was_freed(
- const page_id_t& page_id)
+buf_page_t* buf_page_set_file_page_was_freed(const page_id_t page_id)
{
buf_page_t* bpage;
buf_pool_t* buf_pool = buf_pool_get(page_id);
@@ -3831,9 +3826,7 @@ debug version to check that it is not accessed any more unless
reallocated.
@param[in] page_id page id
@return control block if found in page hash table, otherwise NULL */
-buf_page_t*
-buf_page_reset_file_page_was_freed(
- const page_id_t& page_id)
+buf_page_t* buf_page_reset_file_page_was_freed(const page_id_t page_id)
{
buf_page_t* bpage;
buf_pool_t* buf_pool = buf_pool_get(page_id);
@@ -3855,12 +3848,8 @@ buf_page_reset_file_page_was_freed(
/** Attempts to discard the uncompressed frame of a compressed page.
The caller should not be holding any mutexes when this function is called.
-@param[in] page_id page id
-@return TRUE if successful, FALSE otherwise. */
-static
-void
-buf_block_try_discard_uncompressed(
- const page_id_t& page_id)
+@param[in] page_id page id */
+static void buf_block_try_discard_uncompressed(const page_id_t page_id)
{
buf_page_t* bpage;
buf_pool_t* buf_pool = buf_pool_get(page_id);
@@ -3894,7 +3883,7 @@ the same set of mutexes or latches.
@return pointer to the block */
buf_page_t*
buf_page_get_zip(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size)
{
buf_page_t* bpage;
@@ -4348,7 +4337,7 @@ BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH
@return pointer to the block or NULL */
buf_block_t*
buf_page_get_gen(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
ulint rw_latch,
buf_block_t* guess,
@@ -4425,7 +4414,7 @@ loop:
it may have been freed by buf_relocate(). */
if (!buf_block_is_uncompressed(buf_pool, block)
- || !page_id.equals_to(block->page.id)
+ || page_id != block->page.id
|| buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE) {
/* Our guess was bogus or things have changed
@@ -5257,7 +5246,7 @@ Suitable for using when holding the lock_sys_t::mutex.
@return pointer to a page or NULL */
buf_block_t*
buf_page_try_get_func(
- const page_id_t& page_id,
+ const page_id_t page_id,
const char* file,
unsigned line,
mtr_t* mtr)
@@ -5286,7 +5275,7 @@ buf_page_try_get_func(
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
- ut_a(page_id.equals_to(block->page.id));
+ ut_a(page_id == block->page.id);
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
buf_block_buf_fix_inc(block, file, line);
@@ -5370,7 +5359,7 @@ static
void
buf_page_init(
buf_pool_t* buf_pool,
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
buf_block_t* block)
{
@@ -5438,7 +5427,7 @@ buf_page_init(
ut_ad(!block->page.in_page_hash);
ut_d(block->page.in_page_hash = TRUE);
- block->page.id.copy_from(page_id);
+ block->page.id = page_id;
block->page.size.copy_from(page_size);
HASH_INSERT(buf_page_t, hash, buf_pool->page_hash,
@@ -5468,7 +5457,7 @@ buf_page_t*
buf_page_init_for_read(
dberr_t* err,
ulint mode,
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
bool unzip)
{
@@ -5637,7 +5626,7 @@ buf_page_init_for_read(
buf_page_init_low(bpage);
bpage->state = BUF_BLOCK_ZIP_PAGE;
- bpage->id.copy_from(page_id);
+ bpage->id = page_id;
bpage->flush_observer = NULL;
ut_d(bpage->in_page_hash = FALSE);
@@ -5706,7 +5695,7 @@ FILE_PAGE (the other is buf_page_get_gen).
@return pointer to the block, page bufferfixed */
buf_block_t*
buf_page_create(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
mtr_t* mtr)
{
@@ -7412,7 +7401,7 @@ buf_pool_check_no_pending_io(void)
std::ostream&
operator<<(
std::ostream& out,
- const page_id_t& page_id)
+ const page_id_t page_id)
{
out << "[page id: space=" << page_id.m_space
<< ", page number=" << page_id.m_page_no << "]";
diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc
index 043a5ffd426..50a925ab783 100644
--- a/storage/innobase/buf/buf0dblwr.cc
+++ b/storage/innobase/buf/buf0dblwr.cc
@@ -856,7 +856,7 @@ buf_dblwr_check_block(
but just happens to have wrongly set FIL_PAGE_TYPE,
such pages should never be modified to without also
adjusting the page type during page allocation or
- buf_flush_init_for_writing() or fil_page_reset_type(). */
+ buf_flush_init_for_writing() or fil_block_reset_type(). */
break;
case FIL_PAGE_TYPE_FSP_HDR:
case FIL_PAGE_IBUF_BITMAP:
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index f8ec51d00f0..a130c998e75 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -1298,7 +1298,7 @@ buf_flush_page_try(
static
bool
buf_flush_check_neighbor(
- const page_id_t& page_id,
+ const page_id_t page_id,
buf_flush_t flush_type)
{
buf_page_t* bpage;
@@ -1348,7 +1348,7 @@ buf_flush_check_neighbor(
static
ulint
buf_flush_try_neighbors(
- const page_id_t& page_id,
+ const page_id_t page_id,
buf_flush_t flush_type,
ulint n_flushed,
ulint n_to_flush)
diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc
index f9b2189c79a..a5ad0b91c85 100644
--- a/storage/innobase/buf/buf0lru.cc
+++ b/storage/innobase/buf/buf0lru.cc
@@ -2160,7 +2160,8 @@ buf_LRU_block_free_hashed_page(
buf_page_mutex_enter(block);
if (buf_pool->flush_rbt == NULL) {
- block->page.id.reset();
+ block->page.id
+ = page_id_t(ULINT32_UNDEFINED, ULINT32_UNDEFINED);
}
buf_block_set_state(block, BUF_BLOCK_MEMORY);
diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc
index 14d1d3d4706..26db9413559 100644
--- a/storage/innobase/buf/buf0rea.cc
+++ b/storage/innobase/buf/buf0rea.cc
@@ -117,7 +117,7 @@ buf_read_page_low(
bool sync,
ulint type,
ulint mode,
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
bool unzip,
bool ignore_missing_space = false)
@@ -239,7 +239,7 @@ pages, it may happen that the page at the given page number does not
get read even if we return a positive value! */
ulint
buf_read_ahead_random(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
ibool inside_ibuf)
{
@@ -419,7 +419,7 @@ after decryption normal page checksum does not match.
@retval DB_TABLESPACE_DELETED if tablespace .ibd file is missing */
dberr_t
buf_read_page(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size)
{
ulint count;
@@ -457,7 +457,7 @@ released by the i/o-handler thread.
@param[in] sync true if synchronous aio is desired */
void
buf_read_page_background(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
bool sync)
{
@@ -529,7 +529,7 @@ which could result in a deadlock if the OS does not support asynchronous io.
@return number of page read requests issued */
ulint
buf_read_ahead_linear(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
ibool inside_ibuf)
{
diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc
index 0a3729b62f2..f9fd3aa5464 100644
--- a/storage/innobase/dict/dict0crea.cc
+++ b/storage/innobase/dict/dict0crea.cc
@@ -1532,6 +1532,21 @@ dict_create_or_check_foreign_constraint_tables(void)
row_mysql_lock_data_dictionary(trx);
+ DBUG_EXECUTE_IF(
+ "create_and_drop_garbage",
+ err = que_eval_sql(
+ NULL,
+ "PROCEDURE CREATE_GARBAGE_TABLE_PROC () IS\n"
+ "BEGIN\n"
+ "CREATE TABLE\n"
+ "\"test/#sql-ib-garbage\"(ID CHAR);\n"
+ "CREATE UNIQUE CLUSTERED INDEX PRIMARY"
+ " ON \"test/#sql-ib-garbage\"(ID);\n"
+ "END;\n", FALSE, trx);
+ ut_ad(err == DB_SUCCESS);
+ row_drop_table_for_mysql("test/#sql-ib-garbage", trx,
+ SQLCOM_DROP_DB, true););
+
/* Check which incomplete table definition to drop. */
if (sys_foreign_err == DB_CORRUPTION) {
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 553463755f6..e61879d5b45 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2018, MariaDB Corporation.
@@ -3276,8 +3276,6 @@ dict_foreign_find_index(
while (index != NULL) {
if (types_idx != index
- && !(index->type & DICT_FTS)
- && !dict_index_is_spatial(index)
&& !index->to_be_dropped
&& !dict_index_is_online_ddl(index)
&& dict_foreign_qualify_index(
@@ -6770,6 +6768,10 @@ dict_foreign_qualify_index(
return(false);
}
+ if (index->type & (DICT_SPATIAL | DICT_FTS)) {
+ return false;
+ }
+
for (ulint i = 0; i < n_cols; i++) {
dict_field_t* field;
const char* col_name;
diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc
index e6c5050d949..3056f73f0cb 100644
--- a/storage/innobase/dict/dict0mem.cc
+++ b/storage/innobase/dict/dict0mem.cc
@@ -682,9 +682,7 @@ dict_mem_table_col_rename(
s += len + 1;
}
- /* This could fail if the data dictionaries are out of sync.
- Proceed with the renaming anyway. */
- ut_ad(!strcmp(from, s));
+ ut_ad(!my_strcasecmp(system_charset_info, from, s));
dict_mem_table_col_rename_low(table, static_cast<unsigned>(nth_col),
to, s, is_virtual);
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index e64c7040166..5ec11506bb7 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -292,7 +292,7 @@ i/o on a tablespace which does not exist */
UNIV_INLINE
dberr_t
fil_read(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
ulint byte_offset,
ulint len,
@@ -318,7 +318,7 @@ i/o on a tablespace which does not exist */
UNIV_INLINE
dberr_t
fil_write(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
ulint byte_offset,
ulint len,
@@ -4248,7 +4248,7 @@ dberr_t
fil_io(
const IORequest& type,
bool sync,
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
ulint byte_offset,
ulint len,
@@ -4844,27 +4844,6 @@ fil_page_set_type(
mach_write_to_2(page + FIL_PAGE_TYPE, type);
}
-/** Reset the page type.
-Data files created before MySQL 5.1 may contain garbage in FIL_PAGE_TYPE.
-In MySQL 3.23.53, only undo log pages and index pages were tagged.
-Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE.
-@param[in] page_id page number
-@param[in,out] page page with invalid FIL_PAGE_TYPE
-@param[in] type expected page type
-@param[in,out] mtr mini-transaction */
-void
-fil_page_reset_type(
- const page_id_t& page_id,
- byte* page,
- ulint type,
- mtr_t* mtr)
-{
- ib::info()
- << "Resetting invalid page " << page_id << " type "
- << fil_page_get_type(page) << " to " << type << ".";
- mlog_write_ulint(page + FIL_PAGE_TYPE, type, MLOG_2BYTES, mtr);
-}
-
/********************************************************************//**
Delete the tablespace file and any related files like .cfg.
This should not be called for temporary tables.
diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc
index 26502086d81..01d91d1dcde 100644
--- a/storage/innobase/fsp/fsp0fsp.cc
+++ b/storage/innobase/fsp/fsp0fsp.cc
@@ -963,6 +963,22 @@ fsp_get_pages_to_extend_ibd(
return(size_increase);
}
+/** Reset the page type.
+Data files created before MySQL 5.1.48 may contain garbage in FIL_PAGE_TYPE.
+In MySQL 3.23.53, only undo log pages and index pages were tagged.
+Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE.
+@param[in] block block with invalid FIL_PAGE_TYPE
+@param[in] type expected page type
+@param[in,out] mtr mini-transaction */
+ATTRIBUTE_COLD
+void fil_block_reset_type(const buf_block_t& block, ulint type, mtr_t* mtr)
+{
+ ib::info()
+ << "Resetting invalid page " << block.page.id << " type "
+ << fil_page_get_type(block.frame) << " to " << type << ".";
+ mlog_write_ulint(block.frame + FIL_PAGE_TYPE, type, MLOG_2BYTES, mtr);
+}
+
/** Put new extents to the free list if there are free extents above the free
limit. If an extent happens to contain an extent descriptor page, the extent
is put to the FSP_FREE_FRAG list with the page marked as used.
@@ -1098,7 +1114,7 @@ fsp_fill_free_list(
header, space, i, mtr, init_space, &desc_block);
if (desc_block != NULL) {
fil_block_check_type(
- desc_block, FIL_PAGE_TYPE_XDES, mtr);
+ *desc_block, FIL_PAGE_TYPE_XDES, mtr);
}
xdes_init(descr, mtr);
@@ -1157,7 +1173,7 @@ fsp_alloc_free_extent(
header, space, hint, mtr, false, &desc_block);
if (desc_block != NULL) {
- fil_block_check_type(desc_block, FIL_PAGE_TYPE_XDES, mtr);
+ fil_block_check_type(*desc_block, FIL_PAGE_TYPE_XDES, mtr);
}
if (descr && (xdes_get_state(descr, mtr) == XDES_FREE)) {
@@ -1699,7 +1715,7 @@ fsp_alloc_seg_inode(
block = buf_page_get(page_id, page_size, RW_SX_LATCH, mtr);
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
- fil_block_check_type(block, FIL_PAGE_INODE, mtr);
+ fil_block_check_type(*block, FIL_PAGE_INODE, mtr);
page = buf_block_get_frame(block);
@@ -2005,7 +2021,7 @@ fseg_create(
? FIL_PAGE_TYPE_TRX_SYS
: FIL_PAGE_TYPE_SYS;
- fil_block_check_type(block, type, mtr);
+ fil_block_check_type(*block, type, mtr);
}
if (!has_done_reservation
@@ -2570,7 +2586,7 @@ fseg_alloc_free_page_general(
const page_size_t page_size(space->flags);
inode = fseg_inode_get(seg_header, space_id, page_size, mtr, &iblock);
- fil_block_check_type(iblock, FIL_PAGE_INODE, mtr);
+ fil_block_check_type(*iblock, FIL_PAGE_INODE, mtr);
if (!has_done_reservation
&& !fsp_reserve_free_extents(&n_reserved, space, 2,
@@ -2990,7 +3006,7 @@ fseg_free_page_func(
seg_inode = fseg_inode_get(seg_header, space_id, page_size, mtr,
&iblock);
- fil_block_check_type(iblock, FIL_PAGE_INODE, mtr);
+ fil_block_check_type(*iblock, FIL_PAGE_INODE, mtr);
fseg_free_page_low(seg_inode, space, page, page_size, ahi, mtr);
@@ -3170,7 +3186,7 @@ fseg_free_step_func(
DBUG_RETURN(TRUE);
}
- fil_block_check_type(iblock, FIL_PAGE_INODE, mtr);
+ fil_block_check_type(*iblock, FIL_PAGE_INODE, mtr);
descr = fseg_get_first_extent(inode, space, page_size, mtr);
if (descr != NULL) {
@@ -3238,7 +3254,7 @@ fseg_free_step_not_header_func(
buf_block_t* iblock;
inode = fseg_inode_get(header, space_id, page_size, mtr, &iblock);
- fil_block_check_type(iblock, FIL_PAGE_INODE, mtr);
+ fil_block_check_type(*iblock, FIL_PAGE_INODE, mtr);
descr = fseg_get_first_extent(inode, space, page_size, mtr);
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index a558775a97a..6f0f4fda5a3 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -67,7 +67,7 @@ ulong fts_max_total_cache_size;
/** This is FTS result cache limit for each query and would be
a configurable variable */
-ulong fts_result_cache_limit;
+size_t fts_result_cache_limit;
/** Variable specifying the maximum FTS max token size */
ulong fts_max_token_size;
diff --git a/storage/innobase/fts/fts0que.cc b/storage/innobase/fts/fts0que.cc
index 5ae8e28974e..32e08c9c941 100644
--- a/storage/innobase/fts/fts0que.cc
+++ b/storage/innobase/fts/fts0que.cc
@@ -75,7 +75,7 @@ struct fts_query_t {
fts_table_t fts_index_table;/*!< FTS auxiliary index table def */
- ulint total_size; /*!< total memory size used by query */
+ size_t total_size; /*!< total memory size used by query */
fts_doc_ids_t* deleted; /*!< Deleted doc ids that need to be
filtered from the output */
diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc
index b137a768830..6fcc56170d0 100644
--- a/storage/innobase/gis/gis0sea.cc
+++ b/storage/innobase/gis/gis0sea.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2016, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
@@ -389,8 +389,7 @@ rtr_pcur_getnext_from_path(
if (mode != PAGE_CUR_RTREE_INSERT
&& mode != PAGE_CUR_RTREE_LOCATE
&& mode >= PAGE_CUR_CONTAIN
- && btr_cur->rtr_info->need_prdt_lock
- && found) {
+ && btr_cur->rtr_info->need_prdt_lock) {
lock_prdt_t prdt;
trx_t* trx = thr_get_trx(
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 20dc215ee7f..8c126a3b6a4 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -5823,7 +5823,8 @@ innobase_build_v_templ(
name = dict_table_get_v_col_name(ib_table, z);
}
- ut_ad(!ut_strcmp(name, field->field_name.str));
+ ut_ad(!my_strcasecmp(system_charset_info, name,
+ field->field_name.str));
#endif
const dict_v_col_t* vcol;
@@ -5854,12 +5855,10 @@ innobase_build_v_templ(
dict_col_t* col = dict_table_get_nth_col(
ib_table, j);
-#ifdef UNIV_DEBUG
- const char* name = dict_table_get_col_name(
- ib_table, j);
-
- ut_ad(!ut_strcmp(name, field->field_name.str));
-#endif
+ ut_ad(!my_strcasecmp(system_charset_info,
+ dict_table_get_col_name(
+ ib_table, j),
+ field->field_name.str));
s_templ->vtempl[j] = static_cast<
mysql_row_templ_t*>(
@@ -19367,10 +19366,10 @@ static MYSQL_SYSVAR_ULONG(ft_total_cache_size, fts_max_total_cache_size,
"Total memory allocated for InnoDB Fulltext Search cache",
NULL, NULL, 640000000, 32000000, 1600000000, 0);
-static MYSQL_SYSVAR_ULONG(ft_result_cache_limit, fts_result_cache_limit,
+static MYSQL_SYSVAR_SIZE_T(ft_result_cache_limit, fts_result_cache_limit,
PLUGIN_VAR_RQCMDARG,
"InnoDB Fulltext search query result cache limit in bytes",
- NULL, NULL, 2000000000L, 1000000L, 4294967295UL, 0);
+ NULL, NULL, 2000000000L, 1000000L, SIZE_T_MAX, 0);
static MYSQL_SYSVAR_ULONG(ft_min_token_size, fts_min_token_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index e65e7a57c99..a5f9b8c8d7b 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -420,9 +420,6 @@ public:
Item* idx_cond_push(uint keyno, Item* idx_cond);
/* @} */
- /* An helper function for index_cond_func_innodb: */
- bool is_thd_killed();
-
protected:
/**
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 482484d17d7..b9feb47bb57 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -1698,8 +1698,7 @@ innobase_find_fk_index(
index = dict_table_get_first_index(table);
while (index != NULL) {
- if (!(index->type & DICT_FTS)
- && dict_foreign_qualify_index(
+ if (dict_foreign_qualify_index(
table, col_names, columns, n_cols,
index, NULL, true, 0,
NULL, NULL, NULL)) {
@@ -7681,7 +7680,6 @@ innobase_rename_column_try(
pars_info_add_ull_literal(info, "tableid", user_table->id);
pars_info_add_int4_literal(info, "nth", nth_col);
- pars_info_add_str_literal(info, "old", from);
pars_info_add_str_literal(info, "new", to);
trx->op_info = "renaming column in SYS_COLUMNS";
@@ -7691,7 +7689,7 @@ innobase_rename_column_try(
"PROCEDURE RENAME_SYS_COLUMNS_PROC () IS\n"
"BEGIN\n"
"UPDATE SYS_COLUMNS SET NAME=:new\n"
- "WHERE TABLE_ID=:tableid AND NAME=:old\n"
+ "WHERE TABLE_ID=:tableid\n"
"AND POS=:nth;\n"
"END;\n",
FALSE, trx);
@@ -7715,8 +7713,10 @@ err_exit:
index = dict_table_get_next_index(index)) {
for (ulint i = 0; i < dict_index_get_n_fields(index); i++) {
- if (strcmp(dict_index_get_nth_field(index, i)->name,
- from)) {
+ if (my_strcasecmp(
+ system_charset_info,
+ dict_index_get_nth_field(index, i)->name,
+ from)) {
continue;
}
@@ -7724,7 +7724,6 @@ err_exit:
pars_info_add_ull_literal(info, "indexid", index->id);
pars_info_add_int4_literal(info, "nth", i);
- pars_info_add_str_literal(info, "old", from);
pars_info_add_str_literal(info, "new", to);
error = que_eval_sql(
@@ -7733,14 +7732,14 @@ err_exit:
"BEGIN\n"
"UPDATE SYS_FIELDS SET COL_NAME=:new\n"
- "WHERE INDEX_ID=:indexid AND COL_NAME=:old\n"
+ "WHERE INDEX_ID=:indexid\n"
"AND POS=:nth;\n"
/* Try again, in case there is a prefix_len
encoded in SYS_FIELDS.POS */
"UPDATE SYS_FIELDS SET COL_NAME=:new\n"
- "WHERE INDEX_ID=:indexid AND COL_NAME=:old\n"
+ "WHERE INDEX_ID=:indexid\n"
"AND POS>=65536*:nth AND POS<65536*(:nth+1);\n"
"END;\n",
@@ -7766,7 +7765,9 @@ rename_foreign:
foreign_modified = false;
for (unsigned i = 0; i < foreign->n_fields; i++) {
- if (strcmp(foreign->foreign_col_names[i], from)) {
+ if (my_strcasecmp(system_charset_info,
+ foreign->foreign_col_names[i],
+ from)) {
continue;
}
@@ -7774,7 +7775,6 @@ rename_foreign:
pars_info_add_str_literal(info, "id", foreign->id);
pars_info_add_int4_literal(info, "nth", i);
- pars_info_add_str_literal(info, "old", from);
pars_info_add_str_literal(info, "new", to);
error = que_eval_sql(
@@ -7783,8 +7783,7 @@ rename_foreign:
"BEGIN\n"
"UPDATE SYS_FOREIGN_COLS\n"
"SET FOR_COL_NAME=:new\n"
- "WHERE ID=:id AND POS=:nth\n"
- "AND FOR_COL_NAME=:old;\n"
+ "WHERE ID=:id AND POS=:nth;\n"
"END;\n",
FALSE, trx);
@@ -7808,7 +7807,9 @@ rename_foreign:
dict_foreign_t* foreign = *it;
for (unsigned i = 0; i < foreign->n_fields; i++) {
- if (strcmp(foreign->referenced_col_names[i], from)) {
+ if (my_strcasecmp(system_charset_info,
+ foreign->referenced_col_names[i],
+ from)) {
continue;
}
@@ -7816,7 +7817,6 @@ rename_foreign:
pars_info_add_str_literal(info, "id", foreign->id);
pars_info_add_int4_literal(info, "nth", i);
- pars_info_add_str_literal(info, "old", from);
pars_info_add_str_literal(info, "new", to);
error = que_eval_sql(
@@ -7825,8 +7825,7 @@ rename_foreign:
"BEGIN\n"
"UPDATE SYS_FOREIGN_COLS\n"
"SET REF_COL_NAME=:new\n"
- "WHERE ID=:id AND POS=:nth\n"
- "AND REF_COL_NAME=:old;\n"
+ "WHERE ID=:id AND POS=:nth;\n"
"END;\n",
FALSE, trx);
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc
index 30e66c1110a..b56807a0ca2 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.cc
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc
@@ -209,7 +209,7 @@ static ulint ibuf_counts[IBUF_COUNT_N_SPACES][IBUF_COUNT_N_PAGES];
UNIV_INLINE
void
ibuf_count_check(
- const page_id_t& page_id)
+ const page_id_t page_id)
{
if (page_id.space() < IBUF_COUNT_N_SPACES
&& page_id.page_no() < IBUF_COUNT_N_PAGES) {
@@ -417,9 +417,7 @@ ibuf_tree_root_get(
@param[in] page_id page id
@return number of entries in the insert buffer currently buffered for
this page */
-ulint
-ibuf_count_get(
- const page_id_t& page_id)
+ulint ibuf_count_get(const page_id_t page_id)
{
ibuf_count_check(page_id);
@@ -432,7 +430,7 @@ ibuf_count_get(
static
void
ibuf_count_set(
- const page_id_t& page_id,
+ const page_id_t page_id,
ulint val)
{
ibuf_count_check(page_id);
@@ -675,7 +673,7 @@ UNIV_INLINE
ulint
ibuf_bitmap_page_get_bits_low(
const page_t* page,
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
#ifdef UNIV_DEBUG
ulint latch_type,
@@ -724,7 +722,7 @@ static
void
ibuf_bitmap_page_set_bits(
page_t* page,
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
ulint bit,
ulint val,
@@ -775,7 +773,7 @@ ibuf_bitmap_page_set_bits(
UNIV_INLINE
const page_id_t
ibuf_bitmap_page_no_calc(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size)
{
ulint bitmap_page_no;
@@ -799,7 +797,7 @@ is x-latched */
static
page_t*
ibuf_bitmap_get_map_page_func(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
const char* file,
unsigned line,
@@ -1103,7 +1101,7 @@ ibuf_update_free_bits_for_two_pages_low(
UNIV_INLINE
ibool
ibuf_fixed_addr_page(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size)
{
return((page_id.space() == IBUF_SPACE_ID
@@ -1125,7 +1123,7 @@ in which case a new transaction is created.
@return TRUE if level 2 or level 3 page */
ibool
ibuf_page_low(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
#ifdef UNIV_DEBUG
ibool x_latch,
@@ -3347,7 +3345,7 @@ ibuf_insert_low(
const dtuple_t* entry,
ulint entry_size,
dict_index_t* index,
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
que_thr_t* thr)
{
@@ -3688,7 +3686,7 @@ ibuf_insert(
ibuf_op_t op,
const dtuple_t* entry,
dict_index_t* index,
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
que_thr_t* thr)
{
@@ -4418,7 +4416,7 @@ want to update a non-existent bitmap page */
void
ibuf_merge_or_delete_for_page(
buf_block_t* block,
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t* page_size,
ibool update_ibuf_bitmap)
{
@@ -4436,7 +4434,7 @@ ibuf_merge_or_delete_for_page(
ulint mops[IBUF_OP_COUNT];
ulint dops[IBUF_OP_COUNT];
- ut_ad(block == NULL || page_id.equals_to(block->page.id));
+ ut_ad(block == NULL || page_id == block->page.id);
ut_ad(block == NULL || buf_block_get_io_fix(block) == BUF_IO_READ);
if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE
diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h
index 54f13a17c4c..398b009f061 100644
--- a/storage/innobase/include/btr0btr.h
+++ b/storage/innobase/include/btr0btr.h
@@ -237,7 +237,7 @@ tree
UNIV_INLINE
buf_block_t*
btr_block_get_func(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
ulint mode,
const char* file,
@@ -278,7 +278,7 @@ UNIV_INLINE
page_t*
btr_page_get(
/*=========*/
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
ulint mode,
dict_index_t* index,
@@ -383,7 +383,7 @@ btr_create(
@param[in,out] mtr mini-transaction */
void
btr_free_if_exists(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
index_id_t index_id,
mtr_t* mtr);
@@ -393,7 +393,7 @@ btr_free_if_exists(
@param[in] page_size page size */
void
btr_free(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size);
/** Read the last used AUTO_INCREMENT value from PAGE_ROOT_AUTO_INC.
diff --git a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0btr.ic
index d24458beace..2669611a9e6 100644
--- a/storage/innobase/include/btr0btr.ic
+++ b/storage/innobase/include/btr0btr.ic
@@ -41,7 +41,7 @@ tree
UNIV_INLINE
buf_block_t*
btr_block_get_func(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
ulint mode,
const char* file,
@@ -107,7 +107,7 @@ UNIV_INLINE
page_t*
btr_page_get(
/*=========*/
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
ulint mode,
dict_index_t* index,
diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h
index f87370be70c..f8afa03ce3f 100644
--- a/storage/innobase/include/btr0cur.h
+++ b/storage/innobase/include/btr0cur.h
@@ -824,7 +824,7 @@ btr_rec_set_deleted_flag(
btr_latch_leaves_t
btr_cur_latch_leaves(
buf_block_t* block,
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
ulint latch_mode,
btr_cur_t* cursor,
diff --git a/storage/innobase/include/btr0sea.h b/storage/innobase/include/btr0sea.h
index 4aaf3fb835e..f0174a2610c 100644
--- a/storage/innobase/include/btr0sea.h
+++ b/storage/innobase/include/btr0sea.h
@@ -122,7 +122,7 @@ void btr_search_drop_page_hash_index(buf_block_t* block);
/** Drop possible adaptive hash index entries when a page is evicted
from the buffer pool or freed in a file, or the index is being dropped.
@param[in] page_id page id */
-void btr_search_drop_page_hash_when_freed(const page_id_t& page_id);
+void btr_search_drop_page_hash_when_freed(const page_id_t page_id);
/** Updates the page hash index when a single record is inserted on a page.
@param[in] cursor cursor which was positioned to the place to insert
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 33612f85ed6..8ca9ddd28fe 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -223,86 +223,46 @@ public:
@param[in] space tablespace id
@param[in] page_no page number */
page_id_t(ulint space, ulint page_no)
- :
- m_space(static_cast<ib_uint32_t>(space)),
- m_page_no(static_cast<ib_uint32_t>(page_no)),
- m_fold(ULINT_UNDEFINED)
+ : m_space(uint32_t(space)), m_page_no(uint32(page_no))
{
ut_ad(space <= 0xFFFFFFFFU);
ut_ad(page_no <= 0xFFFFFFFFU);
}
- /** Retrieve the tablespace id.
- @return tablespace id */
- inline ib_uint32_t space() const
+ bool operator==(const page_id_t& rhs) const
{
- return(m_space);
+ return m_space == rhs.m_space && m_page_no == rhs.m_page_no;
}
+ bool operator!=(const page_id_t& rhs) const { return !(*this == rhs); }
+
+ /** Retrieve the tablespace id.
+ @return tablespace id */
+ uint32_t space() const { return m_space; }
/** Retrieve the page number.
@return page number */
- inline ib_uint32_t page_no() const
- {
- return(m_page_no);
- }
+ uint32_t page_no() const { return m_page_no; }
/** Retrieve the fold value.
@return fold value */
- inline ulint fold() const
- {
- /* Initialize m_fold if it has not been initialized yet. */
- if (m_fold == ULINT_UNDEFINED) {
- m_fold = (m_space << 20) + m_space + m_page_no;
- ut_ad(m_fold != ULINT_UNDEFINED);
- }
-
- return(m_fold);
- }
-
- /** Copy the values from a given page_id_t object.
- @param[in] src page id object whose values to fetch */
- inline void copy_from(const page_id_t& src)
- {
- m_space = src.space();
- m_page_no = src.page_no();
- m_fold = src.fold();
- }
-
- /** Reset the object. */
- void reset() { m_space= ~0U; m_page_no= ~0U; m_fold= ULINT_UNDEFINED; }
+ ulint fold() const { return (m_space << 20) + m_space + m_page_no; }
/** Reset the page number only.
@param[in] page_no page number */
inline void set_page_no(ulint page_no)
{
- m_page_no = static_cast<ib_uint32_t>(page_no);
- m_fold = ULINT_UNDEFINED;
+ m_page_no = uint32_t(page_no);
ut_ad(page_no <= 0xFFFFFFFFU);
}
- /** Check if a given page_id_t object is equal to the current one.
- @param[in] a page_id_t object to compare
- @return true if equal */
- inline bool equals_to(const page_id_t& a) const
- {
- return(a.space() == m_space && a.page_no() == m_page_no);
- }
-
private:
/** Tablespace id. */
- ib_uint32_t m_space;
+ uint32_t m_space;
/** Page number. */
- ib_uint32_t m_page_no;
-
- /** A fold value derived from m_space and m_page_no,
- used in hashing. */
- mutable ulint m_fold;
-
- /* Disable implicit copying. */
- void operator=(const page_id_t&);
+ uint32_t m_page_no;
/** Declare the overloaded global operator<< as a friend of this
class. Refer to the global declaration for further details. Print
@@ -314,7 +274,7 @@ private:
std::ostream&
operator<<(
std::ostream& out,
- const page_id_t& page_id);
+ const page_id_t page_id);
};
/** Print the given page_id_t object.
@@ -324,7 +284,7 @@ private:
std::ostream&
operator<<(
std::ostream& out,
- const page_id_t& page_id);
+ const page_id_t page_id);
#ifndef UNIV_INNOCHECKSUM
/********************************************************************//**
@@ -507,7 +467,7 @@ Suitable for using when holding the lock_sys_t::mutex.
@return pointer to a page or NULL */
buf_block_t*
buf_page_try_get_func(
- const page_id_t& page_id,
+ const page_id_t page_id,
const char* file,
unsigned line,
mtr_t* mtr);
@@ -533,7 +493,7 @@ the same set of mutexes or latches.
@return pointer to the block */
buf_page_t*
buf_page_get_zip(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size);
/** This is the general function used to get access to a database page.
@@ -549,7 +509,7 @@ BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH
@return pointer to the block or NULL */
buf_block_t*
buf_page_get_gen(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
ulint rw_latch,
buf_block_t* guess,
@@ -569,7 +529,7 @@ FILE_PAGE (the other is buf_page_get_gen).
@return pointer to the block, page bufferfixed */
buf_block_t*
buf_page_create(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
mtr_t* mtr);
@@ -603,10 +563,7 @@ NOTE that it is possible that the page is not yet read from disk,
though.
@param[in] page_id page id
@return TRUE if found in the page hash table */
-UNIV_INLINE
-ibool
-buf_page_peek(
- const page_id_t& page_id);
+inline bool buf_page_peek(const page_id_t page_id);
#ifdef UNIV_DEBUG
@@ -616,9 +573,7 @@ debug version to check that it is not accessed any more unless
reallocated.
@param[in] page_id page id
@return control block if found in page hash table, otherwise NULL */
-buf_page_t*
-buf_page_set_file_page_was_freed(
- const page_id_t& page_id);
+buf_page_t* buf_page_set_file_page_was_freed(const page_id_t page_id);
/** Sets file_page_was_freed FALSE if the page is found in the buffer pool.
This function should be called when we free a file page and want the
@@ -626,9 +581,7 @@ debug version to check that it is not accessed any more unless
reallocated.
@param[in] page_id page id
@return control block if found in page hash table, otherwise NULL */
-buf_page_t*
-buf_page_reset_file_page_was_freed(
- const page_id_t& page_id);
+buf_page_t* buf_page_reset_file_page_was_freed(const page_id_t page_id);
#endif /* UNIV_DEBUG */
/********************************************************************//**
@@ -1076,7 +1029,7 @@ UNIV_INLINE
void
buf_block_set_file_page(
buf_block_t* block,
- const page_id_t& page_id);
+ const page_id_t page_id);
/*********************************************************************//**
Gets the io_fix state of a block.
@@ -1257,7 +1210,7 @@ buf_page_t*
buf_page_init_for_read(
dberr_t* err,
ulint mode,
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
bool unzip);
@@ -1305,10 +1258,7 @@ buf_pool_from_block(
/** Returns the buffer pool instance given a page id.
@param[in] page_id page id
@return buffer pool */
-UNIV_INLINE
-buf_pool_t*
-buf_pool_get(
- const page_id_t& page_id);
+inline buf_pool_t* buf_pool_get(const page_id_t page_id);
/******************************************************************//**
Returns the buffer pool instance given its array index
@@ -1328,7 +1278,7 @@ UNIV_INLINE
buf_page_t*
buf_page_hash_get_low(
buf_pool_t* buf_pool,
- const page_id_t& page_id);
+ const page_id_t page_id);
/** Returns the control block of a file page, NULL if not found.
If the block is found and lock is not NULL then the appropriate
@@ -1350,7 +1300,7 @@ UNIV_INLINE
buf_page_t*
buf_page_hash_get_locked(
buf_pool_t* buf_pool,
- const page_id_t& page_id,
+ const page_id_t page_id,
rw_lock_t** lock,
ulint lock_mode,
bool watch = false);
@@ -1373,7 +1323,7 @@ UNIV_INLINE
buf_block_t*
buf_block_hash_get_locked(
buf_pool_t* buf_pool,
- const page_id_t& page_id,
+ const page_id_t page_id,
rw_lock_t** lock,
ulint lock_mode);
@@ -1413,18 +1363,14 @@ buf_pool_watch_is_sentinel(
/** Stop watching if the page has been read in.
buf_pool_watch_set(space,offset) must have returned NULL before.
@param[in] page_id page id */
-void
-buf_pool_watch_unset(
- const page_id_t& page_id);
+void buf_pool_watch_unset(const page_id_t page_id);
/** Check if the page has been read in.
This may only be called after buf_pool_watch_set(space,offset)
has returned NULL and before invoking buf_pool_watch_unset(space,offset).
@param[in] page_id page id
@return FALSE if the given page was not read in, TRUE if it was */
-ibool
-buf_pool_watch_occurred(
- const page_id_t& page_id)
+bool buf_pool_watch_occurred(const page_id_t page_id)
MY_ATTRIBUTE((warn_unused_result));
/********************************************************************//**
diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
index 8314797e78d..7ca08449c8c 100644
--- a/storage/innobase/include/buf0buf.ic
+++ b/storage/innobase/include/buf0buf.ic
@@ -463,10 +463,10 @@ UNIV_INLINE
void
buf_block_set_file_page(
buf_block_t* block,
- const page_id_t& page_id)
+ const page_id_t page_id)
{
buf_block_set_state(block, BUF_BLOCK_FILE_PAGE);
- block->page.id.copy_from(page_id);
+ block->page.id = page_id;
}
/*********************************************************************//**
@@ -1043,10 +1043,7 @@ buf_block_buf_fix_dec(
/** Returns the buffer pool instance given a page id.
@param[in] page_id page id
@return buffer pool */
-UNIV_INLINE
-buf_pool_t*
-buf_pool_get(
- const page_id_t& page_id)
+inline buf_pool_t* buf_pool_get(const page_id_t page_id)
{
/* 2log of BUF_READ_AHEAD_AREA (64) */
ulint ignored_page_no = page_id.page_no() >> 6;
@@ -1081,7 +1078,7 @@ UNIV_INLINE
buf_page_t*
buf_page_hash_get_low(
buf_pool_t* buf_pool,
- const page_id_t& page_id)
+ const page_id_t page_id)
{
buf_page_t* bpage;
@@ -1099,7 +1096,7 @@ buf_page_hash_get_low(
bpage,
ut_ad(bpage->in_page_hash && !bpage->in_zip_hash
&& buf_page_in_file(bpage)),
- page_id.equals_to(bpage->id));
+ page_id == bpage->id);
if (bpage) {
ut_a(buf_page_in_file(bpage));
ut_ad(bpage->in_page_hash);
@@ -1130,7 +1127,7 @@ UNIV_INLINE
buf_page_t*
buf_page_hash_get_locked(
buf_pool_t* buf_pool,
- const page_id_t& page_id,
+ const page_id_t page_id,
rw_lock_t** lock,
ulint lock_mode,
bool watch)
@@ -1174,7 +1171,7 @@ buf_page_hash_get_locked(
}
ut_ad(buf_page_in_file(bpage));
- ut_ad(page_id.equals_to(bpage->id));
+ ut_ad(page_id == bpage->id);
if (lock == NULL) {
/* The caller wants us to release the page_hash lock */
@@ -1213,7 +1210,7 @@ UNIV_INLINE
buf_block_t*
buf_block_hash_get_locked(
buf_pool_t* buf_pool,
- const page_id_t& page_id,
+ const page_id_t page_id,
rw_lock_t** lock,
ulint lock_mode)
{
@@ -1253,11 +1250,8 @@ buf_block_hash_get_locked(
NOTE that it is possible that the page is not yet read from disk,
though.
@param[in] page_id page id
-@return TRUE if found in the page hash table */
-UNIV_INLINE
-ibool
-buf_page_peek(
- const page_id_t& page_id)
+@return true if found in the page hash table */
+inline bool buf_page_peek(const page_id_t page_id)
{
buf_pool_t* buf_pool = buf_pool_get(page_id);
diff --git a/storage/innobase/include/buf0rea.h b/storage/innobase/include/buf0rea.h
index 5c766b9412a..a7c43e01467 100644
--- a/storage/innobase/include/buf0rea.h
+++ b/storage/innobase/include/buf0rea.h
@@ -44,7 +44,7 @@ after decryption normal page checksum does not match.
@retval DB_TABLESPACE_DELETED if tablespace .ibd file is missing */
dberr_t
buf_read_page(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size);
/********************************************************************//**
@@ -57,7 +57,7 @@ released by the i/o-handler thread.
@param[in] sync true if synchronous aio is desired */
void
buf_read_page_background(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
bool sync);
@@ -79,7 +79,7 @@ pages, it may happen that the page at the given page number does not
get read even if we return a positive value! */
ulint
buf_read_ahead_random(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
ibool inside_ibuf);
@@ -111,7 +111,7 @@ which could result in a deadlock if the OS does not support asynchronous io.
@return number of page read requests issued */
ulint
buf_read_ahead_linear(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
ibool inside_ibuf);
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index d0dc02e6208..4d5952a8123 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -38,8 +38,8 @@ Created 10/25/1995 Heikki Tuuri
// Forward declaration
extern my_bool srv_use_doublewrite_buf;
extern struct buf_dblwr_t* buf_dblwr;
-struct trx_t;
class page_id_t;
+struct trx_t;
class truncate_t;
/** Structure containing encryption specification */
@@ -1092,7 +1092,7 @@ dberr_t
fil_io(
const IORequest& type,
bool sync,
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
ulint byte_offset,
ulint len,
@@ -1163,65 +1163,6 @@ fil_page_set_type(
/*==============*/
byte* page, /*!< in/out: file page */
ulint type); /*!< in: type */
-/** Reset the page type.
-Data files created before MySQL 5.1 may contain garbage in FIL_PAGE_TYPE.
-In MySQL 3.23.53, only undo log pages and index pages were tagged.
-Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE.
-@param[in] page_id page number
-@param[in,out] page page with invalid FIL_PAGE_TYPE
-@param[in] type expected page type
-@param[in,out] mtr mini-transaction */
-void
-fil_page_reset_type(
- const page_id_t& page_id,
- byte* page,
- ulint type,
- mtr_t* mtr);
-
-/** Get the file page type.
-@param[in] page file page
-@return page type */
-inline
-uint16_t
-fil_page_get_type(const byte* page)
-{
- return(mach_read_from_2(page + FIL_PAGE_TYPE));
-}
-
-/** Check (and if needed, reset) the page type.
-Data files created before MySQL 5.1 may contain
-garbage in the FIL_PAGE_TYPE field.
-In MySQL 3.23.53, only undo log pages and index pages were tagged.
-Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE.
-@param[in] page_id page number
-@param[in,out] page page with possibly invalid FIL_PAGE_TYPE
-@param[in] type expected page type
-@param[in,out] mtr mini-transaction */
-inline
-void
-fil_page_check_type(
- const page_id_t& page_id,
- byte* page,
- ulint type,
- mtr_t* mtr)
-{
- ulint page_type = fil_page_get_type(page);
-
- if (page_type != type) {
- fil_page_reset_type(page_id, page, type, mtr);
- }
-}
-
-/** Check (and if needed, reset) the page type.
-Data files created before MySQL 5.1 may contain
-garbage in the FIL_PAGE_TYPE field.
-In MySQL 3.23.53, only undo log pages and index pages were tagged.
-Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE.
-@param[in,out] block block with possibly invalid FIL_PAGE_TYPE
-@param[in] type expected page type
-@param[in,out] mtr mini-transaction */
-#define fil_block_check_type(block, type, mtr) \
- fil_page_check_type(block->page.id, block->frame, type, mtr)
/********************************************************************//**
Delete the tablespace file and any related files like .cfg.
diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h
index 3222f1c761a..33dce63d5e1 100644
--- a/storage/innobase/include/fsp0fsp.h
+++ b/storage/innobase/include/fsp0fsp.h
@@ -583,6 +583,44 @@ fseg_free_step_not_header_func(
fseg_free_step_not_header_func(header, mtr)
#endif /* BTR_CUR_HASH_ADAPT */
+/** Reset the page type.
+Data files created before MySQL 5.1.48 may contain garbage in FIL_PAGE_TYPE.
+In MySQL 3.23.53, only undo log pages and index pages were tagged.
+Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE.
+@param[in] block block with invalid FIL_PAGE_TYPE
+@param[in] type expected page type
+@param[in,out] mtr mini-transaction */
+ATTRIBUTE_COLD
+void fil_block_reset_type(const buf_block_t& block, ulint type, mtr_t* mtr);
+
+/** Get the file page type.
+@param[in] page file page
+@return page type */
+inline uint16_t fil_page_get_type(const byte* page)
+{
+ return mach_read_from_2(page + FIL_PAGE_TYPE);
+}
+
+/** Check (and if needed, reset) the page type.
+Data files created before MySQL 5.1.48 may contain
+garbage in the FIL_PAGE_TYPE field.
+In MySQL 3.23.53, only undo log pages and index pages were tagged.
+Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE.
+@param[in] page_id page number
+@param[in,out] page page with possibly invalid FIL_PAGE_TYPE
+@param[in] type expected page type
+@param[in,out] mtr mini-transaction */
+inline void
+fil_block_check_type(
+ const buf_block_t& block,
+ ulint type,
+ mtr_t* mtr)
+{
+ if (UNIV_UNLIKELY(type != fil_page_get_type(block.frame))) {
+ fil_block_reset_type(block, type, mtr);
+ }
+}
+
/** Checks if a page address is an extent descriptor page address.
@param[in] page_id page id
@param[in] page_size page size
@@ -590,7 +628,7 @@ fseg_free_step_not_header_func(
UNIV_INLINE
ibool
fsp_descr_page(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size);
/***********************************************************//**
diff --git a/storage/innobase/include/fsp0fsp.ic b/storage/innobase/include/fsp0fsp.ic
index 38d890fd2f3..3258704615a 100644
--- a/storage/innobase/include/fsp0fsp.ic
+++ b/storage/innobase/include/fsp0fsp.ic
@@ -33,7 +33,7 @@ Created 12/18/1995 Heikki Tuuri
UNIV_INLINE
ibool
fsp_descr_page(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size)
{
return((page_id.page_no() & (page_size.physical() - 1))
diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h
index 068720c1947..9a4805e6eba 100644
--- a/storage/innobase/include/fts0fts.h
+++ b/storage/innobase/include/fts0fts.h
@@ -394,7 +394,7 @@ extern ulong fts_max_cache_size;
extern ulong fts_max_total_cache_size;
/** Variable specifying the FTS result cache limit for each query */
-extern ulong fts_result_cache_limit;
+extern size_t fts_result_cache_limit;
/** Variable specifying the maximum FTS max token size */
extern ulong fts_max_token_size;
diff --git a/storage/innobase/include/fts0types.h b/storage/innobase/include/fts0types.h
index 55a698e8b66..0bcb8d5a1d3 100644
--- a/storage/innobase/include/fts0types.h
+++ b/storage/innobase/include/fts0types.h
@@ -163,7 +163,7 @@ struct fts_cache_t {
the document from the table. Each
element is of type fts_doc_t */
- ulint total_size; /*!< total size consumed by the ilist
+ size_t total_size; /*!< total size consumed by the ilist
field of all nodes. SYNC is run
whenever this gets too big */
fts_sync_t* sync; /*!< sync structure to sync data to
@@ -245,7 +245,7 @@ struct fts_fetch_t {
fts_sql_callback
read_record; /*!< Callback for reading index
record */
- ulint total_memory; /*!< Total memory used */
+ size_t total_memory; /*!< Total memory used */
};
/** For horizontally splitting an FTS auxiliary index */
diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h
index 1313705f119..15107a93807 100644
--- a/storage/innobase/include/ha_prototypes.h
+++ b/storage/innobase/include/ha_prototypes.h
@@ -120,6 +120,9 @@ thd_is_replication_slave_thread(
/*============================*/
THD* thd); /*!< in: thread handle */
+/** @return whether statement-based replication is active */
+extern "C" int thd_rpl_stmt_based(const THD* thd);
+
/******************************************************************//**
Returns true if the transaction this thread is processing has edited
non-transactional tables. Used by the deadlock detector when deciding
diff --git a/storage/innobase/include/ibuf0ibuf.h b/storage/innobase/include/ibuf0ibuf.h
index 8233a536abc..95a302b1439 100644
--- a/storage/innobase/include/ibuf0ibuf.h
+++ b/storage/innobase/include/ibuf0ibuf.h
@@ -248,7 +248,7 @@ ibuf_inside(
UNIV_INLINE
ibool
ibuf_bitmap_page(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size);
/** Checks if a page is a level 2 or 3 page in the ibuf hierarchy of pages.
@@ -265,7 +265,7 @@ in which case a new transaction is created.
@return TRUE if level 2 or level 3 page */
ibool
ibuf_page_low(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
#ifdef UNIV_DEBUG
ibool x_latch,
@@ -321,7 +321,7 @@ ibuf_insert(
ibuf_op_t op,
const dtuple_t* entry,
dict_index_t* index,
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size,
que_thr_t* thr);
@@ -340,7 +340,7 @@ want to update a non-existent bitmap page */
void
ibuf_merge_or_delete_for_page(
buf_block_t* block,
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t* page_size,
ibool update_ibuf_bitmap);
@@ -388,9 +388,7 @@ ibuf_parse_bitmap_init(
@param[in] page_id page id
@return number of entries in the insert buffer currently buffered for
this page */
-ulint
-ibuf_count_get(
- const page_id_t& page_id);
+ulint ibuf_count_get(const page_id_t page_id);
#endif
/******************************************************************//**
Looks if the insert buffer is empty.
diff --git a/storage/innobase/include/ibuf0ibuf.ic b/storage/innobase/include/ibuf0ibuf.ic
index 355fad62f24..f6ff6f2a7fd 100644
--- a/storage/innobase/include/ibuf0ibuf.ic
+++ b/storage/innobase/include/ibuf0ibuf.ic
@@ -156,7 +156,7 @@ ibuf_inside(
UNIV_INLINE
ibool
ibuf_bitmap_page(
- const page_id_t& page_id,
+ const page_id_t page_id,
const page_size_t& page_size)
{
return((page_id.page_no() & (page_size.physical() - 1))
diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h
index 0c157cb87cf..c1281af2b30 100644
--- a/storage/innobase/include/mtr0mtr.h
+++ b/storage/innobase/include/mtr0mtr.h
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2017, MariaDB Corporation
+Copyright (c) 2013, 2018, 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
@@ -35,12 +35,6 @@ Created 11/26/1995 Heikki Tuuri
/** Start a mini-transaction. */
#define mtr_start(m) (m)->start()
-/** Start a synchronous mini-transaction */
-#define mtr_start_sync(m) (m)->start(true)
-
-/** Start an asynchronous read-only mini-transaction */
-#define mtr_start_ro(m) (m)->start(true, true)
-
/** Commit a mini-transaction. */
#define mtr_commit(m) (m)->commit()
@@ -198,21 +192,8 @@ struct mtr_t {
~mtr_t() { }
- /** Start a mini-transaction.
- @param sync true if it is a synchronous mini-transaction */
- void start(bool sync = true);
-
- /** @return whether this is an asynchronous mini-transaction. */
- bool is_async() const
- {
- return(!m_sync);
- }
-
- /** Request a future commit to be synchronous. */
- void set_sync()
- {
- m_sync = true;
- }
+ /** Start a mini-transaction. */
+ void start();
/** Commit the mini-transaction. */
void commit();
@@ -558,9 +539,6 @@ private:
/** LSN at commit time */
volatile lsn_t m_commit_lsn;
-
- /** true if it is synchronous mini-transaction */
- bool m_sync;
};
#include "mtr0mtr.ic"
diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h
index db48fef9e69..a46184b5982 100644
--- a/storage/innobase/include/page0page.h
+++ b/storage/innobase/include/page0page.h
@@ -1362,7 +1362,7 @@ void
page_warn_strict_checksum(
srv_checksum_algorithm_t curr_algo,
srv_checksum_algorithm_t page_checksum,
- const page_id_t& page_id);
+ const page_id_t page_id);
#ifdef UNIV_MATERIALIZE
#undef UNIV_INLINE
diff --git a/storage/innobase/include/trx0rec.h b/storage/innobase/include/trx0rec.h
index 563d31e1a25..776757b32ec 100644
--- a/storage/innobase/include/trx0rec.h
+++ b/storage/innobase/include/trx0rec.h
@@ -167,8 +167,7 @@ trx_undo_rec_get_partial_row(
@param[in,out] trx transaction
@param[in] table table that is being renamed
@return DB_SUCCESS or error code */
-dberr_t
-trx_undo_report_rename(trx_t* trx, const dict_table_t* table)
+dberr_t trx_undo_report_rename(trx_t* trx, const dict_table_t* table)
MY_ATTRIBUTE((nonnull, warn_unused_result));
/***********************************************************************//**
Writes information to an undo log about an insert, update, or a delete marking
diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h
index 6af212d35ff..f7e6d01c9bc 100644
--- a/storage/innobase/include/trx0sys.h
+++ b/storage/innobase/include/trx0sys.h
@@ -49,9 +49,7 @@ typedef UT_LIST_BASE_NODE_T(trx_t) trx_ut_list_t;
/** Checks if a page address is the trx sys header page.
@param[in] page_id page id
@return true if trx sys header page */
-inline
-bool
-trx_sys_hdr_page(const page_id_t& page_id)
+inline bool trx_sys_hdr_page(const page_id_t& page_id)
{
return(page_id.space() == TRX_SYS_SPACE
&& page_id.page_no() == TRX_SYS_PAGE_NO);
diff --git a/storage/innobase/include/trx0undo.h b/storage/innobase/include/trx0undo.h
index ada78615f15..60b0517db0d 100644
--- a/storage/innobase/include/trx0undo.h
+++ b/storage/innobase/include/trx0undo.h
@@ -107,7 +107,7 @@ trx_read_roll_ptr(
@return pointer to page x-latched */
UNIV_INLINE
page_t*
-trx_undo_page_get(const page_id_t& page_id, mtr_t* mtr);
+trx_undo_page_get(const page_id_t page_id, mtr_t* mtr);
/** Gets an undo log page and s-latches it.
@param[in] page_id page id
@@ -115,7 +115,7 @@ trx_undo_page_get(const page_id_t& page_id, mtr_t* mtr);
@return pointer to page s-latched */
UNIV_INLINE
page_t*
-trx_undo_page_get_s_latched(const page_id_t& page_id, mtr_t* mtr);
+trx_undo_page_get_s_latched(const page_id_t page_id, mtr_t* mtr);
/******************************************************************//**
Returns the next undo log record on the page in the specified log, or
diff --git a/storage/innobase/include/trx0undo.ic b/storage/innobase/include/trx0undo.ic
index 630638f6b7b..ac8af61be09 100644
--- a/storage/innobase/include/trx0undo.ic
+++ b/storage/innobase/include/trx0undo.ic
@@ -140,7 +140,7 @@ trx_read_roll_ptr(
@return pointer to page x-latched */
UNIV_INLINE
page_t*
-trx_undo_page_get(const page_id_t& page_id, mtr_t* mtr)
+trx_undo_page_get(const page_id_t page_id, mtr_t* mtr)
{
buf_block_t* block = buf_page_get(page_id, univ_page_size,
RW_X_LATCH, mtr);
@@ -156,7 +156,7 @@ trx_undo_page_get(const page_id_t& page_id, mtr_t* mtr)
@return pointer to page s-latched */
UNIV_INLINE
page_t*
-trx_undo_page_get_s_latched(const page_id_t& page_id, mtr_t* mtr)
+trx_undo_page_get_s_latched(const page_id_t page_id, mtr_t* mtr)
{
buf_block_t* block = buf_page_get(page_id, univ_page_size,
RW_S_LATCH, mtr);
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index f815463d2e8..a3b50950393 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -41,7 +41,7 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 5
#define INNODB_VERSION_MINOR 7
-#define INNODB_VERSION_BUGFIX 23
+#define INNODB_VERSION_BUGFIX 24
/* The following is the InnoDB version as shown in
SELECT plugin_version FROM information_schema.plugins;
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 7e7de801521..b243b012b76 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -2078,10 +2078,7 @@ recv_recover_page(bool just_read_in, buf_block_t* block)
page number.
@param[in] page_id page id
@return number of pages found */
-static
-ulint
-recv_read_in_area(
- const page_id_t& page_id)
+static ulint recv_read_in_area(const page_id_t page_id)
{
recv_addr_t* recv_addr;
ulint page_nos[RECV_READ_AHEAD_AREA];
diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc
index 215bfbaf42c..c51b0eb1359 100644
--- a/storage/innobase/mtr/mtr0mtr.cc
+++ b/storage/innobase/mtr/mtr0mtr.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2018, 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
@@ -383,18 +383,8 @@ public:
/** Constructor.
Takes ownership of the mtr->m_impl, is responsible for deleting it.
@param[in,out] mtr mini-transaction */
- explicit Command(mtr_t* mtr)
- :
- m_locks_released()
- {
- init(mtr);
- }
-
- void init(mtr_t* mtr)
- {
- m_impl = &mtr->m_impl;
- m_sync = mtr->m_sync;
- }
+ explicit Command(mtr_t* mtr) : m_impl(&mtr->m_impl), m_locks_released()
+ {}
/** Destructor */
~Command()
@@ -427,9 +417,6 @@ private:
@return number of bytes to write in finish_write() */
ulint prepare_write();
- /** true if it is a sync mini-transaction. */
- bool m_sync;
-
/** The mini-transaction state. */
mtr_t::Impl* m_impl;
@@ -488,17 +475,13 @@ mtr_write_log(
log_close();
}
-/** Start a mini-transaction.
-@param sync true if it is a synchronous mini-transaction */
-void
-mtr_t::start(bool sync)
+/** Start a mini-transaction. */
+void mtr_t::start()
{
UNIV_MEM_INVALID(this, sizeof(*this));
UNIV_MEM_INVALID(&m_impl, sizeof(m_impl));
- m_sync = sync;
-
m_commit_lsn = 0;
new(&m_impl.m_log) mtr_buf_t();
diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc
index fdab4bfcedd..ba4e98b1615 100644
--- a/storage/innobase/page/page0page.cc
+++ b/storage/innobase/page/page0page.cc
@@ -2846,7 +2846,7 @@ void
page_warn_strict_checksum(
srv_checksum_algorithm_t curr_algo,
srv_checksum_algorithm_t page_checksum,
- const page_id_t& page_id)
+ const page_id_t page_id)
{
srv_checksum_algorithm_t curr_algo_nonstrict;
switch (curr_algo) {
diff --git a/storage/innobase/que/que0que.cc b/storage/innobase/que/que0que.cc
index 947b281e4b9..ebcd7bd450e 100644
--- a/storage/innobase/que/que0que.cc
+++ b/storage/innobase/que/que0que.cc
@@ -689,7 +689,8 @@ que_thr_stop(
trx->lock.wait_thr = thr;
thr->state = QUE_THR_LOCK_WAIT;
- } else if (trx->duplicates && trx->error_state == DB_DUPLICATE_KEY) {
+ } else if (trx->duplicates && trx->error_state == DB_DUPLICATE_KEY
+ && thd_rpl_stmt_based(trx->mysql_thd)) {
return(FALSE);
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index d402f6ee67e..b63f934aa8b 100644
--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -3654,7 +3654,7 @@ fil_tablespace_iterate(
buf_block_t* block = reinterpret_cast<buf_block_t*>
(ut_zalloc_nokey(sizeof *block));
block->frame = page;
- block->page.id.copy_from(page_id_t(0, 0));
+ block->page.id = page_id_t(0, 0);
block->page.io_fix = BUF_IO_NONE;
block->page.buf_fix_count = 1;
block->page.state = BUF_BLOCK_FILE_PAGE;
@@ -3672,8 +3672,7 @@ fil_tablespace_iterate(
}
if (err == DB_SUCCESS) {
- block->page.id.copy_from(
- page_id_t(callback.get_space_id(), 0));
+ block->page.id = page_id_t(callback.get_space_id(), 0);
block->page.size.copy_from(callback.get_page_size());
if (block->page.size.is_compressed()) {
page_zip_set_size(&block->page.zip,
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index 4620e493982..8afb0c523e5 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -1916,9 +1916,12 @@ do_possible_lock_wait:
thr->lock_state = QUE_THR_LOCK_NOLOCK;
- if (check_table->to_be_dropped
- || trx->error_state == DB_LOCK_WAIT_TIMEOUT) {
+ err = trx->error_state;
+ if (err != DB_SUCCESS) {
+ } else if (check_table->to_be_dropped) {
err = DB_LOCK_WAIT_TIMEOUT;
+ } else {
+ err = DB_LOCK_WAIT;
}
check_table->dec_fk_checks();
@@ -2338,10 +2341,10 @@ row_ins_duplicate_error_in_clust(
true,
ULINT_UNDEFINED, &heap);
- ulint lock_type;
-
- lock_type =
+ ulint lock_type =
trx->isolation_level <= TRX_ISO_READ_COMMITTED
+ || (trx->mysql_thd
+ && !thd_rpl_stmt_based(trx->mysql_thd))
? LOCK_REC_NOT_GAP : LOCK_ORDINARY;
/* We set a lock on the possible duplicate: this
@@ -2381,10 +2384,7 @@ row_ins_duplicate_error_in_clust(
if (row_ins_dupl_error_with_rec(
rec, entry, cursor->index, offsets)) {
-duplicate:
- trx->error_info = cursor->index;
- err = DB_DUPLICATE_KEY;
- goto func_exit;
+ goto duplicate;
}
}
}
@@ -2427,7 +2427,10 @@ duplicate:
if (row_ins_dupl_error_with_rec(
rec, entry, cursor->index, offsets)) {
- goto duplicate;
+duplicate:
+ trx->error_info = cursor->index;
+ err = DB_DUPLICATE_KEY;
+ goto func_exit;
}
}
@@ -3082,9 +3085,11 @@ row_ins_sec_index_entry_low(
if (!(flags & BTR_NO_LOCKING_FLAG)
&& dict_index_is_unique(index)
&& thr_get_trx(thr)->duplicates
- && thr_get_trx(thr)->isolation_level >= TRX_ISO_REPEATABLE_READ) {
+ && thr_get_trx(thr)->isolation_level >= TRX_ISO_REPEATABLE_READ
+ && thd_rpl_stmt_based(thr_get_trx(thr)->mysql_thd)) {
- /* When using the REPLACE statement or ON DUPLICATE clause, a
+ /* In statement-based replication, when replicating a
+ REPLACE statement or ON DUPLICATE KEY UPDATE clause, a
gap lock is taken on the position of the to-be-inserted record,
to avoid other concurrent transactions from inserting the same
record. */
@@ -3635,14 +3640,15 @@ row_ins(
ins_node_t* node, /*!< in: row insert node */
que_thr_t* thr) /*!< in: query thread */
{
- dberr_t err;
-
DBUG_ENTER("row_ins");
DBUG_PRINT("row_ins", ("table: %s", node->table->name.m_name));
+ trx_t* trx = thr_get_trx(thr);
+
if (node->duplicate) {
- thr_get_trx(thr)->error_state = DB_DUPLICATE_KEY;
+ ut_ad(thd_rpl_stmt_based(trx->mysql_thd));
+ trx->error_state = DB_DUPLICATE_KEY;
}
if (node->state == INS_NODE_ALLOC_ROW_ID) {
@@ -3668,7 +3674,7 @@ row_ins(
while (node->index != NULL) {
if (node->index->type != DICT_FTS) {
- err = row_ins_index_entry_step(node, thr);
+ dberr_t err = row_ins_index_entry_step(node, thr);
switch (err) {
case DB_SUCCESS:
@@ -3681,9 +3687,11 @@ row_ins(
case DB_DUPLICATE_KEY:
ut_ad(dict_index_is_unique(node->index));
- if (thr_get_trx(thr)->isolation_level
+ if (trx->isolation_level
>= TRX_ISO_REPEATABLE_READ
- && thr_get_trx(thr)->duplicates) {
+ && trx->duplicates
+ && !node->table->is_temporary()
+ && thd_rpl_stmt_based(trx->mysql_thd)) {
/* When we are in REPLACE statement or
INSERT .. ON DUPLICATE UPDATE
@@ -3746,7 +3754,7 @@ row_ins(
/* Save 1st dup error. Ignore
subsequent dup errors. */
node->duplicate = node->index;
- thr_get_trx(thr)->error_state
+ trx->error_state
= DB_DUPLICATE_KEY;
}
break;
@@ -3757,18 +3765,6 @@ row_ins(
}
}
- if (node->duplicate && node->table->is_temporary()) {
- ut_ad(thr_get_trx(thr)->error_state
- == DB_DUPLICATE_KEY);
- /* For TEMPORARY TABLE, we won't lock anything,
- so we can simply break here instead of requiring
- GAP locks for other unique secondary indexes,
- pretending we have consumed all indexes. */
- node->index = NULL;
- node->entry = NULL;
- break;
- }
-
node->index = dict_table_get_next_index(node->index);
node->entry = UT_LIST_GET_NEXT(tuple_list, node->entry);
@@ -3787,6 +3783,7 @@ row_ins(
insertion will take place. These gap locks are needed
only for unique indexes. So skipping non-unique indexes. */
if (node->duplicate) {
+ ut_ad(thd_rpl_stmt_based(trx->mysql_thd));
while (node->index
&& !dict_index_is_unique(node->index)) {
@@ -3795,13 +3792,13 @@ row_ins(
node->entry = UT_LIST_GET_NEXT(tuple_list,
node->entry);
}
- thr_get_trx(thr)->error_state = DB_DUPLICATE_KEY;
+ trx->error_state = DB_DUPLICATE_KEY;
}
}
ut_ad(node->entry == NULL);
- thr_get_trx(thr)->error_info = node->duplicate;
+ trx->error_info = node->duplicate;
node->state = INS_NODE_ALLOC_ROW_ID;
DBUG_RETURN(node->duplicate ? DB_DUPLICATE_KEY : DB_SUCCESS);
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index ad44742e57b..b6d6addf09a 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -4108,25 +4108,31 @@ pfs_os_file_t
row_merge_file_create_low(
const char* path)
{
- pfs_os_file_t fd;
#ifdef UNIV_PFS_IO
/* This temp file open does not go through normal
file APIs, add instrumentation to register with
performance schema */
- struct PSI_file_locker* locker = NULL;
+ struct PSI_file_locker* locker;
PSI_file_locker_state state;
+ if (!path) {
+ path = mysql_tmpdir;
+ }
+ static const char label[] = "/Innodb Merge Temp File";
+ char* name = static_cast<char*>(
+ ut_malloc_nokey(strlen(path) + sizeof label));
+ strcpy(name, path);
+ strcat(name, label);
register_pfs_file_open_begin(
&state, locker, innodb_temp_file_key,
- PSI_FILE_CREATE,
- "Innodb Merge Temp File",
- __FILE__, __LINE__);
-
+ PSI_FILE_CREATE, path ? name : label, __FILE__, __LINE__);
+
#endif
- fd = innobase_mysql_tmpfile(path);
+ pfs_os_file_t fd = innobase_mysql_tmpfile(path);
#ifdef UNIV_PFS_IO
register_pfs_file_open_end(locker, fd,
(fd == OS_FILE_CLOSED)?NULL:&fd);
+ ut_free(name);
#endif
if (fd == OS_FILE_CLOSED) {
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 1d6c6a957dd..93d230ceae1 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -37,6 +37,7 @@ Created 9/17/2000 Heikki Tuuri
#include <sql_const.h>
#include "dict0dict.h"
#include "dict0load.h"
+#include "dict0priv.h"
#include "dict0stats.h"
#include "dict0stats_bg.h"
#include "dict0defrag_bg.h"
@@ -3712,129 +3713,111 @@ defer:
/* Deleting a row from SYS_INDEXES table will invoke
dict_drop_index_tree(). */
info = pars_info_create();
- pars_info_add_str_literal(info, "table_name", name);
- err = (sqlcom == SQLCOM_TRUNCATE) ? DB_SUCCESS : que_eval_sql(
- info,
- "PROCEDURE DROP_FOREIGN_PROC () IS\n"
- "sys_foreign_id CHAR;\n"
- "table_id CHAR;\n"
- "foreign_id CHAR;\n"
- "space_id INT;\n"
- "found INT;\n"
-
- "DECLARE CURSOR cur_fk IS\n"
- "SELECT ID FROM SYS_FOREIGN\n"
- "WHERE FOR_NAME = :table_name\n"
- "AND TO_BINARY(FOR_NAME)\n"
- " = TO_BINARY(:table_name)\n"
- "FOR UPDATE;\n"
- "BEGIN\n"
+ pars_info_add_str_literal(info, "name", name);
- "SELECT ID INTO table_id\n"
- "FROM SYS_TABLES\n"
- "WHERE NAME = :table_name\n"
- "FOR UPDATE;\n"
- "IF (SQL % NOTFOUND) THEN\n"
- " RETURN;\n"
- "END IF;\n"
-
- "SELECT SPACE INTO space_id\n"
- "FROM SYS_TABLES\n"
- "WHERE NAME = :table_name;\n"
- "IF (SQL % NOTFOUND) THEN\n"
- " RETURN;\n"
- "END IF;\n"
-
- "found := 1;\n"
- "SELECT ID INTO sys_foreign_id\n"
- "FROM SYS_TABLES\n"
- "WHERE NAME = 'SYS_FOREIGN'\n"
- "FOR UPDATE;\n"
- "IF (SQL % NOTFOUND) THEN\n"
- " found := 0;\n"
- "END IF;\n"
- "IF (:table_name = 'SYS_FOREIGN') THEN\n"
- " found := 0;\n"
- "END IF;\n"
- "IF (:table_name = 'SYS_FOREIGN_COLS') \n"
- "THEN\n"
- " found := 0;\n"
- "END IF;\n"
-
- "OPEN cur_fk;\n"
- "WHILE found = 1 LOOP\n"
- " FETCH cur_fk INTO foreign_id;\n"
- " IF (SQL % NOTFOUND) THEN\n"
- " found := 0;\n"
- " ELSE\n"
- " DELETE FROM \n"
- " SYS_FOREIGN_COLS\n"
- " WHERE ID = foreign_id;\n"
- " DELETE FROM SYS_FOREIGN\n"
- " WHERE ID = foreign_id;\n"
- " END IF;\n"
- "END LOOP;\n"
- "CLOSE cur_fk;\n"
-
- "END;\n",
- FALSE, trx);
- if (err == DB_SUCCESS) {
- if (sqlcom != SQLCOM_TRUNCATE) {
+ if (sqlcom != SQLCOM_TRUNCATE
+ && strchr(name, '/')
+ && dict_table_get_low("SYS_FOREIGN")
+ && dict_table_get_low("SYS_FOREIGN_COLS")) {
+ err = que_eval_sql(
+ info,
+ "PROCEDURE DROP_FOREIGN_PROC () IS\n"
+ "fid CHAR;\n"
+
+ "DECLARE CURSOR fk IS\n"
+ "SELECT ID FROM SYS_FOREIGN\n"
+ "WHERE FOR_NAME = :name\n"
+ "AND TO_BINARY(FOR_NAME) = TO_BINARY(:name)\n"
+ "FOR UPDATE;\n"
+
+ "BEGIN\n"
+ "OPEN fk;\n"
+ "WHILE 1 = 1 LOOP\n"
+ " FETCH fk INTO fid;\n"
+ " IF (SQL % NOTFOUND) THEN RETURN; END IF;\n"
+ " DELETE FROM SYS_FOREIGN_COLS WHERE ID=fid;\n"
+ " DELETE FROM SYS_FOREIGN WHERE ID=fid;\n"
+ "END LOOP;\n"
+ "CLOSE fk;\n"
+ "END;\n", FALSE, trx);
+ if (err == DB_SUCCESS) {
info = pars_info_create();
- pars_info_add_str_literal(info, "table_name", name);
+ pars_info_add_str_literal(info, "name", name);
+ goto do_drop;
+ }
+ } else {
+do_drop:
+ if (dict_table_get_low("SYS_VIRTUAL")) {
+ err = que_eval_sql(
+ info,
+ "PROCEDURE DROP_VIRTUAL_PROC () IS\n"
+ "tid CHAR;\n"
+
+ "BEGIN\n"
+ "SELECT ID INTO tid FROM SYS_TABLES\n"
+ "WHERE NAME = :name FOR UPDATE;\n"
+ "IF (SQL % NOTFOUND) THEN RETURN;"
+ " END IF;\n"
+ "DELETE FROM SYS_VIRTUAL"
+ " WHERE TABLE_ID = tid;\n"
+ "END;\n", FALSE, trx);
+ if (err == DB_SUCCESS) {
+ info = pars_info_create();
+ pars_info_add_str_literal(
+ info, "name", name);
+ }
+ } else {
+ err = DB_SUCCESS;
}
- err = que_eval_sql(
+ err = err == DB_SUCCESS ? que_eval_sql(
info,
"PROCEDURE DROP_TABLE_PROC () IS\n"
- "table_id CHAR;\n"
- "space_id INT;\n"
- "index_id CHAR;\n"
+ "tid CHAR;\n"
+ "iid CHAR;\n"
"DECLARE CURSOR cur_idx IS\n"
"SELECT ID FROM SYS_INDEXES\n"
- "WHERE TABLE_ID = table_id\n"
- "FOR UPDATE;\n"
+ "WHERE TABLE_ID = tid FOR UPDATE;\n"
"BEGIN\n"
- "SELECT ID, SPACE INTO table_id,space_id\n"
- "FROM SYS_TABLES\n"
- "WHERE NAME = :table_name FOR UPDATE;\n"
- "IF (SQL % NOTFOUND) THEN\n"
- " RETURN;\n"
- "END IF;\n"
-
- "DELETE FROM SYS_COLUMNS\n"
- "WHERE TABLE_ID = table_id;\n"
- "DELETE FROM SYS_TABLES\n"
- "WHERE NAME = :table_name;\n"
-
- "DELETE FROM SYS_TABLESPACES\n"
- "WHERE SPACE = space_id;\n"
- "DELETE FROM SYS_DATAFILES\n"
- "WHERE SPACE = space_id;\n"
-
- "DELETE FROM SYS_VIRTUAL\n"
- "WHERE TABLE_ID = table_id;\n"
+ "SELECT ID INTO tid FROM SYS_TABLES\n"
+ "WHERE NAME = :name FOR UPDATE;\n"
+ "IF (SQL % NOTFOUND) THEN RETURN; END IF;\n"
"OPEN cur_idx;\n"
"WHILE 1 = 1 LOOP\n"
- " FETCH cur_idx INTO index_id;\n"
- " IF (SQL % NOTFOUND) THEN\n"
- " EXIT;\n"
- " ELSE\n"
- " DELETE FROM SYS_FIELDS\n"
- " WHERE INDEX_ID = index_id;\n"
- " DELETE FROM SYS_INDEXES\n"
- " WHERE ID = index_id\n"
- " AND TABLE_ID = table_id;\n"
- " END IF;\n"
+ " FETCH cur_idx INTO iid;\n"
+ " IF (SQL % NOTFOUND) THEN EXIT; END IF;\n"
+ " DELETE FROM SYS_FIELDS\n"
+ " WHERE INDEX_ID = iid;\n"
+ " DELETE FROM SYS_INDEXES\n"
+ " WHERE ID = iid AND TABLE_ID = tid;\n"
"END LOOP;\n"
"CLOSE cur_idx;\n"
- "END;\n",
- FALSE, trx);
+ "DELETE FROM SYS_COLUMNS WHERE TABLE_ID=tid;\n"
+ "DELETE FROM SYS_TABLES WHERE NAME=:name;\n"
+
+ "END;\n", FALSE, trx) : err;
+
+ if (err == DB_SUCCESS && table->space
+ && dict_table_get_low("SYS_TABLESPACES")
+ && dict_table_get_low("SYS_DATAFILES")) {
+ info = pars_info_create();
+ pars_info_add_int4_literal(info, "id",
+ lint(table->space->id));
+ err = que_eval_sql(
+ info,
+ "PROCEDURE DROP_SPACE_PROC () IS\n"
+ "BEGIN\n"
+ "DELETE FROM SYS_TABLESPACES\n"
+ "WHERE SPACE = :id;\n"
+ "DELETE FROM SYS_DATAFILES\n"
+ "WHERE SPACE = :id;\n"
+ "END;\n", FALSE, trx);
+ }
}
switch (err) {
@@ -4585,6 +4568,9 @@ row_rename_table_for_mysql(
" = TO_BINARY(:old_table_name);\n"
"END;\n"
, FALSE, trx);
+ if (err != DB_SUCCESS) {
+ goto end;
+ }
} else if (n_constraints_to_drop > 0) {
/* Drop some constraints of tmp tables. */
diff --git a/storage/innobase/row/row0row.cc b/storage/innobase/row/row0row.cc
index 8cd215d8902..9a7d1738544 100644
--- a/storage/innobase/row/row0row.cc
+++ b/storage/innobase/row/row0row.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
@@ -315,7 +315,7 @@ row_build_index_entry_low(
indexed long columns may be stored off-page. */
ut_ad(col->ord_part);
- if (ext) {
+ if (ext && !col->is_virtual()) {
/* See if the column is stored externally. */
const byte* buf = row_ext_lookup(ext, col_no,
&len);
diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc
index 5279d21b452..3d3390deca7 100644
--- a/storage/innobase/row/row0upd.cc
+++ b/storage/innobase/row/row0upd.cc
@@ -2164,6 +2164,7 @@ row_upd_store_v_row(
}
dfield_copy_data(dfield, upd_field->old_v_val);
+ dfield_dup(dfield, node->heap);
break;
}
@@ -2184,6 +2185,7 @@ row_upd_store_v_row(
update->old_vrow,
col_no);
dfield_copy_data(dfield, vfield);
+ dfield_dup(dfield, node->heap);
}
} else {
/* Need to compute, this happens when
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 2909b37d7d2..564d7a829f3 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -2223,24 +2223,24 @@ files_checked:
page_id_t(IBUF_SPACE_ID,
FSP_IBUF_HEADER_PAGE_NO),
univ_page_size, RW_X_LATCH, &mtr);
- fil_block_check_type(block, FIL_PAGE_TYPE_SYS, &mtr);
+ fil_block_check_type(*block, FIL_PAGE_TYPE_SYS, &mtr);
/* Already MySQL 3.23.53 initialized
FSP_IBUF_TREE_ROOT_PAGE_NO to
FIL_PAGE_INDEX. No need to reset that one. */
block = buf_page_get(
page_id_t(TRX_SYS_SPACE, TRX_SYS_PAGE_NO),
univ_page_size, RW_X_LATCH, &mtr);
- fil_block_check_type(block, FIL_PAGE_TYPE_TRX_SYS,
+ fil_block_check_type(*block, FIL_PAGE_TYPE_TRX_SYS,
&mtr);
block = buf_page_get(
page_id_t(TRX_SYS_SPACE,
FSP_FIRST_RSEG_PAGE_NO),
univ_page_size, RW_X_LATCH, &mtr);
- fil_block_check_type(block, FIL_PAGE_TYPE_SYS, &mtr);
+ fil_block_check_type(*block, FIL_PAGE_TYPE_SYS, &mtr);
block = buf_page_get(
page_id_t(TRX_SYS_SPACE, FSP_DICT_HDR_PAGE_NO),
univ_page_size, RW_X_LATCH, &mtr);
- fil_block_check_type(block, FIL_PAGE_TYPE_SYS, &mtr);
+ fil_block_check_type(*block, FIL_PAGE_TYPE_SYS, &mtr);
mtr.commit();
}
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index da4084f49d9..66d9a46960b 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -278,7 +278,7 @@ trx_purge_add_undo_to_history(const trx_t* trx, trx_undo_t*& undo, mtr_t* mtr)
ut_ad(srv_undo_sources
|| trx->undo_no == 0
|| (!purge_sys.enabled()
- && (srv_startup_is_before_trx_rollback_phase
+ && (srv_is_being_started
|| trx_rollback_is_active
|| srv_force_recovery >= SRV_FORCE_NO_BACKGROUND))
|| ((trx->mysql_thd || trx->internal)
diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc
index 67b5617809f..b5a99d4cc96 100644
--- a/storage/innobase/trx/trx0rec.cc
+++ b/storage/innobase/trx/trx0rec.cc
@@ -1897,8 +1897,7 @@ trx_undo_page_report_rename(trx_t* trx, const dict_table_t* table,
@param[in,out] trx transaction
@param[in] table table that is being renamed
@return DB_SUCCESS or error code */
-dberr_t
-trx_undo_report_rename(trx_t* trx, const dict_table_t* table)
+dberr_t trx_undo_report_rename(trx_t* trx, const dict_table_t* table)
{
ut_ad(!trx->read_only);
ut_ad(trx->id);
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index d51e26aa771..5d549a8839a 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -1464,9 +1464,6 @@ void trx_commit_low(trx_t* trx, mtr_t* mtr)
#endif
if (mtr != NULL) {
-
- mtr->set_sync();
-
trx_write_serialisation_history(trx, mtr);
/* The following call commits the mini-transaction, making the
@@ -1528,7 +1525,7 @@ trx_commit(
if (trx->has_logged_or_recovered()) {
mtr = &local_mtr;
- mtr_start_sync(mtr);
+ mtr->start();
} else {
mtr = NULL;
@@ -1962,7 +1959,7 @@ trx_prepare_low(trx_t* trx)
trx_rseg_t* rseg = trx->rsegs.m_redo.rseg;
ut_ad(undo->rseg == rseg);
- mtr.start(true);
+ mtr.start();
/* Change the undo log segment states from TRX_UNDO_ACTIVE to
TRX_UNDO_PREPARED: these modifications to the file data