Merge 10.2 into 10.3
This commit is contained in:
commit
f418661efa
4
mysql-test/main/create_replace_tmp.result
Normal file
4
mysql-test/main/create_replace_tmp.result
Normal file
@ -0,0 +1,4 @@
|
||||
CREATE TEMPORARY TABLE t (i INT);
|
||||
CREATE or replace TABLE t AS SELECT * FROM t;
|
||||
DROP TEMPORARY TABLE t;
|
||||
DROP TABLE t;
|
4
mysql-test/main/create_replace_tmp.test
Normal file
4
mysql-test/main/create_replace_tmp.test
Normal file
@ -0,0 +1,4 @@
|
||||
CREATE TEMPORARY TABLE t (i INT);
|
||||
CREATE or replace TABLE t AS SELECT * FROM t;
|
||||
DROP TEMPORARY TABLE t;
|
||||
DROP TABLE t;
|
23
mysql-test/main/cte_recursive_not_embedded.result
Normal file
23
mysql-test/main/cte_recursive_not_embedded.result
Normal file
@ -0,0 +1,23 @@
|
||||
#
|
||||
# MDEV-15151: function with recursive CTE using no base tables
|
||||
# (duplicate of MDEV-16661)
|
||||
#
|
||||
connection default;
|
||||
CREATE TABLE t1 (id int KEY);
|
||||
INSERT INTO t1 VALUES (0), (1),(2);
|
||||
CREATE OR REPLACE FUNCTION func() RETURNS int
|
||||
RETURN
|
||||
(
|
||||
WITH recursive cte AS
|
||||
(SELECT 1 a UNION SELECT cte.* FROM cte natural join t1)
|
||||
SELECT * FROM cte limit 1
|
||||
);
|
||||
connect con1,localhost,root,,test;
|
||||
SELECT func();
|
||||
connect con2,localhost,root,,test;
|
||||
disconnect con2;
|
||||
connection con1;
|
||||
disconnect con1;
|
||||
connection default;
|
||||
DROP FUNCTION func;
|
||||
DROP TABLE t1;
|
42
mysql-test/main/cte_recursive_not_embedded.test
Normal file
42
mysql-test/main/cte_recursive_not_embedded.test
Normal file
@ -0,0 +1,42 @@
|
||||
--source include/not_embedded.inc
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-15151: function with recursive CTE using no base tables
|
||||
--echo # (duplicate of MDEV-16661)
|
||||
--echo #
|
||||
|
||||
--connection default
|
||||
|
||||
CREATE TABLE t1 (id int KEY);
|
||||
INSERT INTO t1 VALUES (0), (1),(2);
|
||||
|
||||
CREATE OR REPLACE FUNCTION func() RETURNS int
|
||||
RETURN
|
||||
(
|
||||
WITH recursive cte AS
|
||||
(SELECT 1 a UNION SELECT cte.* FROM cte natural join t1)
|
||||
SELECT * FROM cte limit 1
|
||||
);
|
||||
|
||||
--connect (con1,localhost,root,,test)
|
||||
|
||||
--let $conid= `SELECT CONNECTION_ID()`
|
||||
--send SELECT func()
|
||||
|
||||
--connect (con2,localhost,root,,test)
|
||||
--disable_query_log
|
||||
--eval KILL QUERY $conid
|
||||
--enable_query_log
|
||||
--disconnect con2
|
||||
|
||||
--disable_result_log
|
||||
--connection con1
|
||||
--error 0,ER_QUERY_INTERRUPTED
|
||||
--reap
|
||||
--disconnect con1
|
||||
--enable_result_log
|
||||
|
||||
--connection default
|
||||
|
||||
DROP FUNCTION func;
|
||||
DROP TABLE t1;
|
9
mysql-test/suite/rpl/r/rpl_15867.result
Normal file
9
mysql-test/suite/rpl/r/rpl_15867.result
Normal file
@ -0,0 +1,9 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
CREATE TEMPORARY TABLE t (i INT);
|
||||
CREATE TABLE t AS SELECT * FROM t;
|
||||
connection slave;
|
||||
connection master;
|
||||
DROP TEMPORARY TABLE t;
|
||||
DROP TABLE t;
|
||||
include/rpl_end.inc
|
11
mysql-test/suite/rpl/t/rpl_15867.test
Normal file
11
mysql-test/suite/rpl/t/rpl_15867.test
Normal file
@ -0,0 +1,11 @@
|
||||
--source include/master-slave.inc
|
||||
CREATE TEMPORARY TABLE t (i INT);
|
||||
CREATE TABLE t AS SELECT * FROM t;
|
||||
|
||||
--sync_slave_with_master
|
||||
|
||||
# Cleanup
|
||||
--connection master
|
||||
DROP TEMPORARY TABLE t;
|
||||
DROP TABLE t;
|
||||
--source include/rpl_end.inc
|
@ -1039,6 +1039,12 @@ retry:
|
||||
if (res->table && (res->table == table->table))
|
||||
continue;
|
||||
|
||||
/* Skip if table is tmp table */
|
||||
if (check_flag & CHECK_DUP_SKIP_TEMP_TABLE &&
|
||||
res->table && res->table->s->tmp_table != NO_TMP_TABLE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (check_flag & CHECK_DUP_FOR_CREATE)
|
||||
DBUG_RETURN(res);
|
||||
|
||||
|
@ -64,6 +64,7 @@ enum find_item_error_report_type {REPORT_ALL_ERRORS, REPORT_EXCEPT_NOT_FOUND,
|
||||
/* Flag bits for unique_table() */
|
||||
#define CHECK_DUP_ALLOW_DIFFERENT_ALIAS 1
|
||||
#define CHECK_DUP_FOR_CREATE 2
|
||||
#define CHECK_DUP_SKIP_TEMP_TABLE 4
|
||||
|
||||
uint get_table_def_key(const TABLE_LIST *table_list, const char **key);
|
||||
TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update,
|
||||
|
@ -4196,7 +4196,8 @@ mysql_execute_command(THD *thd)
|
||||
TABLE_LIST *duplicate;
|
||||
if (unlikely((duplicate= unique_table(thd, lex->query_tables,
|
||||
lex->query_tables->next_global,
|
||||
CHECK_DUP_FOR_CREATE))))
|
||||
CHECK_DUP_FOR_CREATE |
|
||||
CHECK_DUP_SKIP_TEMP_TABLE))))
|
||||
{
|
||||
update_non_unique_table_error(lex->query_tables, "CREATE",
|
||||
duplicate);
|
||||
|
@ -570,10 +570,9 @@ static
|
||||
bool
|
||||
btr_search_update_block_hash_info(btr_search_t* info, buf_block_t* block)
|
||||
{
|
||||
ut_ad(!btr_search_own_any(RW_LOCK_S));
|
||||
ut_ad(!btr_search_own_any(RW_LOCK_X));
|
||||
ut_ad(rw_lock_own(&block->lock, RW_LOCK_S)
|
||||
|| rw_lock_own(&block->lock, RW_LOCK_X));
|
||||
ut_ad(!btr_search_own_any());
|
||||
ut_ad(rw_lock_own_flagged(&block->lock,
|
||||
RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
|
||||
|
||||
info->last_hash_succ = FALSE;
|
||||
|
||||
@ -648,8 +647,8 @@ btr_search_update_hash_ref(
|
||||
|
||||
ut_ad(cursor->flag == BTR_CUR_HASH_FAIL);
|
||||
ut_ad(rw_lock_own(btr_get_search_latch(cursor->index), RW_LOCK_X));
|
||||
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_S)
|
||||
|| rw_lock_own(&(block->lock), RW_LOCK_X));
|
||||
ut_ad(rw_lock_own_flagged(&block->lock,
|
||||
RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
|
||||
ut_ad(page_align(btr_cur_get_rec(cursor)) == block->frame);
|
||||
ut_ad(page_is_leaf(block->frame));
|
||||
assert_block_ahi_valid(block);
|
||||
@ -887,8 +886,8 @@ btr_search_guess_on_hash(
|
||||
btr_cur_t cursor2;
|
||||
btr_pcur_t pcur;
|
||||
#endif
|
||||
ut_ad(!ahi_latch || rw_lock_own(ahi_latch, RW_LOCK_S)
|
||||
|| rw_lock_own(ahi_latch, RW_LOCK_X));
|
||||
ut_ad(!ahi_latch || rw_lock_own_flagged(
|
||||
ahi_latch, RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
|
||||
|
||||
if (!btr_search_enabled) {
|
||||
return(FALSE);
|
||||
@ -1109,8 +1108,8 @@ retry:
|
||||
|
||||
ut_ad(block->page.buf_fix_count == 0
|
||||
|| buf_block_get_state(block) == BUF_BLOCK_REMOVE_HASH
|
||||
|| rw_lock_own(&block->lock, RW_LOCK_S)
|
||||
|| rw_lock_own(&block->lock, RW_LOCK_X));
|
||||
|| rw_lock_own_flagged(&block->lock,
|
||||
RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
|
||||
ut_ad(page_is_leaf(block->frame));
|
||||
|
||||
/* We must not dereference index here, because it could be freed
|
||||
@ -1363,8 +1362,8 @@ btr_search_build_page_hash_index(
|
||||
ut_a(!dict_index_is_ibuf(index));
|
||||
ut_ad(page_is_leaf(block->frame));
|
||||
|
||||
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_S)
|
||||
|| rw_lock_own(&(block->lock), RW_LOCK_X));
|
||||
ut_ad(rw_lock_own_flagged(&block->lock,
|
||||
RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
|
||||
|
||||
rw_lock_s_lock(ahi_latch);
|
||||
|
||||
@ -1531,8 +1530,8 @@ btr_search_info_update_slow(btr_search_t* info, btr_cur_t* cursor)
|
||||
{
|
||||
rw_lock_t* ahi_latch = btr_get_search_latch(cursor->index);
|
||||
|
||||
ut_ad(!rw_lock_own(ahi_latch, RW_LOCK_S));
|
||||
ut_ad(!rw_lock_own(ahi_latch, RW_LOCK_X));
|
||||
ut_ad(!rw_lock_own_flagged(ahi_latch,
|
||||
RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
|
||||
|
||||
buf_block_t* block = btr_cur_get_block(cursor);
|
||||
|
||||
|
@ -4498,8 +4498,9 @@ loop:
|
||||
case BUF_GET_IF_IN_POOL_OR_WATCH:
|
||||
case BUF_PEEK_IF_IN_POOL:
|
||||
case BUF_EVICT_IF_IN_POOL:
|
||||
ut_ad(!rw_lock_own(hash_lock, RW_LOCK_X));
|
||||
ut_ad(!rw_lock_own(hash_lock, RW_LOCK_S));
|
||||
ut_ad(!rw_lock_own_flagged(
|
||||
hash_lock,
|
||||
RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@ -4840,8 +4841,8 @@ evict_from_pool:
|
||||
ut_ad(block == fix_block);
|
||||
ut_ad(fix_block->page.buf_fix_count > 0);
|
||||
|
||||
ut_ad(!rw_lock_own(hash_lock, RW_LOCK_X));
|
||||
ut_ad(!rw_lock_own(hash_lock, RW_LOCK_S));
|
||||
ut_ad(!rw_lock_own_flagged(hash_lock,
|
||||
RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
|
||||
|
||||
ut_ad(buf_block_get_state(fix_block) == BUF_BLOCK_FILE_PAGE);
|
||||
|
||||
@ -5015,8 +5016,8 @@ evict_from_pool:
|
||||
ut_a(ibuf_count_get(fix_block->page.id) == 0);
|
||||
#endif
|
||||
|
||||
ut_ad(!rw_lock_own(hash_lock, RW_LOCK_X));
|
||||
ut_ad(!rw_lock_own(hash_lock, RW_LOCK_S));
|
||||
ut_ad(!rw_lock_own_flagged(hash_lock,
|
||||
RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
|
||||
|
||||
return(fix_block);
|
||||
}
|
||||
@ -5688,8 +5689,8 @@ func_exit:
|
||||
ibuf_mtr_commit(&mtr);
|
||||
}
|
||||
|
||||
ut_ad(!rw_lock_own(hash_lock, RW_LOCK_X));
|
||||
ut_ad(!rw_lock_own(hash_lock, RW_LOCK_S));
|
||||
ut_ad(!rw_lock_own_flagged(hash_lock,
|
||||
RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
|
||||
ut_ad(!bpage || buf_page_in_file(bpage));
|
||||
|
||||
return(bpage);
|
||||
|
@ -1629,8 +1629,8 @@ func_exit:
|
||||
}
|
||||
|
||||
/* buf_LRU_block_remove_hashed() releases the hash_lock */
|
||||
ut_ad(!rw_lock_own(hash_lock, RW_LOCK_X)
|
||||
&& !rw_lock_own(hash_lock, RW_LOCK_S));
|
||||
ut_ad(!rw_lock_own_flagged(hash_lock,
|
||||
RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
|
||||
|
||||
/* We have just freed a BUF_BLOCK_FILE_PAGE. If b != NULL
|
||||
then it was a compressed page with an uncompressed frame and
|
||||
@ -2183,9 +2183,8 @@ buf_LRU_free_one_page(
|
||||
}
|
||||
|
||||
/* buf_LRU_block_remove_hashed() releases hash_lock and block_mutex */
|
||||
ut_ad(!rw_lock_own(hash_lock, RW_LOCK_X)
|
||||
&& !rw_lock_own(hash_lock, RW_LOCK_S));
|
||||
|
||||
ut_ad(!rw_lock_own_flagged(hash_lock,
|
||||
RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
|
||||
ut_ad(!mutex_own(block_mutex));
|
||||
}
|
||||
|
||||
|
@ -257,9 +257,8 @@ rtr_pcur_getnext_from_path(
|
||||
rtr_info->tree_savepoints[tree_idx] = mtr_set_savepoint(mtr);
|
||||
|
||||
#ifdef UNIV_RTR_DEBUG
|
||||
ut_ad(!(rw_lock_own(&btr_cur->page_cur.block->lock, RW_LOCK_X)
|
||||
||
|
||||
rw_lock_own(&btr_cur->page_cur.block->lock, RW_LOCK_S))
|
||||
ut_ad(!(rw_lock_own_flagged(&btr_cur->page_cur.block->lock,
|
||||
RW_LOCK_FLAG_X | RW_LOCK_FLAG_S))
|
||||
|| my_latch_mode == BTR_MODIFY_TREE
|
||||
|| my_latch_mode == BTR_CONT_MODIFY_TREE
|
||||
|| !page_is_leaf(buf_block_get_frame(
|
||||
|
@ -20680,7 +20680,6 @@ static TABLE* innodb_acquire_mdl(THD* thd, dict_table_t* table)
|
||||
|
||||
if (!table_name_parse(table->name, db_buf, tbl_buf,
|
||||
db_buf_len, tbl_buf_len)) {
|
||||
ut_ad(!"invalid table name");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -20716,7 +20715,6 @@ fail:
|
||||
|
||||
if (!table_name_parse(table->name, db_buf1, tbl_buf1,
|
||||
db_buf1_len, tbl_buf1_len)) {
|
||||
ut_ad(!"invalid table name");
|
||||
goto release_fail;
|
||||
}
|
||||
|
||||
@ -20764,7 +20762,6 @@ static TABLE* innodb_find_table_for_vc(THD* thd, dict_table_t* table)
|
||||
|
||||
if (!table_name_parse(table->name, db_buf, tbl_buf,
|
||||
db_buf_len, tbl_buf_len)) {
|
||||
ut_ad(!"invalid table name");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -171,6 +171,9 @@ static inline bool btr_search_own_all(ulint mode);
|
||||
@retval true if owns any of them
|
||||
@retval false if owns no search latch */
|
||||
static inline bool btr_search_own_any(ulint mode);
|
||||
|
||||
/** @return whether this thread holds any of the search latches */
|
||||
static inline bool btr_search_own_any();
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
/** Unlock all search latches from shared mode. */
|
||||
|
@ -144,6 +144,18 @@ static inline bool btr_search_own_any(ulint mode)
|
||||
}
|
||||
return(false);
|
||||
}
|
||||
|
||||
/** @return whether this thread holds any of the search latches */
|
||||
static inline bool btr_search_own_any()
|
||||
{
|
||||
for (ulint i = btr_ahi_parts; i--; ) {
|
||||
if (rw_lock_own_flagged(btr_search_latches[i],
|
||||
RW_LOCK_FLAG_X | RW_LOCK_FLAG_S)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
/** Get the adaptive hash search index latch for a b-tree.
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1994, 2015, 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
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@ -137,11 +138,8 @@ hash_assert_can_search(
|
||||
if (table->type == HASH_TABLE_SYNC_MUTEX) {
|
||||
ut_ad(mutex_own(hash_get_mutex(table, fold)));
|
||||
} else if (table->type == HASH_TABLE_SYNC_RW_LOCK) {
|
||||
# ifdef UNIV_DEBUG
|
||||
rw_lock_t* lock = hash_get_lock(table, fold);
|
||||
ut_ad(rw_lock_own(lock, RW_LOCK_X)
|
||||
|| rw_lock_own(lock, RW_LOCK_S));
|
||||
# endif
|
||||
ut_ad(rw_lock_own_flagged(hash_get_lock(table, fold),
|
||||
RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
|
||||
} else {
|
||||
ut_ad(table->type == HASH_TABLE_SYNC_NONE);
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ struct TABLE;
|
||||
/** Purge virtual column node information. */
|
||||
struct purge_vcol_info_t
|
||||
{
|
||||
private:
|
||||
/** Is there a possible need to evaluate virtual columns? */
|
||||
bool requested;
|
||||
/** Do we have to evaluate virtual columns (using mariadb_table)? */
|
||||
@ -67,6 +68,7 @@ struct purge_vcol_info_t
|
||||
/** MariaDB table opened for virtual column computation. */
|
||||
TABLE* mariadb_table;
|
||||
|
||||
public:
|
||||
/** Reset the state. */
|
||||
void reset()
|
||||
{
|
||||
@ -81,6 +83,29 @@ struct purge_vcol_info_t
|
||||
or doesn't try to calculate virtual column. */
|
||||
bool validate() const { return !used || mariadb_table; }
|
||||
|
||||
/** @return the table handle for evaluating virtual columns */
|
||||
TABLE* table() const { return mariadb_table; }
|
||||
|
||||
/** Set the table handle for evaluating virtual columns.
|
||||
@param[in] table table handle */
|
||||
void set_table(TABLE* table)
|
||||
{
|
||||
ut_ad(!table || is_first_fetch());
|
||||
mariadb_table = table;
|
||||
}
|
||||
|
||||
/** Note that virtual column information may be needed. */
|
||||
void set_requested()
|
||||
{
|
||||
ut_ad(!used);
|
||||
ut_ad(!first_use);
|
||||
ut_ad(!mariadb_table);
|
||||
requested = true;
|
||||
}
|
||||
|
||||
/** @return whether the virtual column information may be needed */
|
||||
bool is_requested() const { return requested; }
|
||||
|
||||
/** Note that the virtual column information is needed. */
|
||||
void set_used()
|
||||
{
|
||||
@ -92,7 +117,18 @@ struct purge_vcol_info_t
|
||||
return;
|
||||
}
|
||||
|
||||
first_use = used = true;
|
||||
if (!used) {
|
||||
first_use = used = true;
|
||||
}
|
||||
}
|
||||
|
||||
/** @return whether the virtual column information is needed */
|
||||
bool is_used() const
|
||||
{
|
||||
ut_ad(!first_use || used);
|
||||
ut_ad(!used || requested);
|
||||
ut_ad(used || !mariadb_table);
|
||||
return used;
|
||||
}
|
||||
|
||||
/** Check whether it fetches mariadb table for the first time.
|
||||
@ -100,6 +136,8 @@ struct purge_vcol_info_t
|
||||
bool is_first_fetch() const
|
||||
{
|
||||
ut_ad(!first_use || used);
|
||||
ut_ad(!used || requested);
|
||||
ut_ad(used || !mariadb_table);
|
||||
return first_use;
|
||||
}
|
||||
};
|
||||
|
@ -279,8 +279,7 @@ rw_lock_s_lock_func(
|
||||
the threads which have s-locked a latch. This would use some CPU
|
||||
time. */
|
||||
|
||||
ut_ad(!rw_lock_own(lock, RW_LOCK_S)); /* see NOTE above */
|
||||
ut_ad(!rw_lock_own(lock, RW_LOCK_X));
|
||||
ut_ad(!rw_lock_own_flagged(lock, RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
|
||||
|
||||
if (!rw_lock_s_lock_low(lock, pass, file_name, line)) {
|
||||
|
||||
|
@ -329,8 +329,8 @@ row_log_online_op(
|
||||
|
||||
ut_ad(dtuple_validate(tuple));
|
||||
ut_ad(dtuple_get_n_fields(tuple) == dict_index_get_n_fields(index));
|
||||
ut_ad(rw_lock_own(dict_index_get_lock(index), RW_LOCK_S)
|
||||
|| rw_lock_own(dict_index_get_lock(index), RW_LOCK_X));
|
||||
ut_ad(rw_lock_own_flagged(&index->lock,
|
||||
RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
|
||||
|
||||
if (index->is_corrupted()) {
|
||||
return;
|
||||
|
@ -137,7 +137,7 @@ row_purge_remove_clust_if_poss_low(
|
||||
rec_offs_init(offsets_);
|
||||
|
||||
ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_S)
|
||||
|| node->vcol_info.used);
|
||||
|| node->vcol_info.is_used());
|
||||
|
||||
index = dict_table_get_first_index(node->table);
|
||||
|
||||
@ -250,7 +250,7 @@ static void row_purge_store_vsec_cur(
|
||||
return;
|
||||
}
|
||||
|
||||
node->vcol_info.requested = true;
|
||||
node->vcol_info.set_requested();
|
||||
|
||||
btr_pcur_store_position(sec_pcur, sec_mtr);
|
||||
|
||||
@ -318,16 +318,18 @@ row_purge_poss_sec(
|
||||
|
||||
ut_ad(!dict_index_is_clust(index));
|
||||
|
||||
const bool store_cur = sec_mtr && !node->vcol_info.used
|
||||
const bool store_cur = sec_mtr && !node->vcol_info.is_used()
|
||||
&& dict_index_has_virtual(index);
|
||||
|
||||
if (store_cur) {
|
||||
row_purge_store_vsec_cur(node, index, sec_pcur, sec_mtr);
|
||||
ut_ad(sec_mtr->has_committed()
|
||||
== node->vcol_info.is_requested());
|
||||
|
||||
/* The PRIMARY KEY value was not found in the clustered
|
||||
index. The secondary index record found. We can purge
|
||||
the secondary index record. */
|
||||
if (!node->vcol_info.requested) {
|
||||
if (!node->vcol_info.is_requested()) {
|
||||
ut_ad(!node->found_clust);
|
||||
return true;
|
||||
}
|
||||
@ -344,7 +346,18 @@ retry_purge_sec:
|
||||
&node->vcol_info);
|
||||
|
||||
if (node->vcol_info.is_first_fetch()) {
|
||||
if (node->vcol_info.mariadb_table) {
|
||||
ut_ad(store_cur);
|
||||
|
||||
const TABLE* t= node->vcol_info.table();
|
||||
DBUG_LOG("purge", "retry " << t
|
||||
<< (is_tree ? " tree" : " leaf")
|
||||
<< index->name << "," << index->table->name
|
||||
<< ": " << rec_printer(entry).str());
|
||||
|
||||
ut_ad(mtr.has_committed());
|
||||
|
||||
if (t) {
|
||||
node->vcol_info.set_used();
|
||||
goto retry_purge_sec;
|
||||
}
|
||||
|
||||
@ -357,9 +370,11 @@ retry_purge_sec:
|
||||
if (node->found_clust) {
|
||||
btr_pcur_commit_specify_mtr(&node->pcur, &mtr);
|
||||
} else {
|
||||
mtr_commit(&mtr);
|
||||
mtr.commit();
|
||||
}
|
||||
|
||||
ut_ad(mtr.has_committed());
|
||||
|
||||
if (store_cur && !row_purge_restore_vsec_cur(
|
||||
node, index, sec_pcur, sec_mtr, is_tree)) {
|
||||
return false;
|
||||
@ -791,7 +806,7 @@ whose old history can no longer be observed.
|
||||
static void row_purge_reset_trx_id(purge_node_t* node, mtr_t* mtr)
|
||||
{
|
||||
ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_S)
|
||||
|| node->vcol_info.used);
|
||||
|| node->vcol_info.is_used());
|
||||
/* Reset DB_TRX_ID, DB_ROLL_PTR for old records. */
|
||||
mtr->start();
|
||||
|
||||
@ -867,7 +882,7 @@ row_purge_upd_exist_or_extern_func(
|
||||
mem_heap_t* heap;
|
||||
|
||||
ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_S)
|
||||
|| node->vcol_info.used);
|
||||
|| node->vcol_info.is_used());
|
||||
ut_ad(!node->table->skip_alter_undo);
|
||||
|
||||
if (node->rec_type == TRX_UNDO_UPD_DEL_REC
|
||||
@ -1228,7 +1243,7 @@ row_purge(
|
||||
bool purged = row_purge_record(
|
||||
node, undo_rec, thr, updated_extern);
|
||||
|
||||
if (!node->vcol_info.used) {
|
||||
if (!node->vcol_info.is_used()) {
|
||||
rw_lock_s_unlock(dict_operation_lock);
|
||||
}
|
||||
|
||||
|
@ -1100,8 +1100,8 @@ sel_set_rtr_rec_lock(
|
||||
rw_lock_x_lock(&(match->block.lock));
|
||||
retry:
|
||||
cur_block = btr_pcur_get_block(pcur);
|
||||
ut_ad(rw_lock_own(&(match->block.lock), RW_LOCK_X)
|
||||
|| rw_lock_own(&(match->block.lock), RW_LOCK_S));
|
||||
ut_ad(rw_lock_own_flagged(&match->block.lock,
|
||||
RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
|
||||
ut_ad(page_is_leaf(buf_block_get_frame(cur_block)));
|
||||
|
||||
err = lock_sec_rec_read_check_and_lock(
|
||||
|
@ -222,8 +222,8 @@ row_undo_mod_clust(
|
||||
ut_ad(thr_get_trx(thr) == node->trx);
|
||||
ut_ad(node->trx->dict_operation_lock_mode);
|
||||
ut_ad(node->trx->in_rollback);
|
||||
ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_S)
|
||||
|| rw_lock_own(dict_operation_lock, RW_LOCK_X));
|
||||
ut_ad(rw_lock_own_flagged(dict_operation_lock,
|
||||
RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
|
||||
|
||||
log_free_check();
|
||||
pcur = &node->pcur;
|
||||
|
@ -453,7 +453,7 @@ row_vers_build_clust_v_col(
|
||||
|
||||
if (vcol_info != NULL) {
|
||||
vcol_info->set_used();
|
||||
maria_table = vcol_info->mariadb_table;
|
||||
maria_table = vcol_info->table();
|
||||
}
|
||||
|
||||
innobase_allocate_row_for_vcol(thd, index,
|
||||
@ -462,9 +462,8 @@ row_vers_build_clust_v_col(
|
||||
&record,
|
||||
&vcol_storage);
|
||||
|
||||
if (vcol_info && !vcol_info->mariadb_table) {
|
||||
vcol_info->mariadb_table = maria_table;
|
||||
ut_ad(!maria_table || vcol_info->is_first_fetch());
|
||||
if (vcol_info && !vcol_info->table()) {
|
||||
vcol_info->set_table(maria_table);
|
||||
goto func_exit;
|
||||
}
|
||||
|
||||
@ -828,7 +827,7 @@ row_vers_build_cur_vrow(
|
||||
rec, *clust_offsets,
|
||||
NULL, NULL, NULL, NULL, heap);
|
||||
|
||||
if (vcol_info && !vcol_info->used) {
|
||||
if (vcol_info && !vcol_info->is_used()) {
|
||||
mtr->commit();
|
||||
}
|
||||
|
||||
@ -949,7 +948,7 @@ row_vers_old_has_index_entry(
|
||||
if (trx_undo_roll_ptr_is_insert(t_roll_ptr)
|
||||
|| dbug_v_purge) {
|
||||
|
||||
if (vcol_info && !vcol_info->used) {
|
||||
if (vcol_info && !vcol_info->is_used()) {
|
||||
mtr->commit();
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2008, Google Inc.
|
||||
Copyright (c) 2017, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2018, MariaDB Corporation.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted by
|
||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||
@ -1092,12 +1092,12 @@ rw_lock_own_flagged(
|
||||
|
||||
const rw_lock_debug_t* info = *it;
|
||||
|
||||
ut_ad(os_thread_eq(info->thread_id, os_thread_get_curr_id()));
|
||||
|
||||
if (info->pass != 0) {
|
||||
if (info->pass) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ut_ad(os_thread_eq(info->thread_id, os_thread_get_curr_id()));
|
||||
|
||||
switch (info->lock_type) {
|
||||
case RW_LOCK_S:
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2007, 2015, 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
|
||||
@ -1468,26 +1468,20 @@ cache_select_table(
|
||||
trx_i_s_cache_t* cache, /*!< in: whole cache */
|
||||
enum i_s_table table) /*!< in: which table */
|
||||
{
|
||||
i_s_table_cache_t* table_cache;
|
||||
|
||||
ut_ad(rw_lock_own(cache->rw_lock, RW_LOCK_S)
|
||||
|| rw_lock_own(cache->rw_lock, RW_LOCK_X));
|
||||
ut_ad(rw_lock_own_flagged(cache->rw_lock,
|
||||
RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
|
||||
|
||||
switch (table) {
|
||||
case I_S_INNODB_TRX:
|
||||
table_cache = &cache->innodb_trx;
|
||||
break;
|
||||
return &cache->innodb_trx;
|
||||
case I_S_INNODB_LOCKS:
|
||||
table_cache = &cache->innodb_locks;
|
||||
break;
|
||||
return &cache->innodb_locks;
|
||||
case I_S_INNODB_LOCK_WAITS:
|
||||
table_cache = &cache->innodb_lock_waits;
|
||||
break;
|
||||
default:
|
||||
ut_error;
|
||||
return &cache->innodb_lock_waits;
|
||||
}
|
||||
|
||||
return(table_cache);
|
||||
ut_error;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*******************************************************************//**
|
||||
|
@ -358,7 +358,7 @@ ut_print_buf_hex(
|
||||
|
||||
for (data = static_cast<const byte*>(buf), i = 0; i < len; i++) {
|
||||
byte b = *data++;
|
||||
o << hexdigit[(int) b >> 16] << hexdigit[b & 15];
|
||||
o << hexdigit[int(b) >> 4] << hexdigit[b & 15];
|
||||
}
|
||||
|
||||
o << ")";
|
||||
|
Loading…
x
Reference in New Issue
Block a user