Merge 10.2 into 10.3
This commit is contained in:
commit
c3a6c683e2
@ -25,7 +25,8 @@ ENDIF()
|
||||
|
||||
MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}")
|
||||
|
||||
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
|
||||
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
|
||||
${CMAKE_SOURCE_DIR}/cmake ${CMAKE_SOURCE_DIR}/cmake/Internal/CPack)
|
||||
|
||||
# Use a default manufacturer if no manufacturer was identified.
|
||||
IF(NOT DEFINED MANUFACTURER)
|
||||
|
@ -50,7 +50,11 @@ endif()
|
||||
# load the original CPackRPM.cmake
|
||||
set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
|
||||
unset(CMAKE_MODULE_PATH)
|
||||
include(CPackRPM)
|
||||
if (CMAKE_VERSION VERSION_GREATER "3.12.99")
|
||||
include(Internal/CPack/CPackRPM)
|
||||
else()
|
||||
include(CPackRPM)
|
||||
endif()
|
||||
set(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH})
|
||||
|
||||
restore(LICENSE)
|
@ -87,6 +87,7 @@ IF(FEATURE_SET)
|
||||
ENDIF()
|
||||
|
||||
SET(WITH_INNODB_SNAPPY OFF CACHE STRING "")
|
||||
SET(WITH_NUMA 0 CACHE BOOL "")
|
||||
IF(WIN32)
|
||||
SET(INSTALL_MYSQLTESTDIR "" CACHE STRING "")
|
||||
SET(INSTALL_SQLBENCHDIR "" CACHE STRING "")
|
||||
@ -96,18 +97,15 @@ ELSEIF(RPM)
|
||||
SET(WITH_ZLIB system CACHE STRING "")
|
||||
SET(CHECKMODULE /usr/bin/checkmodule CACHE STRING "")
|
||||
SET(SEMODULE_PACKAGE /usr/bin/semodule_package CACHE STRING "")
|
||||
SET(WITH_LIBARCHIVE ON CACHE STRING "")
|
||||
ELSEIF(DEB)
|
||||
SET(WITH_SSL system CACHE STRING "")
|
||||
SET(WITH_ZLIB system CACHE STRING "")
|
||||
SET(WITH_LIBWRAP ON)
|
||||
SET(HAVE_EMBEDDED_PRIVILEGE_CONTROL ON)
|
||||
SET(WITH_LIBARCHIVE ON CACHE STRING "")
|
||||
ELSE()
|
||||
SET(WITH_SSL bundled CACHE STRING "")
|
||||
SET(WITH_ZLIB bundled CACHE STRING "")
|
||||
SET(WITH_JEMALLOC static CACHE STRING "")
|
||||
SET(WITH_LIBARCHIVE STATIC CACHE STRING "")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT COMPILATION_COMMENT)
|
||||
|
@ -434,7 +434,7 @@ drop table t1;
|
||||
#
|
||||
create table t1 (a int);
|
||||
create or replace table t1 (a int default b, b int default a);
|
||||
ERROR 01000: Expression for field `a` is refering to uninitialized field `b`
|
||||
ERROR 01000: Expression for field `a` is referring to uninitialized field `b`
|
||||
show create table t1;
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
#
|
||||
@ -451,16 +451,16 @@ create or replace table t1 (a varchar(128) default @@version);
|
||||
create or replace table t1 (a int not null, b int as (a));
|
||||
create or replace table t1 (a int not null, b int default (a+1));
|
||||
create or replace table t1 (a int default a);
|
||||
ERROR 01000: Expression for field `a` is refering to uninitialized field `a`
|
||||
ERROR 01000: Expression for field `a` is referring to uninitialized field `a`
|
||||
create or replace table t1 (a int default b, b int default (1+1));
|
||||
create or replace table t1 (a int default 1, b int as (c), c int as (a+1));
|
||||
ERROR 01000: Expression for field `b` is refering to uninitialized field `c`
|
||||
ERROR 01000: Expression for field `b` is referring to uninitialized field `c`
|
||||
CREATE TABLE t1 (a INT DEFAULT (DEFAULT(a)));
|
||||
ERROR 01000: Expression for field `a` is refering to uninitialized field `a`
|
||||
ERROR 01000: Expression for field `a` is referring to uninitialized field `a`
|
||||
CREATE TABLE t1 (a INT DEFAULT(DEFAULT(b)), b INT DEFAULT(DEFAULT(a)));
|
||||
ERROR 01000: Expression for field `a` is refering to uninitialized field `b`
|
||||
ERROR 01000: Expression for field `a` is referring to uninitialized field `b`
|
||||
CREATE TABLE t1 (a INT DEFAULT(DEFAULT(b)) NOT NULL, b INT DEFAULT(DEFAULT(a)) NOT NULL);
|
||||
ERROR 01000: Expression for field `a` is refering to uninitialized field `b`
|
||||
ERROR 01000: Expression for field `a` is referring to uninitialized field `b`
|
||||
#
|
||||
# Allow defaults to refer to not default fields
|
||||
#
|
||||
@ -519,7 +519,7 @@ Got one of the listed errors
|
||||
CREATE TABLE t1 (a INT DEFAULT(?));
|
||||
Got one of the listed errors
|
||||
CREATE TABLE t1 (a INT DEFAULT (b), b INT DEFAULT(a));
|
||||
ERROR 01000: Expression for field `a` is refering to uninitialized field `b`
|
||||
ERROR 01000: Expression for field `a` is referring to uninitialized field `b`
|
||||
CREATE TABLE t1 (a INT DEFAULT(NAME_CONST('xxx', 'yyy'));
|
||||
ERROR HY000: Function or expression 'name_const()' cannot be used in the DEFAULT clause of `a`
|
||||
CREATE TABLE t1 (a INT DEFAULT COUNT(*));
|
||||
@ -3369,7 +3369,7 @@ a b t
|
||||
4 5 5 the value of the DEFAULT(a), that is b
|
||||
drop table t1;
|
||||
create table t1 (col1 int default(-(default(col1))));
|
||||
ERROR 01000: Expression for field `col1` is refering to uninitialized field `col1`
|
||||
ERROR 01000: Expression for field `col1` is referring to uninitialized field `col1`
|
||||
create table t1 (col int default (yearweek((exp(710)))));
|
||||
ERROR 22003: DOUBLE value is out of range in 'exp(710)'
|
||||
#
|
||||
|
@ -255,9 +255,9 @@ a b c
|
||||
4 -4 -3
|
||||
drop table t1;
|
||||
create table t1 (a int, b int generated always as(-b) virtual, c int generated always as (b + 1) virtual);
|
||||
ERROR 01000: Expression for field `b` is refering to uninitialized field `b`
|
||||
ERROR 01000: Expression for field `b` is referring to uninitialized field `b`
|
||||
create table t1 (a int, b int generated always as(-c) virtual, c int generated always as (b + 1) virtual);
|
||||
ERROR 01000: Expression for field `b` is refering to uninitialized field `c`
|
||||
ERROR 01000: Expression for field `b` is referring to uninitialized field `c`
|
||||
create table t1 (pk int auto_increment primary key, col_int_nokey int generated always as (pk + col_int_key) stored, col_int_key int);
|
||||
ERROR HY000: Function or expression 'AUTO_INCREMENT' cannot be used in the GENERATED ALWAYS AS clause of `pk`
|
||||
# Bug#20339347: FAIL TO USE CREATE ....SELECT STATEMENT TO CREATE A NEW TABLE
|
||||
@ -277,7 +277,7 @@ drop table t1,tt;
|
||||
# THD->CHANGE_LIST.IS_EMPTY()
|
||||
#
|
||||
CREATE TABLE t1(a bigint AS (a between 1 and 1));
|
||||
ERROR 01000: Expression for field `a` is refering to uninitialized field `a`
|
||||
ERROR 01000: Expression for field `a` is referring to uninitialized field `a`
|
||||
# Bug#20757211: GENERATED COLUMNS: ALTER TABLE CRASHES
|
||||
# IN FIND_FIELD_IN_TABLE
|
||||
#
|
||||
|
@ -255,9 +255,9 @@ a b c
|
||||
4 -4 -3
|
||||
drop table t1;
|
||||
create table t1 (a int, b int generated always as(-b) virtual, c int generated always as (b + 1) virtual);
|
||||
ERROR 01000: Expression for field `b` is refering to uninitialized field `b`
|
||||
ERROR 01000: Expression for field `b` is referring to uninitialized field `b`
|
||||
create table t1 (a int, b int generated always as(-c) virtual, c int generated always as (b + 1) virtual);
|
||||
ERROR 01000: Expression for field `b` is refering to uninitialized field `c`
|
||||
ERROR 01000: Expression for field `b` is referring to uninitialized field `c`
|
||||
create table t1 (pk int auto_increment primary key, col_int_nokey int generated always as (pk + col_int_key) stored, col_int_key int);
|
||||
ERROR HY000: Function or expression 'AUTO_INCREMENT' cannot be used in the GENERATED ALWAYS AS clause of `pk`
|
||||
# Bug#20339347: FAIL TO USE CREATE ....SELECT STATEMENT TO CREATE A NEW TABLE
|
||||
@ -277,7 +277,7 @@ drop table t1,tt;
|
||||
# THD->CHANGE_LIST.IS_EMPTY()
|
||||
#
|
||||
CREATE TABLE t1(a bigint AS (a between 1 and 1));
|
||||
ERROR 01000: Expression for field `a` is refering to uninitialized field `a`
|
||||
ERROR 01000: Expression for field `a` is referring to uninitialized field `a`
|
||||
# Bug#20757211: GENERATED COLUMNS: ALTER TABLE CRASHES
|
||||
# IN FIND_FIELD_IN_TABLE
|
||||
#
|
||||
|
@ -316,7 +316,7 @@ drop table t1;
|
||||
# MDEV-5611: self-referencing virtual column
|
||||
#
|
||||
create table t1 (a int, b int as (b is null) virtual);
|
||||
ERROR 01000: Expression for field `b` is refering to uninitialized field `b`
|
||||
ERROR 01000: Expression for field `b` is referring to uninitialized field `b`
|
||||
create table t1 (a int as (1+1), b int as (a is null) virtual);
|
||||
drop table t1;
|
||||
# end of 5.3 tests
|
||||
|
@ -992,7 +992,7 @@ bool Item_field::register_field_in_write_map(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
Check that we are not refering to any not yet initialized fields
|
||||
Check that we are not referring to any not yet initialized fields
|
||||
|
||||
Fields are initialized in this order:
|
||||
- All fields that have default value as a constant are initialized first.
|
||||
|
@ -7623,7 +7623,7 @@ ER_ERROR_EVALUATING_EXPRESSION
|
||||
ER_CALCULATING_DEFAULT_VALUE
|
||||
eng "Got an error when calculating default value for %`s"
|
||||
ER_EXPRESSION_REFERS_TO_UNINIT_FIELD 01000
|
||||
eng "Expression for field %`-.64s is refering to uninitialized field %`s"
|
||||
eng "Expression for field %`-.64s is referring to uninitialized field %`s"
|
||||
ER_PARTITION_DEFAULT_ERROR
|
||||
eng "Only one DEFAULT partition allowed"
|
||||
ukr "Припустимо мати тільки один DEFAULT розділ"
|
||||
|
@ -1132,7 +1132,7 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
|
||||
if (check_constraint_ptr)
|
||||
*check_constraint_ptr= 0;
|
||||
|
||||
/* Check that expressions aren't refering to not yet initialized fields */
|
||||
/* Check that expressions aren't referring to not yet initialized fields */
|
||||
for (field_ptr= table->field; *field_ptr; field_ptr++)
|
||||
{
|
||||
Field *field= *field_ptr;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2012, Facebook Inc.
|
||||
Copyright (c) 2014, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2014, 2019, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@ -378,8 +378,7 @@ btr_root_adjust_on_import(
|
||||
page = buf_block_get_frame(block);
|
||||
page_zip = buf_block_get_page_zip(block);
|
||||
|
||||
if (!page_is_root(page)) {
|
||||
|
||||
if (!fil_page_index_page_check(page) || page_has_siblings(page)) {
|
||||
err = DB_CORRUPTION;
|
||||
|
||||
} else if (dict_index_is_clust(index)) {
|
||||
@ -1161,11 +1160,11 @@ btr_free_root_check(
|
||||
buf_block_dbg_add_level(block, SYNC_TREE_NODE);
|
||||
|
||||
if (fil_page_index_page_check(block->frame)
|
||||
&& index_id == btr_page_get_index_id(block->frame)) {
|
||||
&& index_id == btr_page_get_index_id(block->frame)) {
|
||||
/* This should be a root page.
|
||||
It should not be possible to reassign the same
|
||||
index_id for some other index in the tablespace. */
|
||||
ut_ad(page_is_root(block->frame));
|
||||
ut_ad(!page_has_siblings(block->frame));
|
||||
} else {
|
||||
block = NULL;
|
||||
}
|
||||
@ -1356,7 +1355,8 @@ btr_free_but_not_root(
|
||||
ibool finished;
|
||||
mtr_t mtr;
|
||||
|
||||
ut_ad(page_is_root(block->frame));
|
||||
ut_ad(fil_page_index_page_check(block->frame));
|
||||
ut_ad(!page_has_siblings(block->frame));
|
||||
leaf_loop:
|
||||
mtr_start(&mtr);
|
||||
mtr_set_log_mode(&mtr, log_mode);
|
||||
@ -1427,7 +1427,6 @@ btr_free_if_exists(
|
||||
return;
|
||||
}
|
||||
|
||||
ut_ad(page_is_root(root->frame));
|
||||
btr_free_but_not_root(root, mtr->get_log_mode());
|
||||
mtr->set_named_space_id(page_id.space());
|
||||
btr_free_root(root, mtr);
|
||||
@ -1450,8 +1449,6 @@ btr_free(
|
||||
page_id, page_size, RW_X_LATCH, &mtr);
|
||||
|
||||
if (block) {
|
||||
ut_ad(page_is_root(block->frame));
|
||||
|
||||
btr_free_but_not_root(block, MTR_LOG_NO_REDO);
|
||||
btr_free_root(block, &mtr);
|
||||
}
|
||||
@ -1598,12 +1595,17 @@ btr_page_reorganize_low(
|
||||
|
||||
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
|
||||
btr_assert_not_corrupted(block, index);
|
||||
ut_ad(fil_page_index_page_check(block->frame));
|
||||
ut_ad(index->is_dummy
|
||||
|| block->page.id.space() == index->table->space->id);
|
||||
ut_ad(index->is_dummy
|
||||
|| block->page.id.page_no() != index->page
|
||||
|| !page_has_siblings(page));
|
||||
#ifdef UNIV_ZIP_DEBUG
|
||||
ut_a(!page_zip || page_zip_validate(page_zip, page, index));
|
||||
#endif /* UNIV_ZIP_DEBUG */
|
||||
data_size1 = page_get_data_size(page);
|
||||
max_ins_size1 = page_get_max_insert_size_after_reorganize(page, 1);
|
||||
|
||||
/* Turn logging off */
|
||||
mtr_log_t log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE);
|
||||
|
||||
@ -1661,7 +1663,7 @@ btr_page_reorganize_low(
|
||||
|| page_get_max_trx_id(page) == 0
|
||||
|| (dict_index_is_sec_or_ibuf(index)
|
||||
? page_is_leaf(temp_page)
|
||||
: page_is_root(temp_page)));
|
||||
: block->page.id.page_no() == index->page));
|
||||
|
||||
/* If innodb_log_compressed_pages is ON, page reorganize should log the
|
||||
compressed page image.*/
|
||||
@ -1731,7 +1733,7 @@ func_exit:
|
||||
ut_a(!page_zip || page_zip_validate(page_zip, page, index));
|
||||
#endif /* UNIV_ZIP_DEBUG */
|
||||
|
||||
if (!recovery && page_is_root(temp_page)
|
||||
if (!recovery && block->page.id.page_no() == index->page
|
||||
&& fil_page_get_type(temp_page) == FIL_PAGE_TYPE_INSTANT) {
|
||||
/* Preserve the PAGE_INSTANT information. */
|
||||
ut_ad(!page_zip);
|
||||
@ -1904,6 +1906,8 @@ btr_page_empty(
|
||||
|
||||
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
|
||||
ut_ad(page_zip == buf_block_get_page_zip(block));
|
||||
ut_ad(!index->is_dummy);
|
||||
ut_ad(index->table->space->id == block->page.id.space());
|
||||
#ifdef UNIV_ZIP_DEBUG
|
||||
ut_a(!page_zip || page_zip_validate(page_zip, page, index));
|
||||
#endif /* UNIV_ZIP_DEBUG */
|
||||
@ -1916,7 +1920,8 @@ btr_page_empty(
|
||||
/* Preserve PAGE_ROOT_AUTO_INC when creating a clustered index
|
||||
root page. */
|
||||
const ib_uint64_t autoinc
|
||||
= dict_index_is_clust(index) && page_is_root(page)
|
||||
= dict_index_is_clust(index)
|
||||
&& index->page == block->page.id.page_no()
|
||||
? page_get_autoinc(page)
|
||||
: 0;
|
||||
|
||||
@ -4233,6 +4238,8 @@ btr_discard_only_page_on_level(
|
||||
ulint page_level = 0;
|
||||
trx_id_t max_trx_id;
|
||||
|
||||
ut_ad(!index->is_dummy);
|
||||
|
||||
/* Save the PAGE_MAX_TRX_ID from the leaf page. */
|
||||
max_trx_id = page_get_max_trx_id(buf_block_get_frame(block));
|
||||
|
||||
@ -4244,7 +4251,8 @@ btr_discard_only_page_on_level(
|
||||
ut_a(page_get_n_recs(page) == 1);
|
||||
ut_a(page_level == btr_page_get_level(page));
|
||||
ut_a(!page_has_siblings(page));
|
||||
|
||||
ut_ad(fil_page_index_page_check(page));
|
||||
ut_ad(block->page.id.space() == index->table->space->id);
|
||||
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
|
||||
btr_search_drop_page_hash_index(block);
|
||||
|
||||
@ -4271,7 +4279,7 @@ btr_discard_only_page_on_level(
|
||||
|
||||
/* block is the root page, which must be empty, except
|
||||
for the node pointer to the (now discarded) block(s). */
|
||||
ut_ad(page_is_root(block->frame));
|
||||
ut_ad(!page_has_siblings(block->frame));
|
||||
|
||||
#ifdef UNIV_BTR_DEBUG
|
||||
if (!dict_index_is_ibuf(index)) {
|
||||
|
@ -3,7 +3,7 @@
|
||||
Copyright (c) 1994, 2018, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2008, Google Inc.
|
||||
Copyright (c) 2012, Facebook Inc.
|
||||
Copyright (c) 2015, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2015, 2019, MariaDB Corporation.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted by
|
||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||
@ -557,7 +557,11 @@ index root page.
|
||||
@return whether the page is corrupted */
|
||||
bool btr_cur_instant_root_init(dict_index_t* index, const page_t* page)
|
||||
{
|
||||
ut_ad(page_is_root(page));
|
||||
ut_ad(!index->is_dummy);
|
||||
ut_ad(fil_page_index_page_check(page));
|
||||
ut_ad(!page_has_siblings(page));
|
||||
ut_ad(page_get_space_id(page) == index->table->space_id);
|
||||
ut_ad(page_get_page_no(page) == index->page);
|
||||
ut_ad(!page_is_comp(page) == !dict_table_is_comp(index->table));
|
||||
ut_ad(index->is_primary());
|
||||
ut_ad(!index->is_instant());
|
||||
@ -5441,14 +5445,14 @@ btr_cur_optimistic_delete_func(
|
||||
ut_ad(flags == 0 || flags == BTR_CREATE_FLAG);
|
||||
ut_ad(mtr_memo_contains(mtr, btr_cur_get_block(cursor),
|
||||
MTR_MEMO_PAGE_X_FIX));
|
||||
ut_ad(mtr_memo_contains(mtr, btr_cur_get_block(cursor),
|
||||
MTR_MEMO_PAGE_X_FIX));
|
||||
ut_ad(mtr->is_named_space(cursor->index->table->space));
|
||||
ut_ad(!cursor->index->is_dummy);
|
||||
|
||||
/* This is intended only for leaf page deletions */
|
||||
|
||||
block = btr_cur_get_block(cursor);
|
||||
|
||||
ut_ad(block->page.id.space() == cursor->index->table->space->id);
|
||||
ut_ad(page_is_leaf(buf_block_get_frame(block)));
|
||||
ut_ad(!dict_index_is_online_ddl(cursor->index)
|
||||
|| dict_index_is_clust(cursor->index)
|
||||
@ -5456,7 +5460,7 @@ btr_cur_optimistic_delete_func(
|
||||
|
||||
rec = btr_cur_get_rec(cursor);
|
||||
|
||||
if (UNIV_UNLIKELY(page_is_root(block->frame)
|
||||
if (UNIV_UNLIKELY(block->page.id.page_no() == cursor->index->page
|
||||
&& page_get_n_recs(block->frame) == 1
|
||||
+ (cursor->index->is_instant()
|
||||
&& !rec_is_metadata(rec, cursor->index)))) {
|
||||
@ -5635,6 +5639,8 @@ btr_cur_pessimistic_delete(
|
||||
| MTR_MEMO_SX_LOCK));
|
||||
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
|
||||
ut_ad(mtr->is_named_space(index->table->space));
|
||||
ut_ad(!index->is_dummy);
|
||||
ut_ad(block->page.id.space() == index->table->space->id);
|
||||
|
||||
if (!has_reserved_extents) {
|
||||
/* First reserve enough free space for the file segments
|
||||
@ -5688,7 +5694,7 @@ btr_cur_pessimistic_delete(
|
||||
lock_update_delete(block, rec);
|
||||
}
|
||||
|
||||
if (!page_is_root(page)) {
|
||||
if (block->page.id.page_no() != index->page) {
|
||||
if (page_get_n_recs(page) < 2) {
|
||||
goto discard_page;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (C) 2013, 2014 Facebook, Inc. All Rights Reserved.
|
||||
Copyright (C) 2014, 2018, MariaDB Corporation.
|
||||
Copyright (C) 2014, 2019, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@ -181,7 +181,8 @@ btr_defragment_add_index(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ut_ad(page_is_root(page));
|
||||
ut_ad(fil_page_index_page_check(page));
|
||||
ut_ad(!page_has_siblings(page));
|
||||
|
||||
if (page_is_leaf(page)) {
|
||||
// Index root is a leaf page, no need to defragment.
|
||||
|
@ -100,7 +100,6 @@ btr_pcur_store_position(
|
||||
buf_block_t* block;
|
||||
rec_t* rec;
|
||||
dict_index_t* index;
|
||||
page_t* page;
|
||||
ulint offs;
|
||||
|
||||
ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
|
||||
@ -112,9 +111,8 @@ btr_pcur_store_position(
|
||||
page_cursor = btr_pcur_get_page_cur(cursor);
|
||||
|
||||
rec = page_cur_get_rec(page_cursor);
|
||||
page = page_align(rec);
|
||||
offs = page_offset(rec);
|
||||
|
||||
offs = rec - block->frame;
|
||||
ut_ad(block->page.id.page_no() == page_get_page_no(block->frame));
|
||||
ut_ad(block->page.buf_fix_count);
|
||||
/* For spatial index, when we do positioning on parent
|
||||
buffer if necessary, it might not hold latches, but the
|
||||
@ -129,14 +127,14 @@ btr_pcur_store_position(
|
||||
|
||||
cursor->old_stored = true;
|
||||
|
||||
if (page_is_empty(page)) {
|
||||
if (page_is_empty(block->frame)) {
|
||||
/* It must be an empty index tree; NOTE that in this case
|
||||
we do not store the modify_clock, but always do a search
|
||||
if we restore the cursor position */
|
||||
|
||||
ut_a(!page_has_siblings(page));
|
||||
ut_ad(page_is_leaf(page));
|
||||
ut_ad(page_get_page_no(page) == index->page);
|
||||
ut_a(!page_has_siblings(block->frame));
|
||||
ut_ad(page_is_leaf(block->frame));
|
||||
ut_ad(block->page.id.page_no() == index->page);
|
||||
|
||||
if (page_rec_is_supremum_low(offs)) {
|
||||
cursor->rel_pos = BTR_PCUR_AFTER_LAST_IN_TREE;
|
||||
@ -159,10 +157,10 @@ before_first:
|
||||
rec = page_rec_get_next(rec);
|
||||
|
||||
if (rec_is_metadata(rec, index)) {
|
||||
ut_ad(!page_has_prev(page));
|
||||
ut_ad(!page_has_prev(block->frame));
|
||||
rec = page_rec_get_next(rec);
|
||||
if (page_rec_is_supremum(rec)) {
|
||||
ut_ad(page_has_next(page));
|
||||
ut_ad(page_has_next(block->frame));
|
||||
goto before_first;
|
||||
}
|
||||
}
|
||||
|
@ -251,12 +251,6 @@ void set_my_errno(int err)
|
||||
errno = err;
|
||||
}
|
||||
|
||||
static uint omits_virtual_cols(const TABLE_SHARE &share)
|
||||
{
|
||||
return share.frm_version < FRM_VER_EXPRESSSIONS &&
|
||||
share.virtual_fields;
|
||||
}
|
||||
|
||||
/** Checks whether the file name belongs to a partition of a table.
|
||||
@param[in] file_name file name
|
||||
@return pointer to the end of the table name part of the file name, or NULL */
|
||||
@ -7302,7 +7296,8 @@ build_template_needs_field(
|
||||
{
|
||||
const Field* field = table->field[i];
|
||||
|
||||
if (!field->stored_in_db() && omits_virtual_cols(*table->s)) {
|
||||
if (!field->stored_in_db()
|
||||
&& ha_innobase::omits_virtual_cols(*table->s)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -7459,7 +7454,7 @@ build_template_field(
|
||||
&templ->rec_prefix_field_no);
|
||||
}
|
||||
} else {
|
||||
ut_ad(!omits_virtual_cols(*table->s));
|
||||
DBUG_ASSERT(!ha_innobase::omits_virtual_cols(*table->s));
|
||||
col = &dict_table_get_nth_v_col(index->table, v_no)->m_col;
|
||||
templ->clust_rec_field_no = v_no;
|
||||
templ->rec_prefix_field_no = ULINT_UNDEFINED;
|
||||
@ -7848,7 +7843,8 @@ no_icp:
|
||||
contain = dict_index_contains_col_or_prefix(
|
||||
index, i - num_v,
|
||||
false);
|
||||
} else if (dict_index_is_clust(index)) {
|
||||
} else if (skip_virtual
|
||||
|| dict_index_is_clust(index)) {
|
||||
num_v++;
|
||||
continue;
|
||||
} else {
|
||||
@ -8345,7 +8341,7 @@ calc_row_difference(
|
||||
trx_t* const trx = prebuilt->trx;
|
||||
doc_id_t doc_id = FTS_NULL_DOC_ID;
|
||||
ulint num_v = 0;
|
||||
const bool skip_virtual = omits_virtual_cols(*table->s);
|
||||
const bool skip_virtual = ha_innobase::omits_virtual_cols(*table->s);
|
||||
|
||||
ut_ad(!srv_read_only_mode);
|
||||
|
||||
@ -10899,7 +10895,7 @@ create_table_info_t::create_table_def()
|
||||
|
||||
/* Find out the number of virtual columns. */
|
||||
ulint num_v = 0;
|
||||
const bool omit_virtual = omits_virtual_cols(*m_form->s);
|
||||
const bool omit_virtual = ha_innobase::omits_virtual_cols(*m_form->s);
|
||||
const ulint n_cols = omit_virtual
|
||||
? m_form->s->stored_fields : m_form->s->fields;
|
||||
|
||||
|
@ -22,6 +22,8 @@ this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# include "../../../wsrep/wsrep_api.h"
|
||||
#endif /* WITH_WSREP */
|
||||
|
||||
#include "table.h"
|
||||
|
||||
/* The InnoDB handler: the interface between MySQL and InnoDB. */
|
||||
|
||||
/** "GEN_CLUST_INDEX" is the name reserved for InnoDB default
|
||||
@ -422,8 +424,15 @@ public:
|
||||
Item* idx_cond_push(uint keyno, Item* idx_cond);
|
||||
/* @} */
|
||||
|
||||
protected:
|
||||
/** Check if InnoDB is not storing virtual column metadata for a table.
|
||||
@param s table definition (based on .frm file)
|
||||
@return whether InnoDB will omit virtual column metadata */
|
||||
static bool omits_virtual_cols(const TABLE_SHARE& s)
|
||||
{
|
||||
return s.frm_version<FRM_VER_EXPRESSSIONS && s.virtual_fields;
|
||||
}
|
||||
|
||||
protected:
|
||||
/**
|
||||
MySQL calls this method at the end of each statement. This method
|
||||
exists for readability only, called from reset(). The name reset()
|
||||
@ -440,7 +449,6 @@ protected:
|
||||
@see build_template() */
|
||||
void reset_template();
|
||||
|
||||
protected:
|
||||
inline void update_thd(THD* thd);
|
||||
void update_thd();
|
||||
|
||||
|
@ -3294,7 +3294,8 @@ innobase_build_col_map(
|
||||
>= altered_table->s->fields + DATA_N_SYS_COLS);
|
||||
DBUG_ASSERT(dict_table_get_n_cols(old_table)
|
||||
+ dict_table_get_n_v_cols(old_table)
|
||||
>= table->s->fields + DATA_N_SYS_COLS);
|
||||
>= table->s->fields + DATA_N_SYS_COLS
|
||||
|| ha_innobase::omits_virtual_cols(*table->s));
|
||||
DBUG_ASSERT(!!defaults == !!(ha_alter_info->handler_flags
|
||||
& INNOBASE_DEFAULTS));
|
||||
DBUG_ASSERT(!defaults || dtuple_get_n_fields(defaults)
|
||||
@ -4428,7 +4429,9 @@ innobase_add_instant_try(
|
||||
} else if (page_rec_is_supremum(rec)) {
|
||||
empty_table:
|
||||
/* The table is empty. */
|
||||
ut_ad(page_is_root(block->frame));
|
||||
ut_ad(fil_page_index_page_check(block->frame));
|
||||
ut_ad(!page_has_siblings(block->frame));
|
||||
ut_ad(block->page.id.page_no() == index->page);
|
||||
btr_page_empty(block, NULL, index, 0, &mtr);
|
||||
index->remove_instant();
|
||||
err = DB_SUCCESS;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2013, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2013, 2019, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@ -732,9 +732,7 @@ page_rec_get_heap_no(
|
||||
/** Determine whether a page has any siblings.
|
||||
@param[in] page page frame
|
||||
@return true if the page has any siblings */
|
||||
inline
|
||||
bool
|
||||
page_has_siblings(const page_t* page)
|
||||
inline bool page_has_siblings(const page_t* page)
|
||||
{
|
||||
compile_time_assert(!(FIL_PAGE_PREV % 8));
|
||||
compile_time_assert(FIL_PAGE_NEXT == FIL_PAGE_PREV + 4);
|
||||
@ -743,22 +741,10 @@ page_has_siblings(const page_t* page)
|
||||
!= ~uint64_t(0);
|
||||
}
|
||||
|
||||
/** Determine whether a page is an index root page.
|
||||
@param[in] page page frame
|
||||
@return true if the page is a root page of an index */
|
||||
inline
|
||||
bool
|
||||
page_is_root(const page_t* page)
|
||||
{
|
||||
return fil_page_index_page_check(page) && !page_has_siblings(page);
|
||||
}
|
||||
|
||||
/** Determine whether a page has a predecessor.
|
||||
@param[in] page page frame
|
||||
@return true if the page has a predecessor */
|
||||
inline
|
||||
bool
|
||||
page_has_prev(const page_t* page)
|
||||
inline bool page_has_prev(const page_t* page)
|
||||
{
|
||||
return *reinterpret_cast<const uint32_t*>(page + FIL_PAGE_PREV)
|
||||
!= FIL_NULL;
|
||||
@ -767,9 +753,7 @@ page_has_prev(const page_t* page)
|
||||
/** Determine whether a page has a successor.
|
||||
@param[in] page page frame
|
||||
@return true if the page has a successor */
|
||||
inline
|
||||
bool
|
||||
page_has_next(const page_t* page)
|
||||
inline bool page_has_next(const page_t* page)
|
||||
{
|
||||
return *reinterpret_cast<const uint32_t*>(page + FIL_PAGE_NEXT)
|
||||
!= FIL_NULL;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2016, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2016, 2019, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@ -91,7 +91,8 @@ UNIV_INLINE
|
||||
ib_uint64_t
|
||||
page_get_autoinc(const page_t* page)
|
||||
{
|
||||
ut_ad(page_is_root(page));
|
||||
ut_ad(fil_page_index_page_check(page));
|
||||
ut_ad(!page_has_siblings(page));
|
||||
return(mach_read_from_8(PAGE_HEADER + PAGE_ROOT_AUTO_INC + page));
|
||||
}
|
||||
|
||||
@ -172,6 +173,7 @@ page_header_set_field(
|
||||
{
|
||||
ut_ad(page);
|
||||
ut_ad(field <= PAGE_N_RECS);
|
||||
ut_ad(field != PAGE_N_RECS || val);
|
||||
ut_ad(field == PAGE_N_HEAP || val < srv_page_size);
|
||||
ut_ad(field != PAGE_N_HEAP || (val & 0x7fff) < srv_page_size);
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2012, Facebook Inc.
|
||||
Copyright (c) 2018, MariaDB Corporation.
|
||||
Copyright (c) 2018, 2019, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@ -1988,12 +1988,14 @@ page_parse_copy_rec_list_to_created_page(
|
||||
return(rec_end);
|
||||
}
|
||||
|
||||
ut_ad(fil_page_index_page_check(block->frame));
|
||||
/* This function is never invoked on the clustered index root page,
|
||||
except in the redo log apply of
|
||||
page_copy_rec_list_end_to_created_page() which was logged by.
|
||||
page_copy_rec_list_to_created_page_write_log().
|
||||
For other pages, this field must be zero-initialized. */
|
||||
ut_ad(!page_get_instant(block->frame) || page_is_root(block->frame));
|
||||
ut_ad(!page_get_instant(block->frame)
|
||||
|| !page_has_siblings(block->frame));
|
||||
|
||||
while (ptr < rec_end) {
|
||||
ptr = page_cur_parse_insert_rec(TRUE, ptr, end_ptr,
|
||||
@ -2049,9 +2051,10 @@ page_copy_rec_list_end_to_created_page(
|
||||
ut_ad(page_dir_get_n_heap(new_page) == PAGE_HEAP_NO_USER_LOW);
|
||||
ut_ad(page_align(rec) != new_page);
|
||||
ut_ad(page_rec_is_comp(rec) == page_is_comp(new_page));
|
||||
ut_ad(fil_page_index_page_check(new_page));
|
||||
/* This function is never invoked on the clustered index root page,
|
||||
except in btr_lift_page_up(). */
|
||||
ut_ad(!page_get_instant(new_page) || page_is_root(new_page));
|
||||
ut_ad(!page_get_instant(new_page) || !page_has_siblings(new_page));
|
||||
|
||||
if (page_rec_is_infimum(rec)) {
|
||||
|
||||
@ -2144,6 +2147,8 @@ page_copy_rec_list_end_to_created_page(
|
||||
rec = page_rec_get_next(rec);
|
||||
} while (!page_rec_is_supremum(rec));
|
||||
|
||||
ut_ad(n_recs);
|
||||
|
||||
if ((slot_index > 0) && (count + 1
|
||||
+ (PAGE_DIR_SLOT_MAX_N_OWNED + 1) / 2
|
||||
<= PAGE_DIR_SLOT_MAX_N_OWNED)) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2012, Facebook Inc.
|
||||
Copyright (c) 2017, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2019, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@ -525,6 +525,8 @@ page_create_empty(
|
||||
page_zip_des_t* page_zip= buf_block_get_page_zip(block);
|
||||
|
||||
ut_ad(fil_page_index_page_check(page));
|
||||
ut_ad(!index->is_dummy);
|
||||
ut_ad(block->page.id.space() == index->table->space->id);
|
||||
|
||||
/* Multiple transactions cannot simultaneously operate on the
|
||||
same temp-table in parallel.
|
||||
@ -535,7 +537,7 @@ page_create_empty(
|
||||
&& page_is_leaf(page)) {
|
||||
max_trx_id = page_get_max_trx_id(page);
|
||||
ut_ad(max_trx_id);
|
||||
} else if (page_is_root(page)) {
|
||||
} else if (block->page.id.page_no() == index->page) {
|
||||
/* Preserve PAGE_ROOT_AUTO_INC. */
|
||||
max_trx_id = page_get_max_trx_id(page);
|
||||
} else {
|
||||
@ -1231,6 +1233,7 @@ delete_all:
|
||||
page_header_set_field(page, NULL, PAGE_GARBAGE, size
|
||||
+ page_header_get_field(page, PAGE_GARBAGE));
|
||||
|
||||
ut_ad(page_get_n_recs(page) > n_recs);
|
||||
page_header_set_field(page, NULL, PAGE_N_RECS,
|
||||
(ulint)(page_get_n_recs(page) - n_recs));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2012, Facebook Inc.
|
||||
Copyright (c) 2014, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2014, 2019, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@ -4524,10 +4524,12 @@ page_zip_dir_delete(
|
||||
slot_rec = page_zip_dir_find(page_zip, page_offset(rec));
|
||||
|
||||
ut_a(slot_rec);
|
||||
|
||||
uint16_t n_recs = page_get_n_recs(page);
|
||||
ut_ad(n_recs);
|
||||
ut_ad(n_recs > 1 || page_get_page_no(page) == index->page);
|
||||
/* This could not be done before page_zip_dir_find(). */
|
||||
page_header_set_field(page, page_zip, PAGE_N_RECS,
|
||||
(ulint)(page_get_n_recs(page) - 1));
|
||||
n_recs - 1);
|
||||
|
||||
if (UNIV_UNLIKELY(!free)) {
|
||||
/* Make the last slot the start of the free list. */
|
||||
@ -4801,7 +4803,7 @@ page_zip_reorganize(
|
||||
clustered index root pages. */
|
||||
ut_ad(page_get_max_trx_id(page) == 0
|
||||
|| (dict_index_is_clust(index)
|
||||
? page_is_root(temp_page)
|
||||
? !page_has_siblings(temp_page)
|
||||
: page_is_leaf(temp_page)));
|
||||
|
||||
/* Restore logging. */
|
||||
|
@ -661,7 +661,7 @@ dberr_t FetchIndexRootPages::operator()(buf_block_t* block) UNIV_NOTHROW
|
||||
return set_current_xdes(block->page.id.page_no(), page);
|
||||
} else if (fil_page_index_page_check(page)
|
||||
&& !is_free(block->page.id.page_no())
|
||||
&& page_is_root(page)) {
|
||||
&& !page_has_siblings(page)) {
|
||||
|
||||
index_id_t id = btr_page_get_index_id(page);
|
||||
|
||||
@ -1819,9 +1819,9 @@ PageConverter::update_index_page(
|
||||
page, m_page_zip_ptr, m_index->m_srv_index->id, 0);
|
||||
|
||||
if (dict_index_is_clust(m_index->m_srv_index)) {
|
||||
if (page_is_root(page)) {
|
||||
dict_index_t* index = const_cast<dict_index_t*>(
|
||||
m_index->m_srv_index);
|
||||
dict_index_t* index = const_cast<dict_index_t*>(
|
||||
m_index->m_srv_index);
|
||||
if (block->page.id.page_no() == index->page) {
|
||||
/* Preserve the PAGE_ROOT_AUTO_INC. */
|
||||
if (index->table->supports_instant()) {
|
||||
if (btr_cur_instant_root_init(index, page)) {
|
||||
@ -1855,7 +1855,7 @@ PageConverter::update_index_page(
|
||||
if (page_is_empty(page)) {
|
||||
|
||||
/* Only a root page can be empty. */
|
||||
if (!page_is_root(page)) {
|
||||
if (page_has_siblings(page)) {
|
||||
// TODO: We should relax this and skip secondary
|
||||
// indexes. Mark them as corrupt because they can
|
||||
// always be rebuilt.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2011, 2018, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2019, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@ -963,7 +963,8 @@ row_log_table_low(
|
||||
break;
|
||||
case FIL_PAGE_TYPE_INSTANT:
|
||||
ut_ad(index->is_instant());
|
||||
ut_ad(page_is_root(page_align(rec)));
|
||||
ut_ad(!page_has_siblings(page_align(rec)));
|
||||
ut_ad(page_get_page_no(page_align(rec)) == index->page);
|
||||
break;
|
||||
default:
|
||||
ut_ad(!"wrong page type");
|
||||
|
Loading…
x
Reference in New Issue
Block a user