Merge 10.3 into 10.4

This commit is contained in:
Marko Mäkelä 2019-03-25 17:18:15 +02:00
commit 8b480df63e
45 changed files with 347 additions and 347 deletions

View File

@ -25,7 +25,8 @@ ENDIF()
MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}") 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. # Use a default manufacturer if no manufacturer was identified.
IF(NOT DEFINED MANUFACTURER) IF(NOT DEFINED MANUFACTURER)

View File

@ -50,7 +50,11 @@ endif()
# load the original CPackRPM.cmake # load the original CPackRPM.cmake
set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
unset(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}) set(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH})
restore(LICENSE) restore(LICENSE)

View File

@ -1,5 +1,5 @@
# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2018, MariaDB Corporation # Copyright (c) 2011, 2019, MariaDB Corporation.
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -87,6 +87,7 @@ IF(FEATURE_SET)
ENDIF() ENDIF()
SET(WITH_INNODB_SNAPPY OFF CACHE STRING "") SET(WITH_INNODB_SNAPPY OFF CACHE STRING "")
SET(WITH_NUMA 0 CACHE BOOL "")
IF(WIN32) IF(WIN32)
SET(INSTALL_MYSQLTESTDIR "" CACHE STRING "") SET(INSTALL_MYSQLTESTDIR "" CACHE STRING "")
SET(INSTALL_SQLBENCHDIR "" CACHE STRING "") SET(INSTALL_SQLBENCHDIR "" CACHE STRING "")
@ -96,20 +97,17 @@ ELSEIF(RPM)
SET(WITH_ZLIB system CACHE STRING "") SET(WITH_ZLIB system CACHE STRING "")
SET(CHECKMODULE /usr/bin/checkmodule CACHE STRING "") SET(CHECKMODULE /usr/bin/checkmodule CACHE STRING "")
SET(SEMODULE_PACKAGE /usr/bin/semodule_package CACHE STRING "") SET(SEMODULE_PACKAGE /usr/bin/semodule_package CACHE STRING "")
SET(WITH_LIBARCHIVE ON CACHE STRING "")
SET(PLUGIN_AUTH_SOCKET YES CACHE STRING "") SET(PLUGIN_AUTH_SOCKET YES CACHE STRING "")
ELSEIF(DEB) ELSEIF(DEB)
SET(WITH_SSL system CACHE STRING "") SET(WITH_SSL system CACHE STRING "")
SET(WITH_ZLIB system CACHE STRING "") SET(WITH_ZLIB system CACHE STRING "")
SET(WITH_LIBWRAP ON) SET(WITH_LIBWRAP ON)
SET(HAVE_EMBEDDED_PRIVILEGE_CONTROL ON) SET(HAVE_EMBEDDED_PRIVILEGE_CONTROL ON)
SET(WITH_LIBARCHIVE ON CACHE STRING "")
SET(PLUGIN_AUTH_SOCKET YES CACHE STRING "") SET(PLUGIN_AUTH_SOCKET YES CACHE STRING "")
ELSE() ELSE()
SET(WITH_SSL bundled CACHE STRING "") SET(WITH_SSL bundled CACHE STRING "")
SET(WITH_ZLIB bundled CACHE STRING "") SET(WITH_ZLIB bundled CACHE STRING "")
SET(WITH_JEMALLOC static CACHE STRING "") SET(WITH_JEMALLOC static CACHE STRING "")
SET(WITH_LIBARCHIVE STATIC CACHE STRING "")
SET(PLUGIN_AUTH_SOCKET STATIC CACHE STRING "") SET(PLUGIN_AUTH_SOCKET STATIC CACHE STRING "")
ENDIF() ENDIF()

View File

@ -0,0 +1,20 @@
CREATE TABLE t1 (a INT);
CREATE INDEX t1a ON t1 (a);
DROP INDEX t1a ON t1;
DROP TABLE t1;
CREATE TABLE t2 (a INT);
ALTER TABLE t2 RENAME t2;
RENAME TABLE t2 TO t3;
DROP TABLE t3;
CREATE TABLE t4 (a INT);
PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t4;
CREATE SEQUENCE s4;
ALTER SEQUENCE s4 MAXVALUE 100;
PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP SEQUENCE s4;

View File

@ -434,7 +434,7 @@ drop table t1;
# #
create table t1 (a int); create table t1 (a int);
create or replace table t1 (a int default b, b int default a); 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; show create table t1;
ERROR 42S02: Table 'test.t1' doesn't exist 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 as (a));
create or replace table t1 (a int not null, b int default (a+1)); create or replace table t1 (a int not null, b int default (a+1));
create or replace table t1 (a int default a); 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 b, b int default (1+1));
create or replace table t1 (a int default 1, b int as (c), c int as (a+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))); 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))); 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); 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 # Allow defaults to refer to not default fields
# #
@ -519,7 +519,7 @@ Got one of the listed errors
CREATE TABLE t1 (a INT DEFAULT(?)); CREATE TABLE t1 (a INT DEFAULT(?));
Got one of the listed errors Got one of the listed errors
CREATE TABLE t1 (a INT DEFAULT (b), b INT DEFAULT(a)); 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')); 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` ERROR HY000: Function or expression 'name_const()' cannot be used in the DEFAULT clause of `a`
CREATE TABLE t1 (a INT DEFAULT COUNT(*)); 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 4 5 5 the value of the DEFAULT(a), that is b
drop table t1; drop table t1;
create table t1 (col1 int default(-(default(col1)))); 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))))); create table t1 (col int default (yearweek((exp(710)))));
ERROR 22003: DOUBLE value is out of range in 'exp(710)' ERROR 22003: DOUBLE value is out of range in 'exp(710)'
# #

View File

@ -25,7 +25,7 @@ $$
# #
# Expect all admin statements in the slow log (ON,DEFAULT) # Expect all admin statements in the slow log (ON,DEFAULT)
# #
SET @@GLOBAL.log_slow_admin_statements=ON; SET @@SESSION.log_slow_admin_statements=ON;
SET log_slow_filter=DEFAULT; SET log_slow_filter=DEFAULT;
TRUNCATE TABLE mysql.slow_log; TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
@ -41,7 +41,13 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt; EXECUTE stmt;
DEALLOCATE PREPARE stmt; DEALLOCATE PREPARE stmt;
DROP TABLE t4; DROP TABLE t4;
CALL show_slow_log_exclude_ps(); CREATE SEQUENCE s4;
ALTER SEQUENCE s4 MAXVALUE 100;
PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP SEQUENCE s4;
CALL show_slow_log();
sql_text sql_text
[slow] TRUNCATE TABLE mysql.slow_log [slow] TRUNCATE TABLE mysql.slow_log
[slow] CREATE TABLE t1 (a INT) [slow] CREATE TABLE t1 (a INT)
@ -57,10 +63,16 @@ sql_text
[slow] ALTER TABLE t4 MODIFY a INT DEFAULT 1 [slow] ALTER TABLE t4 MODIFY a INT DEFAULT 1
[slow] DEALLOCATE PREPARE stmt [slow] DEALLOCATE PREPARE stmt
[slow] DROP TABLE t4 [slow] DROP TABLE t4
[slow] CREATE SEQUENCE s4
[slow] ALTER SEQUENCE s4 MAXVALUE 100
[slow] PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101'
[slow] ALTER SEQUENCE s4 MAXVALUE=101
[slow] DEALLOCATE PREPARE stmt
[slow] DROP SEQUENCE s4
# #
# Expect all admin statements in the slow log (ON,admin) # Expect all admin statements in the slow log (ON,admin)
# #
SET @@GLOBAL.log_slow_admin_statements=ON; SET @@SESSION.log_slow_admin_statements=ON;
SET log_slow_filter=admin; SET log_slow_filter=admin;
TRUNCATE TABLE mysql.slow_log; TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
@ -76,6 +88,12 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt; EXECUTE stmt;
DEALLOCATE PREPARE stmt; DEALLOCATE PREPARE stmt;
DROP TABLE t4; DROP TABLE t4;
CREATE SEQUENCE s4;
ALTER SEQUENCE s4 MAXVALUE 100;
PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP SEQUENCE s4;
CALL show_slow_log(); CALL show_slow_log();
sql_text sql_text
[slow] CREATE INDEX t1a ON t1 (a) [slow] CREATE INDEX t1a ON t1 (a)
@ -83,10 +101,12 @@ sql_text
[slow] ALTER TABLE t2 RENAME t2 [slow] ALTER TABLE t2 RENAME t2
[slow] RENAME TABLE t2 TO t3 [slow] RENAME TABLE t2 TO t3
[slow] ALTER TABLE t4 MODIFY a INT DEFAULT 1 [slow] ALTER TABLE t4 MODIFY a INT DEFAULT 1
[slow] ALTER SEQUENCE s4 MAXVALUE 100
[slow] ALTER SEQUENCE s4 MAXVALUE=101
# #
# Expect none of admin DDL statements in the slow log (ON,filesort) # Expect none of admin DDL statements in the slow log (ON,filesort)
# #
SET @@GLOBAL.log_slow_admin_statements=ON; SET @@SESSION.log_slow_admin_statements=ON;
SET log_slow_filter=filesort; SET log_slow_filter=filesort;
TRUNCATE TABLE mysql.slow_log; TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
@ -102,12 +122,18 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt; EXECUTE stmt;
DEALLOCATE PREPARE stmt; DEALLOCATE PREPARE stmt;
DROP TABLE t4; DROP TABLE t4;
CREATE SEQUENCE s4;
ALTER SEQUENCE s4 MAXVALUE 100;
PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP SEQUENCE s4;
CALL show_slow_log(); CALL show_slow_log();
sql_text sql_text
# #
# Expect none of admin statements in the slow log (OFF,DEFAULT) # Expect none of admin statements in the slow log (OFF,DEFAULT)
# #
SET @@GLOBAL.log_slow_admin_statements=OFF; SET @@SESSION.log_slow_admin_statements=OFF;
SET log_slow_filter=DEFAULT; SET log_slow_filter=DEFAULT;
TRUNCATE TABLE mysql.slow_log; TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
@ -123,7 +149,58 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt; EXECUTE stmt;
DEALLOCATE PREPARE stmt; DEALLOCATE PREPARE stmt;
DROP TABLE t4; DROP TABLE t4;
CALL show_slow_log_exclude_ps(); CREATE SEQUENCE s4;
ALTER SEQUENCE s4 MAXVALUE 100;
PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP SEQUENCE s4;
CALL show_slow_log();
sql_text
[slow] TRUNCATE TABLE mysql.slow_log
[slow] CREATE TABLE t1 (a INT)
[slow] DROP TABLE t1
[slow] CREATE TABLE t2 (a INT)
[slow] DROP TABLE t3
[slow] CREATE TABLE t4 (a INT)
[slow] PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'
[slow] DEALLOCATE PREPARE stmt
[slow] DROP TABLE t4
[slow] CREATE SEQUENCE s4
[slow] PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101'
[slow] DEALLOCATE PREPARE stmt
[slow] DROP SEQUENCE s4
#
# Expect all admin statements in the slow log (GLOBAL OFF,LOCAL ON,DEFAULT)
# In the original implementation, this combination disabled slow log for admin commands.
# However, instead of this exception in GLOBAL vs LOCAL variable behaviour,
# we should make max_system_variables.log_slow_admin_statements=0
# prevent enabling globally suppressed logging by setting the session variable to ON.
#
SET @@GLOBAL.log_slow_admin_statements=OFF;
SET @@SESSION.log_slow_admin_statements=ON;
SET log_slow_filter=DEFAULT;
TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT);
CREATE INDEX t1a ON t1 (a);
DROP INDEX t1a ON t1;
DROP TABLE t1;
CREATE TABLE t2 (a INT);
ALTER TABLE t2 RENAME t2;
RENAME TABLE t2 TO t3;
DROP TABLE t3;
CREATE TABLE t4 (a INT);
PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t4;
CREATE SEQUENCE s4;
ALTER SEQUENCE s4 MAXVALUE 100;
PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP SEQUENCE s4;
CALL show_slow_log();
sql_text sql_text
[slow] TRUNCATE TABLE mysql.slow_log [slow] TRUNCATE TABLE mysql.slow_log
[slow] CREATE TABLE t1 (a INT) [slow] CREATE TABLE t1 (a INT)
@ -139,6 +216,12 @@ sql_text
[slow] ALTER TABLE t4 MODIFY a INT DEFAULT 1 [slow] ALTER TABLE t4 MODIFY a INT DEFAULT 1
[slow] DEALLOCATE PREPARE stmt [slow] DEALLOCATE PREPARE stmt
[slow] DROP TABLE t4 [slow] DROP TABLE t4
[slow] CREATE SEQUENCE s4
[slow] ALTER SEQUENCE s4 MAXVALUE 100
[slow] PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101'
[slow] ALTER SEQUENCE s4 MAXVALUE=101
[slow] DEALLOCATE PREPARE stmt
[slow] DROP SEQUENCE s4
# #
# Clean up # Clean up
# #

View File

@ -34,45 +34,21 @@ DELIMITER ;$$
--echo # Expect all admin statements in the slow log (ON,DEFAULT) --echo # Expect all admin statements in the slow log (ON,DEFAULT)
--echo # --echo #
SET @@GLOBAL.log_slow_admin_statements=ON; SET @@SESSION.log_slow_admin_statements=ON;
SET log_slow_filter=DEFAULT; SET log_slow_filter=DEFAULT;
TRUNCATE TABLE mysql.slow_log; TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT); --source include/log_slow_debug_common.inc
CREATE INDEX t1a ON t1 (a); CALL show_slow_log();
DROP INDEX t1a ON t1;
DROP TABLE t1;
CREATE TABLE t2 (a INT);
ALTER TABLE t2 RENAME t2;
RENAME TABLE t2 TO t3;
DROP TABLE t3;
CREATE TABLE t4 (a INT);
PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t4;
CALL show_slow_log_exclude_ps();
--echo # --echo #
--echo # Expect all admin statements in the slow log (ON,admin) --echo # Expect all admin statements in the slow log (ON,admin)
--echo # --echo #
SET @@GLOBAL.log_slow_admin_statements=ON; SET @@SESSION.log_slow_admin_statements=ON;
SET log_slow_filter=admin; SET log_slow_filter=admin;
TRUNCATE TABLE mysql.slow_log; TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT); --source include/log_slow_debug_common.inc
CREATE INDEX t1a ON t1 (a);
DROP INDEX t1a ON t1;
DROP TABLE t1;
CREATE TABLE t2 (a INT);
ALTER TABLE t2 RENAME t2;
RENAME TABLE t2 TO t3;
DROP TABLE t3;
CREATE TABLE t4 (a INT);
PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t4;
CALL show_slow_log(); CALL show_slow_log();
@ -80,22 +56,10 @@ CALL show_slow_log();
--echo # Expect none of admin DDL statements in the slow log (ON,filesort) --echo # Expect none of admin DDL statements in the slow log (ON,filesort)
--echo # --echo #
SET @@GLOBAL.log_slow_admin_statements=ON; SET @@SESSION.log_slow_admin_statements=ON;
SET log_slow_filter=filesort; SET log_slow_filter=filesort;
TRUNCATE TABLE mysql.slow_log; TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT); --source include/log_slow_debug_common.inc
CREATE INDEX t1a ON t1 (a);
DROP INDEX t1a ON t1;
DROP TABLE t1;
CREATE TABLE t2 (a INT);
ALTER TABLE t2 RENAME t2;
RENAME TABLE t2 TO t3;
DROP TABLE t3;
CREATE TABLE t4 (a INT);
PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t4;
CALL show_slow_log(); CALL show_slow_log();
@ -103,23 +67,27 @@ CALL show_slow_log();
--echo # Expect none of admin statements in the slow log (OFF,DEFAULT) --echo # Expect none of admin statements in the slow log (OFF,DEFAULT)
--echo # --echo #
SET @@GLOBAL.log_slow_admin_statements=OFF; SET @@SESSION.log_slow_admin_statements=OFF;
SET log_slow_filter=DEFAULT; SET log_slow_filter=DEFAULT;
TRUNCATE TABLE mysql.slow_log; TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT); --source include/log_slow_debug_common.inc
CREATE INDEX t1a ON t1 (a); CALL show_slow_log();
DROP INDEX t1a ON t1;
DROP TABLE t1;
CREATE TABLE t2 (a INT); --echo #
ALTER TABLE t2 RENAME t2; --echo # Expect all admin statements in the slow log (GLOBAL OFF,LOCAL ON,DEFAULT)
RENAME TABLE t2 TO t3; --echo # In the original implementation, this combination disabled slow log for admin commands.
DROP TABLE t3; --echo # However, instead of this exception in GLOBAL vs LOCAL variable behaviour,
CREATE TABLE t4 (a INT); --echo # we should make max_system_variables.log_slow_admin_statements=0
PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; --echo # prevent enabling globally suppressed logging by setting the session variable to ON.
EXECUTE stmt; --echo #
DEALLOCATE PREPARE stmt;
DROP TABLE t4; SET @@GLOBAL.log_slow_admin_statements=OFF;
CALL show_slow_log_exclude_ps(); SET @@SESSION.log_slow_admin_statements=ON;
SET log_slow_filter=DEFAULT;
TRUNCATE TABLE mysql.slow_log;
--source include/log_slow_debug_common.inc
CALL show_slow_log();
--echo # --echo #

View File

@ -255,9 +255,9 @@ a b c
4 -4 -3 4 -4 -3
drop table t1; drop table t1;
create table t1 (a int, b int generated always as(-b) virtual, c int generated always as (b + 1) virtual); 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); 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); 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` 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 # 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() # THD->CHANGE_LIST.IS_EMPTY()
# #
CREATE TABLE t1(a bigint AS (a between 1 and 1)); 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 # Bug#20757211: GENERATED COLUMNS: ALTER TABLE CRASHES
# IN FIND_FIELD_IN_TABLE # IN FIND_FIELD_IN_TABLE
# #

View File

@ -255,9 +255,9 @@ a b c
4 -4 -3 4 -4 -3
drop table t1; drop table t1;
create table t1 (a int, b int generated always as(-b) virtual, c int generated always as (b + 1) virtual); 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); 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); 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` 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 # 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() # THD->CHANGE_LIST.IS_EMPTY()
# #
CREATE TABLE t1(a bigint AS (a between 1 and 1)); 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 # Bug#20757211: GENERATED COLUMNS: ALTER TABLE CRASHES
# IN FIND_FIELD_IN_TABLE # IN FIND_FIELD_IN_TABLE
# #

View File

@ -42,7 +42,7 @@ test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK test.t1 analyze status OK
select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1';
CLUST_INDEX_SIZE CLUST_INDEX_SIZE
5 4
set global innodb_limit_optimistic_insert_debug = 10000; set global innodb_limit_optimistic_insert_debug = 10000;
connection con2; connection con2;
rollback; rollback;
@ -54,16 +54,6 @@ test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK test.t1 analyze status OK
select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1';
CLUST_INDEX_SIZE CLUST_INDEX_SIZE
3
begin;
insert into t1 values (2);
rollback;
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1';
CLUST_INDEX_SIZE
2 2
begin; begin;
insert into t1 values (2); insert into t1 values (2);
@ -75,5 +65,15 @@ test.t1 analyze status OK
select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1';
CLUST_INDEX_SIZE CLUST_INDEX_SIZE
1 1
begin;
insert into t1 values (2);
rollback;
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1';
CLUST_INDEX_SIZE
1
drop table t1; drop table t1;
set global innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug; set global innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug;

View File

@ -336,7 +336,7 @@ drop table t1;
# MDEV-5611: self-referencing virtual column # MDEV-5611: self-referencing virtual column
# #
create table t1 (a int, b int as (b is null) virtual); 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); create table t1 (a int as (1+1), b int as (a is null) virtual);
drop table t1; drop table t1;
# end of 5.3 tests # end of 5.3 tests

View File

@ -36,11 +36,6 @@
#include "sql_select.h" #include "sql_select.h"
#include "debug_sync.h" #include "debug_sync.h"
/// How to write record_ref.
#define WRITE_REF(file,from) \
if (my_b_write((file),(uchar*) (from),param->ref_length)) \
DBUG_RETURN(1);
/* functions defined in this file */ /* functions defined in this file */
static uchar *read_buffpek_from_file(IO_CACHE *buffer_file, uint count, static uchar *read_buffpek_from_file(IO_CACHE *buffer_file, uint count,

View File

@ -4741,7 +4741,6 @@ public:
virtual int enable_indexes(uint mode) { return HA_ERR_WRONG_COMMAND; } virtual int enable_indexes(uint mode) { return HA_ERR_WRONG_COMMAND; }
virtual int discard_or_import_tablespace(my_bool discard) virtual int discard_or_import_tablespace(my_bool discard)
{ return (my_errno=HA_ERR_WRONG_COMMAND); } { return (my_errno=HA_ERR_WRONG_COMMAND); }
virtual void prepare_for_alter() { return; }
virtual void drop_table(const char *name); virtual void drop_table(const char *name);
virtual int create(const char *name, TABLE *form, HA_CREATE_INFO *info)=0; virtual int create(const char *name, TABLE *form, HA_CREATE_INFO *info)=0;

View File

@ -837,7 +837,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: Fields are initialized in this order:
- All fields that have default value as a constant are initialized first. - All fields that have default value as a constant are initialized first.

View File

@ -7625,7 +7625,7 @@ ER_ERROR_EVALUATING_EXPRESSION
ER_CALCULATING_DEFAULT_VALUE ER_CALCULATING_DEFAULT_VALUE
eng "Got an error when calculating default value for %`s" eng "Got an error when calculating default value for %`s"
ER_EXPRESSION_REFERS_TO_UNINIT_FIELD 01000 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 ER_PARTITION_DEFAULT_ERROR
eng "Only one DEFAULT partition allowed" eng "Only one DEFAULT partition allowed"
ukr "Припустимо мати тільки один DEFAULT розділ" ukr "Припустимо мати тільки один DEFAULT розділ"

View File

@ -24,20 +24,6 @@ bool mysql_handle_derived(LEX *lex, uint phases);
bool mysql_handle_single_derived(LEX *lex, TABLE_LIST *derived, uint phases); bool mysql_handle_single_derived(LEX *lex, TABLE_LIST *derived, uint phases);
bool mysql_derived_reinit(THD *thd, LEX *lex, TABLE_LIST *derived); bool mysql_derived_reinit(THD *thd, LEX *lex, TABLE_LIST *derived);
/**
Cleans up the SELECT_LEX_UNIT for the derived table (if any).
@param thd Thread handler
@param lex LEX for this thread
@param derived TABLE_LIST for the derived table
@retval false Success
@retval true Failure
*/
bool mysql_derived_cleanup(THD *thd, LEX *lex, TABLE_LIST *derived);
Item *delete_not_needed_parts(THD *thd, Item *cond);
bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived); bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived);
#endif /* SQL_DERIVED_INCLUDED */ #endif /* SQL_DERIVED_INCLUDED */

View File

@ -717,7 +717,6 @@ void LEX::start(THD *thd_arg)
describe= 0; describe= 0;
analyze_stmt= 0; analyze_stmt= 0;
explain_json= false; explain_json= false;
subqueries= FALSE;
context_analysis_only= 0; context_analysis_only= 0;
derived_tables= 0; derived_tables= 0;
safe_to_cache_query= 1; safe_to_cache_query= 1;

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. /* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2018, MariaDB Corporation Copyright (c) 2010, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -808,12 +808,6 @@ public:
friend bool mysql_new_select(LEX *lex, bool move_down, SELECT_LEX *sel); friend bool mysql_new_select(LEX *lex, bool move_down, SELECT_LEX *sel);
friend bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table, friend bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table,
bool open_view_no_parse); bool open_view_no_parse);
friend bool mysql_derived_prepare(THD *thd, LEX *lex,
TABLE_LIST *orig_table_list);
friend bool mysql_derived_merge(THD *thd, LEX *lex,
TABLE_LIST *orig_table_list);
friend bool TABLE_LIST::init_derived(THD *thd, bool init_view);
friend class st_select_lex; friend class st_select_lex;
private: private:
void fast_exclude(); void fast_exclude();
@ -3302,7 +3296,7 @@ public:
enum enum_yes_no_unknown tx_chain, tx_release; enum enum_yes_no_unknown tx_chain, tx_release;
bool safe_to_cache_query; bool safe_to_cache_query;
bool subqueries, ignore; bool ignore;
bool next_is_main; // use "main" SELECT_LEX for nrxt allocation; bool next_is_main; // use "main" SELECT_LEX for nrxt allocation;
bool next_is_down; // use "main" SELECT_LEX for nrxt allocation; bool next_is_down; // use "main" SELECT_LEX for nrxt allocation;
st_parsing_options parsing_options; st_parsing_options parsing_options;
@ -3326,7 +3320,6 @@ public:
sp_name *spname; sp_name *spname;
bool sp_lex_in_use; // Keep track on lex usage in SPs for error handling bool sp_lex_in_use; // Keep track on lex usage in SPs for error handling
bool all_privileges; bool all_privileges;
bool proxy_priv;
sp_pcontext *spcont; sp_pcontext *spcont;
@ -4634,18 +4627,6 @@ public:
*/ */
}; };
/**
Input parameters to the parser.
*/
struct Parser_input
{
bool m_compute_digest;
Parser_input()
: m_compute_digest(false)
{}
};
/** /**
Internal state of the parser. Internal state of the parser.
The complete state consist of: The complete state consist of:
@ -4673,7 +4654,6 @@ public:
~Parser_state() ~Parser_state()
{} {}
Parser_input m_input;
Lex_input_stream m_lip; Lex_input_stream m_lip;
Yacc_state m_yacc; Yacc_state m_yacc;

View File

@ -4643,8 +4643,7 @@ end_with_restore_list:
select_lex->order_list.elements, select_lex->order_list.elements,
select_lex->order_list.first, select_lex->order_list.first,
unit->select_limit_cnt, unit->select_limit_cnt,
lex->duplicates, lex->ignore, lex->ignore, &found, &updated);
&found, &updated);
MYSQL_UPDATE_DONE(res, found, updated); MYSQL_UPDATE_DONE(res, found, updated);
/* mysql_update return 2 if we need to switch to multi-update */ /* mysql_update return 2 if we need to switch to multi-update */
if (up_result != 2) if (up_result != 2)
@ -7790,7 +7789,6 @@ mysql_new_select(LEX *lex, bool move_down, SELECT_LEX *select_lex)
if (select_lex->set_nest_level(old_nest_level + 1)) if (select_lex->set_nest_level(old_nest_level + 1))
DBUG_RETURN(1); DBUG_RETURN(1);
SELECT_LEX_UNIT *unit; SELECT_LEX_UNIT *unit;
lex->subqueries= TRUE;
/* first select_lex of subselect or derived table */ /* first select_lex of subselect or derived table */
if (!(unit= lex->alloc_unit())) if (!(unit= lex->alloc_unit()))
DBUG_RETURN(1); DBUG_RETURN(1);
@ -10174,8 +10172,7 @@ bool parse_sql(THD *thd, Parser_state *parser_state,
/* Start Digest */ /* Start Digest */
parser_state->m_digest_psi= MYSQL_DIGEST_START(thd->m_statement_psi); parser_state->m_digest_psi= MYSQL_DIGEST_START(thd->m_statement_psi);
if (parser_state->m_input.m_compute_digest || if (parser_state->m_digest_psi != NULL)
(parser_state->m_digest_psi != NULL))
{ {
/* /*
If either: If either:

View File

@ -7323,11 +7323,7 @@ static void store_schema_partitions_record(THD *thd, TABLE *schema_table,
strlen(part_elem->tablespace_name), cs); strlen(part_elem->tablespace_name), cs);
else else
{ {
char *ts= showing_table->s->tablespace; table->field[24]->set_null();
if(ts)
table->field[24]->store(ts, strlen(ts), cs);
else
table->field[24]->set_null();
} }
} }
return; return;

View File

@ -321,7 +321,6 @@ int cut_fields_for_portion_of_time(THD *thd, TABLE *table,
order_num number of elemen in ORDER BY clause order_num number of elemen in ORDER BY clause
order ORDER BY clause list order ORDER BY clause list
limit limit clause limit limit clause
handle_duplicates how to handle duplicates
RETURN RETURN
0 - OK 0 - OK
@ -336,8 +335,8 @@ int mysql_update(THD *thd,
List<Item> &values, List<Item> &values,
COND *conds, COND *conds,
uint order_num, ORDER *order, uint order_num, ORDER *order,
ha_rows limit, ha_rows limit,
enum enum_duplicates handle_duplicates, bool ignore, bool ignore,
ha_rows *found_return, ha_rows *updated_return) ha_rows *found_return, ha_rows *updated_return)
{ {
bool using_limit= limit != HA_POS_ERROR; bool using_limit= limit != HA_POS_ERROR;

View File

@ -31,8 +31,7 @@ bool check_unique_table(THD *thd, TABLE_LIST *table_list);
int mysql_update(THD *thd,TABLE_LIST *tables,List<Item> &fields, int mysql_update(THD *thd,TABLE_LIST *tables,List<Item> &fields,
List<Item> &values,COND *conds, List<Item> &values,COND *conds,
uint order_num, ORDER *order, ha_rows limit, uint order_num, ORDER *order, ha_rows limit,
enum enum_duplicates handle_duplicates, bool ignore, bool ignore, ha_rows *found_return, ha_rows *updated_return);
ha_rows *found_return, ha_rows *updated_return);
bool mysql_multi_update(THD *thd, TABLE_LIST *table_list, bool mysql_multi_update(THD *thd, TABLE_LIST *table_list,
List<Item> *fields, List<Item> *values, List<Item> *fields, List<Item> *values,
COND *conds, ulonglong options, COND *conds, ulonglong options,

View File

@ -1725,7 +1725,6 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table,
view_select->linkage= DERIVED_TABLE_TYPE; view_select->linkage= DERIVED_TABLE_TYPE;
table->updatable= 0; table->updatable= 0;
table->effective_with_check= VIEW_CHECK_NONE; table->effective_with_check= VIEW_CHECK_NONE;
old_lex->subqueries= TRUE;
table->derived= &lex->unit; table->derived= &lex->unit;
} }

View File

@ -164,9 +164,6 @@ typedef struct st_key {
*/ */
Index_statistics *collected_stats; Index_statistics *collected_stats;
union {
int bdb_return_if_eq;
} handler;
TABLE *table; TABLE *table;
LEX_CSTRING comment; LEX_CSTRING comment;
/** reference to the list of options or NULL */ /** reference to the list of options or NULL */

View File

@ -1251,7 +1251,7 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
if (check_constraint_ptr) if (check_constraint_ptr)
*check_constraint_ptr= 0; *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++) for (field_ptr= table->field; *field_ptr; field_ptr++)
{ {
Field *field= *field_ptr; Field *field= *field_ptr;

View File

@ -764,9 +764,6 @@ struct TABLE_SHARE
/* For sequence tables, the current sequence state */ /* For sequence tables, the current sequence state */
SEQUENCE *sequence; SEQUENCE *sequence;
/* Name of the tablespace used for this table */
char *tablespace;
#ifdef WITH_PARTITION_STORAGE_ENGINE #ifdef WITH_PARTITION_STORAGE_ENGINE
/* filled in when reading from frm */ /* filled in when reading from frm */
bool auto_partitioned; bool auto_partitioned;
@ -884,12 +881,6 @@ struct TABLE_SHARE
set_table_cache_key(key_buff, key_length); set_table_cache_key(key_buff, key_length);
} }
inline bool honor_global_locks()
{
return ((table_category == TABLE_CATEGORY_USER)
|| (table_category == TABLE_CATEGORY_SYSTEM));
}
inline bool require_write_privileges() inline bool require_write_privileges()
{ {
return (table_category == TABLE_CATEGORY_LOG); return (table_category == TABLE_CATEGORY_LOG);

View File

@ -103,8 +103,4 @@ public:
typedef Lex_cstring_with_compare<Compare_identifiers> Lex_ident; typedef Lex_cstring_with_compare<Compare_identifiers> Lex_ident;
typedef Lex_cstring_with_compare<Compare_table_names> Lex_table_name; typedef Lex_cstring_with_compare<Compare_table_names> Lex_table_name;
#define XSTRING_WITH_LEN(X) (X).ptr(), (X).length()
#define DB_WITH_LEN(X) (X).db.str, (X).db.length
#define TABLE_NAME_WITH_LEN(X) (X).table_name.str, (X).table_name.length
#endif // VERS_STRING_INCLUDED #endif // VERS_STRING_INCLUDED

View File

@ -377,8 +377,7 @@ btr_root_adjust_on_import(
page = buf_block_get_frame(block); page = buf_block_get_frame(block);
page_zip = buf_block_get_page_zip(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; err = DB_CORRUPTION;
} else if (dict_index_is_clust(index)) { } else if (dict_index_is_clust(index)) {
@ -1074,18 +1073,13 @@ btr_page_get_father_block(
return(btr_page_get_father_node_ptr(offsets, heap, cursor, mtr)); return(btr_page_get_father_node_ptr(offsets, heap, cursor, mtr));
} }
/************************************************************//** /** Seek to the parent page of a B-tree page.
Seeks to the upper level node pointer to a page. @param[in,out] index b-tree
It is assumed that mtr holds an x-latch on the tree. */ @param[in] block child page
static @param[in,out] mtr mini-transaction
void @param[out] cursor cursor pointing to the x-latched parent page */
btr_page_get_father( void btr_page_get_father(dict_index_t* index, buf_block_t* block, mtr_t* mtr,
/*================*/ btr_cur_t* cursor)
dict_index_t* index, /*!< in: b-tree index */
buf_block_t* block, /*!< in: child page in the index */
mtr_t* mtr, /*!< in: mtr */
btr_cur_t* cursor) /*!< out: cursor on node pointer record,
its page x-latched */
{ {
mem_heap_t* heap; mem_heap_t* heap;
rec_t* rec rec_t* rec
@ -1172,11 +1166,11 @@ btr_free_root_check(
buf_block_dbg_add_level(block, SYNC_TREE_NODE); buf_block_dbg_add_level(block, SYNC_TREE_NODE);
if (fil_page_index_page_check(block->frame) 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. /* This should be a root page.
It should not be possible to reassign the same It should not be possible to reassign the same
index_id for some other index in the tablespace. */ index_id for some other index in the tablespace. */
ut_ad(page_is_root(block->frame)); ut_ad(!page_has_siblings(block->frame));
} else { } else {
block = NULL; block = NULL;
} }
@ -1326,7 +1320,8 @@ btr_free_but_not_root(
ibool finished; ibool finished;
mtr_t mtr; 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: leaf_loop:
mtr_start(&mtr); mtr_start(&mtr);
mtr_set_log_mode(&mtr, log_mode); mtr_set_log_mode(&mtr, log_mode);
@ -1397,7 +1392,6 @@ btr_free_if_exists(
return; return;
} }
ut_ad(page_is_root(root->frame));
btr_free_but_not_root(root, mtr->get_log_mode()); btr_free_but_not_root(root, mtr->get_log_mode());
mtr->set_named_space_id(page_id.space()); mtr->set_named_space_id(page_id.space());
btr_free_root(root, mtr); btr_free_root(root, mtr);
@ -1415,8 +1409,6 @@ void btr_free(const page_id_t page_id)
buf_block_t* block = buf_page_get(page_id, 0, RW_X_LATCH, &mtr); buf_block_t* block = buf_page_get(page_id, 0, RW_X_LATCH, &mtr);
if (block) { if (block) {
ut_ad(page_is_root(block->frame));
btr_free_but_not_root(block, MTR_LOG_NO_REDO); btr_free_but_not_root(block, MTR_LOG_NO_REDO);
btr_free_root(block, &mtr); btr_free_root(block, &mtr);
} }
@ -1563,12 +1555,17 @@ btr_page_reorganize_low(
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
btr_assert_not_corrupted(block, index); 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 #ifdef UNIV_ZIP_DEBUG
ut_a(!page_zip || page_zip_validate(page_zip, page, index)); ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */ #endif /* UNIV_ZIP_DEBUG */
data_size1 = page_get_data_size(page); data_size1 = page_get_data_size(page);
max_ins_size1 = page_get_max_insert_size_after_reorganize(page, 1); max_ins_size1 = page_get_max_insert_size_after_reorganize(page, 1);
/* Turn logging off */ /* Turn logging off */
mtr_log_t log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE); mtr_log_t log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE);
@ -1626,7 +1623,7 @@ btr_page_reorganize_low(
|| page_get_max_trx_id(page) == 0 || page_get_max_trx_id(page) == 0
|| (dict_index_is_sec_or_ibuf(index) || (dict_index_is_sec_or_ibuf(index)
? page_is_leaf(temp_page) ? 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 /* If innodb_log_compressed_pages is ON, page reorganize should log the
compressed page image.*/ compressed page image.*/
@ -1691,7 +1688,7 @@ btr_page_reorganize_low(
#endif /* UNIV_ZIP_DEBUG */ #endif /* UNIV_ZIP_DEBUG */
if (!recovery) { if (!recovery) {
if (page_is_root(temp_page) if (block->page.id.page_no() == index->page
&& fil_page_get_type(temp_page) == FIL_PAGE_TYPE_INSTANT) { && fil_page_get_type(temp_page) == FIL_PAGE_TYPE_INSTANT) {
/* Preserve the PAGE_INSTANT information. */ /* Preserve the PAGE_INSTANT information. */
ut_ad(!page_zip); ut_ad(!page_zip);
@ -1892,6 +1889,8 @@ btr_page_empty(
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
ut_ad(page_zip == buf_block_get_page_zip(block)); 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 #ifdef UNIV_ZIP_DEBUG
ut_a(!page_zip || page_zip_validate(page_zip, page, index)); ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */ #endif /* UNIV_ZIP_DEBUG */
@ -1904,7 +1903,8 @@ btr_page_empty(
/* Preserve PAGE_ROOT_AUTO_INC when creating a clustered index /* Preserve PAGE_ROOT_AUTO_INC when creating a clustered index
root page. */ root page. */
const ib_uint64_t autoinc 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) ? page_get_autoinc(page)
: 0; : 0;
@ -1930,7 +1930,10 @@ void btr_set_instant(buf_block_t* root, const dict_index_t& index, mtr_t* mtr)
ut_ad(index.n_core_fields > 0); ut_ad(index.n_core_fields > 0);
ut_ad(index.n_core_fields < REC_MAX_N_FIELDS); ut_ad(index.n_core_fields < REC_MAX_N_FIELDS);
ut_ad(index.is_instant()); ut_ad(index.is_instant());
ut_ad(page_is_root(root->frame)); ut_ad(fil_page_get_type(root->frame) == FIL_PAGE_TYPE_INSTANT
|| fil_page_get_type(root->frame) == FIL_PAGE_INDEX);
ut_ad(!page_has_siblings(root->frame));
ut_ad(root->page.id.page_no() == index.page);
rec_t* infimum = page_get_infimum_rec(root->frame); rec_t* infimum = page_get_infimum_rec(root->frame);
rec_t* supremum = page_get_supremum_rec(root->frame); rec_t* supremum = page_get_supremum_rec(root->frame);
@ -3504,33 +3507,6 @@ btr_set_min_rec_mark(
} }
} }
/*************************************************************//**
Deletes on the upper level the node pointer to a page. */
void
btr_node_ptr_delete(
/*================*/
dict_index_t* index, /*!< in: index tree */
buf_block_t* block, /*!< in: page whose node pointer is deleted */
mtr_t* mtr) /*!< in: mtr */
{
btr_cur_t cursor;
ibool compressed;
dberr_t err;
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
/* Delete node pointer on father page */
btr_page_get_father(index, block, mtr, &cursor);
compressed = btr_cur_pessimistic_delete(&err, TRUE, &cursor,
BTR_CREATE_FLAG, false, mtr);
ut_a(err == DB_SUCCESS);
if (!compressed) {
btr_cur_compress_if_useful(&cursor, FALSE, mtr);
}
}
/*************************************************************//** /*************************************************************//**
If page is the only on its level, this function moves its records to the If page is the only on its level, this function moves its records to the
father page, thus reducing the tree height. father page, thus reducing the tree height.
@ -3982,7 +3958,7 @@ retry:
lock_rec_free_all_from_discard_page(block); lock_rec_free_all_from_discard_page(block);
lock_mutex_exit(); lock_mutex_exit();
} else { } else {
btr_node_ptr_delete(index, block, mtr); btr_cur_node_ptr_delete(&father_cursor, mtr);
if (!dict_table_is_locking_disabled(index->table)) { if (!dict_table_is_locking_disabled(index->table)) {
lock_update_merge_left( lock_update_merge_left(
merge_block, orig_pred, block); merge_block, orig_pred, block);
@ -4255,8 +4231,9 @@ err_exit:
/*************************************************************//** /*************************************************************//**
Discards a page that is the only page on its level. This will empty Discards a page that is the only page on its level. This will empty
the whole B-tree, leaving just an empty root page. This function the whole B-tree, leaving just an empty root page. This function
should never be reached, because btr_compress(), which is invoked in should almost never be reached, because btr_compress(), which is invoked in
delete operations, calls btr_lift_page_up() to flatten the B-tree. */ delete operations, calls btr_lift_page_up() to flatten the B-tree. */
ATTRIBUTE_COLD
static static
void void
btr_discard_only_page_on_level( btr_discard_only_page_on_level(
@ -4268,6 +4245,8 @@ btr_discard_only_page_on_level(
ulint page_level = 0; ulint page_level = 0;
trx_id_t max_trx_id; trx_id_t max_trx_id;
ut_ad(!index->is_dummy);
/* Save the PAGE_MAX_TRX_ID from the leaf page. */ /* Save the PAGE_MAX_TRX_ID from the leaf page. */
max_trx_id = page_get_max_trx_id(buf_block_get_frame(block)); max_trx_id = page_get_max_trx_id(buf_block_get_frame(block));
@ -4279,7 +4258,8 @@ btr_discard_only_page_on_level(
ut_a(page_get_n_recs(page) == 1); ut_a(page_get_n_recs(page) == 1);
ut_a(page_level == btr_page_get_level(page)); ut_a(page_level == btr_page_get_level(page));
ut_a(!page_has_siblings(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)); ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
btr_search_drop_page_hash_index(block); btr_search_drop_page_hash_index(block);
@ -4306,7 +4286,7 @@ btr_discard_only_page_on_level(
/* block is the root page, which must be empty, except /* block is the root page, which must be empty, except
for the node pointer to the (now discarded) block(s). */ 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 #ifdef UNIV_BTR_DEBUG
if (!dict_index_is_ibuf(index)) { if (!dict_index_is_ibuf(index)) {
@ -4385,10 +4365,7 @@ btr_discard_page(
buf_block_t* block; buf_block_t* block;
page_t* page; page_t* page;
rec_t* node_ptr; rec_t* node_ptr;
#ifdef UNIV_DEBUG
btr_cur_t parent_cursor; btr_cur_t parent_cursor;
bool parent_is_different = false;
#endif
block = btr_cur_get_block(cursor); block = btr_cur_get_block(cursor);
index = btr_cur_get_index(cursor); index = btr_cur_get_index(cursor);
@ -4402,13 +4379,11 @@ btr_discard_page(
MONITOR_INC(MONITOR_INDEX_DISCARD); MONITOR_INC(MONITOR_INDEX_DISCARD);
#ifdef UNIV_DEBUG
if (dict_index_is_spatial(index)) { if (dict_index_is_spatial(index)) {
rtr_page_get_father(index, block, mtr, cursor, &parent_cursor); rtr_page_get_father(index, block, mtr, cursor, &parent_cursor);
} else { } else {
btr_page_get_father(index, block, mtr, &parent_cursor); btr_page_get_father(index, block, mtr, &parent_cursor);
} }
#endif
/* Decide the page which will inherit the locks */ /* Decide the page which will inherit the locks */
@ -4416,7 +4391,7 @@ btr_discard_page(
right_page_no = btr_page_get_next(buf_block_get_frame(block), mtr); right_page_no = btr_page_get_next(buf_block_get_frame(block), mtr);
const ulint zip_size = index->table->space->zip_size(); const ulint zip_size = index->table->space->zip_size();
ut_d(bool parent_is_different = false);
if (left_page_no != FIL_NULL) { if (left_page_no != FIL_NULL) {
merge_block = btr_block_get( merge_block = btr_block_get(
page_id_t(index->table->space_id, left_page_no), page_id_t(index->table->space_id, left_page_no),
@ -4472,15 +4447,9 @@ btr_discard_page(
} }
if (dict_index_is_spatial(index)) { if (dict_index_is_spatial(index)) {
btr_cur_t father_cursor; rtr_node_ptr_delete(&parent_cursor, mtr);
/* Since rtr_node_ptr_delete doesn't contain get father
node ptr, so, we need to get father node ptr first and then
delete it. */
rtr_page_get_father(index, block, mtr, cursor, &father_cursor);
rtr_node_ptr_delete(&father_cursor, mtr);
} else { } else {
btr_node_ptr_delete(index, block, mtr); btr_cur_node_ptr_delete(&parent_cursor, mtr);
} }
/* Remove the page from the level list */ /* Remove the page from the level list */
@ -4519,6 +4488,12 @@ btr_discard_page(
we cannot use btr_check_node_ptr() */ we cannot use btr_check_node_ptr() */
ut_ad(parent_is_different ut_ad(parent_is_different
|| btr_check_node_ptr(index, merge_block, mtr)); || btr_check_node_ptr(index, merge_block, mtr));
if (btr_cur_get_block(&parent_cursor)->page.id.page_no() == index->page
&& !page_has_siblings(btr_cur_get_page(&parent_cursor))
&& page_get_n_recs(btr_cur_get_page(&parent_cursor)) == 1) {
btr_lift_page_up(index, merge_block, mtr);
}
} }
#ifdef UNIV_BTR_PRINT #ifdef UNIV_BTR_PRINT

View File

@ -626,7 +626,11 @@ index root page.
@return whether the page is corrupted */ @return whether the page is corrupted */
bool btr_cur_instant_root_init(dict_index_t* index, const page_t* page) 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(!page_is_comp(page) == !dict_table_is_comp(index->table));
ut_ad(index->is_primary()); ut_ad(index->is_primary());
ut_ad(!index->is_instant()); ut_ad(!index->is_instant());
@ -5670,14 +5674,14 @@ btr_cur_optimistic_delete_func(
ut_ad(flags == 0 || flags == BTR_CREATE_FLAG); ut_ad(flags == 0 || flags == BTR_CREATE_FLAG);
ut_ad(mtr_memo_contains(mtr, btr_cur_get_block(cursor), ut_ad(mtr_memo_contains(mtr, btr_cur_get_block(cursor),
MTR_MEMO_PAGE_X_FIX)); 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(mtr->is_named_space(cursor->index->table->space));
ut_ad(!cursor->index->is_dummy);
/* This is intended only for leaf page deletions */ /* This is intended only for leaf page deletions */
block = btr_cur_get_block(cursor); 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(page_is_leaf(buf_block_get_frame(block)));
ut_ad(!dict_index_is_online_ddl(cursor->index) ut_ad(!dict_index_is_online_ddl(cursor->index)
|| dict_index_is_clust(cursor->index) || dict_index_is_clust(cursor->index)
@ -5685,7 +5689,7 @@ btr_cur_optimistic_delete_func(
rec = btr_cur_get_rec(cursor); 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 && page_get_n_recs(block->frame) == 1
+ (cursor->index->is_instant() + (cursor->index->is_instant()
&& !rec_is_metadata(rec, *cursor->index)))) { && !rec_is_metadata(rec, *cursor->index)))) {
@ -5863,6 +5867,8 @@ btr_cur_pessimistic_delete(
| MTR_MEMO_SX_LOCK)); | MTR_MEMO_SX_LOCK));
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr->is_named_space(index->table->space)); 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) { if (!has_reserved_extents) {
/* First reserve enough free space for the file segments /* First reserve enough free space for the file segments
@ -5916,7 +5922,7 @@ btr_cur_pessimistic_delete(
lock_update_delete(block, rec); 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) { if (page_get_n_recs(page) < 2) {
goto discard_page; goto discard_page;
} }
@ -6030,10 +6036,11 @@ discard_page:
on a page, we have to change the parent node pointer on a page, we have to change the parent node pointer
so that it is equal to the new leftmost node pointer so that it is equal to the new leftmost node pointer
on the page */ on the page */
btr_cur_t cursor;
btr_node_ptr_delete(index, block, mtr); btr_page_get_father(index, block, mtr, &cursor);
btr_cur_node_ptr_delete(&cursor, mtr);
const ulint level = btr_page_get_level(page); const ulint level = btr_page_get_level(page);
// FIXME: reuse the node_ptr from above
dtuple_t* node_ptr = dict_index_build_node_ptr( dtuple_t* node_ptr = dict_index_build_node_ptr(
index, next_rec, block->page.id.page_no(), index, next_rec, block->page.id.page_no(),
heap, level); heap, level);
@ -6099,6 +6106,23 @@ return_after_reservations:
return(ret); return(ret);
} }
/** Delete the node pointer in a parent page.
@param[in,out] parent cursor pointing to parent record
@param[in,out] mtr mini-transaction */
void btr_cur_node_ptr_delete(btr_cur_t* parent, mtr_t* mtr)
{
ut_ad(mtr_memo_contains(mtr, btr_cur_get_block(parent),
MTR_MEMO_PAGE_X_FIX));
dberr_t err;
ibool compressed = btr_cur_pessimistic_delete(&err, TRUE, parent,
BTR_CREATE_FLAG, false,
mtr);
ut_a(err == DB_SUCCESS);
if (!compressed) {
btr_cur_compress_if_useful(parent, FALSE, mtr);
}
}
/*******************************************************************//** /*******************************************************************//**
Adds path information to the cursor for the current page, for which Adds path information to the cursor for the current page, for which
the binary search has been performed. */ the binary search has been performed. */

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (C) 2013, 2014 Facebook, Inc. All Rights Reserved. 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 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 the terms of the GNU General Public License as published by the Free Software
@ -181,7 +181,8 @@ btr_defragment_add_index(
return NULL; 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)) { if (page_is_leaf(page)) {
// Index root is a leaf page, no need to defragment. // Index root is a leaf page, no need to defragment.
@ -481,6 +482,7 @@ btr_defragment_merge_pages(
ULINT_UNDEFINED); ULINT_UNDEFINED);
} }
} }
btr_cur_t parent;
if (n_recs_to_move == n_recs) { if (n_recs_to_move == n_recs) {
/* The whole page is merged with the previous page, /* The whole page is merged with the previous page,
free it. */ free it. */
@ -490,7 +492,8 @@ btr_defragment_merge_pages(
btr_level_list_remove( btr_level_list_remove(
index->table->space_id, index->table->space_id,
zip_size, from_page, index, mtr); zip_size, from_page, index, mtr);
btr_node_ptr_delete(index, from_block, mtr); btr_page_get_father(index, from_block, mtr, &parent);
btr_cur_node_ptr_delete(&parent, mtr);
/* btr_blob_dbg_remove(from_page, index, /* btr_blob_dbg_remove(from_page, index,
"btr_defragment_n_pages"); */ "btr_defragment_n_pages"); */
btr_page_free(index, from_block, mtr); btr_page_free(index, from_block, mtr);
@ -508,7 +511,9 @@ btr_defragment_merge_pages(
lock_update_split_and_merge(to_block, lock_update_split_and_merge(to_block,
orig_pred, orig_pred,
from_block); from_block);
btr_node_ptr_delete(index, from_block, mtr); // FIXME: reuse the node_ptr!
btr_page_get_father(index, from_block, mtr, &parent);
btr_cur_node_ptr_delete(&parent, mtr);
rec = page_rec_get_next( rec = page_rec_get_next(
page_get_infimum_rec(from_page)); page_get_infimum_rec(from_page));
node_ptr = dict_index_build_node_ptr( node_ptr = dict_index_build_node_ptr(

View File

@ -100,7 +100,6 @@ btr_pcur_store_position(
buf_block_t* block; buf_block_t* block;
rec_t* rec; rec_t* rec;
dict_index_t* index; dict_index_t* index;
page_t* page;
ulint offs; ulint offs;
ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); 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); page_cursor = btr_pcur_get_page_cur(cursor);
rec = page_cur_get_rec(page_cursor); rec = page_cur_get_rec(page_cursor);
page = page_align(rec); offs = rec - block->frame;
offs = page_offset(rec); ut_ad(block->page.id.page_no() == page_get_page_no(block->frame));
ut_ad(block->page.buf_fix_count); ut_ad(block->page.buf_fix_count);
/* For spatial index, when we do positioning on parent /* For spatial index, when we do positioning on parent
buffer if necessary, it might not hold latches, but the buffer if necessary, it might not hold latches, but the
@ -129,14 +127,14 @@ btr_pcur_store_position(
cursor->old_stored = true; 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 /* It must be an empty index tree; NOTE that in this case
we do not store the modify_clock, but always do a search we do not store the modify_clock, but always do a search
if we restore the cursor position */ if we restore the cursor position */
ut_a(!page_has_siblings(page)); ut_a(!page_has_siblings(block->frame));
ut_ad(page_is_leaf(page)); ut_ad(page_is_leaf(block->frame));
ut_ad(page_get_page_no(page) == index->page); ut_ad(block->page.id.page_no() == index->page);
if (page_rec_is_supremum_low(offs)) { if (page_rec_is_supremum_low(offs)) {
cursor->rel_pos = BTR_PCUR_AFTER_LAST_IN_TREE; cursor->rel_pos = BTR_PCUR_AFTER_LAST_IN_TREE;
@ -155,8 +153,8 @@ before_first:
if (UNIV_UNLIKELY(rec_is_metadata(rec, *index))) { if (UNIV_UNLIKELY(rec_is_metadata(rec, *index))) {
ut_ad(index->table->instant); ut_ad(index->table->instant);
ut_ad(page_get_n_recs(block->frame) == 1); ut_ad(page_get_n_recs(block->frame) == 1);
ut_ad(page_is_leaf(page)); ut_ad(page_is_leaf(block->frame));
ut_ad(page_get_page_no(page) == index->page); ut_ad(page_get_page_no(block->frame) == index->page);
cursor->rel_pos = BTR_PCUR_AFTER_LAST_IN_TREE; cursor->rel_pos = BTR_PCUR_AFTER_LAST_IN_TREE;
return; return;
} }
@ -166,11 +164,11 @@ before_first:
rec = page_rec_get_next(rec); rec = page_rec_get_next(rec);
if (rec_is_metadata(rec, *index)) { if (rec_is_metadata(rec, *index)) {
ut_ad(!page_has_prev(page)); ut_ad(!page_has_prev(block->frame));
ut_d(const rec_t* p = rec); ut_d(const rec_t* p = rec);
rec = page_rec_get_next(rec); rec = page_rec_get_next(rec);
if (page_rec_is_supremum(rec)) { if (page_rec_is_supremum(rec)) {
ut_ad(page_has_next(page) ut_ad(page_has_next(block->frame)
|| rec_is_alter_metadata(p, *index)); || rec_is_alter_metadata(p, *index));
goto before_first; goto before_first;
} }

View File

@ -2,7 +2,7 @@
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc. Copyright (c) 2008, Google Inc.
Copyright (c) 2017, 2018, MariaDB Corporation. Copyright (c) 2017, 2019, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described Google, Inc. Those modifications are gratefully acknowledged and are described

View File

@ -145,9 +145,6 @@ void close_thread_tables(THD* thd);
#include "dict0priv.h" #include "dict0priv.h"
#include <mysql/service_md5.h> #include <mysql/service_md5.h>
#include "wsrep_sst.h" #include "wsrep_sst.h"
extern MYSQL_PLUGIN_IMPORT MYSQL_BIN_LOG mysql_bin_log;
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
/** to force correct commit order in binlog */ /** to force correct commit order in binlog */
@ -238,12 +235,6 @@ void set_my_errno(int err)
errno = 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. /** Checks whether the file name belongs to a partition of a table.
@param[in] file_name file name @param[in] file_name file name
@return pointer to the end of the table name part of the file name, or NULL */ @return pointer to the end of the table name part of the file name, or NULL */
@ -7329,7 +7320,8 @@ build_template_needs_field(
{ {
const Field* field = table->field[i]; 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; return NULL;
} }
@ -7486,7 +7478,7 @@ build_template_field(
&templ->rec_prefix_field_no); &templ->rec_prefix_field_no);
} }
} else { } 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; col = &dict_table_get_nth_v_col(index->table, v_no)->m_col;
templ->clust_rec_field_no = v_no; templ->clust_rec_field_no = v_no;
templ->rec_prefix_field_no = ULINT_UNDEFINED; templ->rec_prefix_field_no = ULINT_UNDEFINED;
@ -7876,7 +7868,8 @@ no_icp:
continue; continue;
} }
} else { } else {
if (is_v && index->is_primary()) { if (is_v
&& (skip_virtual || index->is_primary())) {
num_v++; num_v++;
continue; continue;
} }
@ -8364,7 +8357,7 @@ calc_row_difference(
trx_t* const trx = prebuilt->trx; trx_t* const trx = prebuilt->trx;
doc_id_t doc_id = FTS_NULL_DOC_ID; doc_id_t doc_id = FTS_NULL_DOC_ID;
ulint num_v = 0; 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); ut_ad(!srv_read_only_mode);
@ -10942,7 +10935,7 @@ create_table_info_t::create_table_def()
/* Find out the number of virtual columns. */ /* Find out the number of virtual columns. */
ulint num_v = 0; 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 const ulint n_cols = omit_virtual
? m_form->s->stored_fields : m_form->s->fields; ? m_form->s->stored_fields : m_form->s->fields;

View File

@ -21,6 +21,8 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include <mysql/service_wsrep.h> #include <mysql/service_wsrep.h>
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
#include "table.h"
/* The InnoDB handler: the interface between MySQL and InnoDB. */ /* The InnoDB handler: the interface between MySQL and InnoDB. */
/** "GEN_CLUST_INDEX" is the name reserved for InnoDB default /** "GEN_CLUST_INDEX" is the name reserved for InnoDB default
@ -421,6 +423,14 @@ public:
Item* idx_cond_push(uint keyno, Item* idx_cond); Item* idx_cond_push(uint keyno, Item* idx_cond);
/* @} */ /* @} */
/** 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;
}
/** Push a primary key filter. /** Push a primary key filter.
@param[in] pk_filter filter against which primary keys @param[in] pk_filter filter against which primary keys
are to be checked are to be checked
@ -428,7 +438,6 @@ public:
bool rowid_filter_push(Rowid_filter *rowid_filter); bool rowid_filter_push(Rowid_filter *rowid_filter);
protected: protected:
/** /**
MySQL calls this method at the end of each statement. This method MySQL calls this method at the end of each statement. This method
exists for readability only, called from reset(). The name reset() exists for readability only, called from reset(). The name reset()
@ -445,7 +454,6 @@ protected:
@see build_template() */ @see build_template() */
void reset_template(); void reset_template();
protected:
inline void update_thd(THD* thd); inline void update_thd(THD* thd);
void update_thd(); void update_thd();

View File

@ -4169,7 +4169,8 @@ innobase_build_col_map(
>= altered_table->s->fields + DATA_N_SYS_COLS); >= altered_table->s->fields + DATA_N_SYS_COLS);
DBUG_ASSERT(dict_table_get_n_cols(old_table) DBUG_ASSERT(dict_table_get_n_cols(old_table)
+ dict_table_get_n_v_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 DBUG_ASSERT(!!defaults == !!(ha_alter_info->handler_flags
& INNOBASE_DEFAULTS)); & INNOBASE_DEFAULTS));
DBUG_ASSERT(!defaults || dtuple_get_n_fields(defaults) DBUG_ASSERT(!defaults || dtuple_get_n_fields(defaults)
@ -5750,7 +5751,9 @@ add_all_virtual:
} else if (page_rec_is_supremum(rec)) { } else if (page_rec_is_supremum(rec)) {
empty_table: empty_table:
/* The table is empty. */ /* 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);
/* MDEV-17383: free metadata BLOBs! */ /* MDEV-17383: free metadata BLOBs! */
btr_page_empty(block, NULL, index, 0, &mtr); btr_page_empty(block, NULL, index, 0, &mtr);
index->clear_instant_alter(); index->clear_instant_alter();

View File

@ -551,14 +551,13 @@ btr_set_min_rec_mark(
rec_t* rec, /*!< in/out: record */ rec_t* rec, /*!< in/out: record */
mtr_t* mtr) /*!< in: mtr */ mtr_t* mtr) /*!< in: mtr */
MY_ATTRIBUTE((nonnull)); MY_ATTRIBUTE((nonnull));
/*************************************************************//** /** Seek to the parent page of a B-tree page.
Deletes on the upper level the node pointer to a page. */ @param[in,out] index b-tree
void @param[in] block child page
btr_node_ptr_delete( @param[in,out] mtr mini-transaction
/*================*/ @param[out] cursor cursor pointing to the x-latched parent page */
dict_index_t* index, /*!< in: index tree */ void btr_page_get_father(dict_index_t* index, buf_block_t* block, mtr_t* mtr,
buf_block_t* block, /*!< in: page whose node pointer is deleted */ btr_cur_t* cursor)
mtr_t* mtr) /*!< in: mtr */
MY_ATTRIBUTE((nonnull)); MY_ATTRIBUTE((nonnull));
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
/************************************************************//** /************************************************************//**

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2018, MariaDB Corporation. Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
@ -558,6 +558,11 @@ btr_cur_pessimistic_delete(
bool rollback,/*!< in: performing rollback? */ bool rollback,/*!< in: performing rollback? */
mtr_t* mtr) /*!< in: mtr */ mtr_t* mtr) /*!< in: mtr */
MY_ATTRIBUTE((nonnull)); MY_ATTRIBUTE((nonnull));
/** Delete the node pointer in a parent page.
@param[in,out] parent cursor pointing to parent record
@param[in,out] mtr mini-transaction */
void btr_cur_node_ptr_delete(btr_cur_t* parent, mtr_t* mtr)
MY_ATTRIBUTE((nonnull));
/***********************************************************//** /***********************************************************//**
Parses a redo log record of updating a record in-place. Parses a redo log record of updating a record in-place.
@return end of log record or NULL */ @return end of log record or NULL */

View File

@ -544,20 +544,6 @@ normalize_table_name_c_low(
const char* name, /*!< in: table name string */ const char* name, /*!< in: table name string */
ibool set_lower_case); /*!< in: TRUE if we want to set ibool set_lower_case); /*!< in: TRUE if we want to set
name to lower case */ name to lower case */
/******************************************************************//**
Gets information on the durability property requested by thread.
Used when writing either a prepare or commit record to the log
buffer.
@return the durability property. */
#include <dur_prop.h>
enum durability_properties
thd_requested_durability(
/*=====================*/
const THD* thd) /*!< in: thread handle */
MY_ATTRIBUTE((warn_unused_result));
/** Update the system variable with the given value of the InnoDB /** Update the system variable with the given value of the InnoDB
buffer pool size. buffer pool size.
@param[in] buf_pool_size given value of buffer pool size.*/ @param[in] buf_pool_size given value of buffer pool size.*/

View File

@ -1,6 +1,6 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 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 the terms of the GNU General Public License as published by the Free Software
@ -727,9 +727,7 @@ page_rec_get_heap_no(
/** Determine whether a page has any siblings. /** Determine whether a page has any siblings.
@param[in] page page frame @param[in] page page frame
@return true if the page has any siblings */ @return true if the page has any siblings */
inline inline bool page_has_siblings(const page_t* page)
bool
page_has_siblings(const page_t* page)
{ {
compile_time_assert(!(FIL_PAGE_PREV % 8)); compile_time_assert(!(FIL_PAGE_PREV % 8));
compile_time_assert(FIL_PAGE_NEXT == FIL_PAGE_PREV + 4); compile_time_assert(FIL_PAGE_NEXT == FIL_PAGE_PREV + 4);
@ -738,22 +736,10 @@ page_has_siblings(const page_t* page)
!= ~uint64_t(0); != ~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. /** Determine whether a page has a predecessor.
@param[in] page page frame @param[in] page page frame
@return true if the page has a predecessor */ @return true if the page has a predecessor */
inline inline bool page_has_prev(const page_t* page)
bool
page_has_prev(const page_t* page)
{ {
return *reinterpret_cast<const uint32_t*>(page + FIL_PAGE_PREV) return *reinterpret_cast<const uint32_t*>(page + FIL_PAGE_PREV)
!= FIL_NULL; != FIL_NULL;
@ -762,9 +748,7 @@ page_has_prev(const page_t* page)
/** Determine whether a page has a successor. /** Determine whether a page has a successor.
@param[in] page page frame @param[in] page page frame
@return true if the page has a successor */ @return true if the page has a successor */
inline inline bool page_has_next(const page_t* page)
bool
page_has_next(const page_t* page)
{ {
return *reinterpret_cast<const uint32_t*>(page + FIL_PAGE_NEXT) return *reinterpret_cast<const uint32_t*>(page + FIL_PAGE_NEXT)
!= FIL_NULL; != FIL_NULL;

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved. 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 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 the terms of the GNU General Public License as published by the Free Software
@ -83,7 +83,8 @@ UNIV_INLINE
ib_uint64_t ib_uint64_t
page_get_autoinc(const page_t* page) 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)); return(mach_read_from_8(PAGE_HEADER + PAGE_ROOT_AUTO_INC + page));
} }
@ -164,6 +165,7 @@ page_header_set_field(
{ {
ut_ad(page); ut_ad(page);
ut_ad(field <= PAGE_N_RECS); 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 < srv_page_size);
ut_ad(field != PAGE_N_HEAP || (val & 0x7fff) < srv_page_size); ut_ad(field != PAGE_N_HEAP || (val & 0x7fff) < srv_page_size);

View File

@ -2,7 +2,7 @@
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc. 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 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 the terms of the GNU General Public License as published by the Free Software
@ -1982,12 +1982,14 @@ page_parse_copy_rec_list_to_created_page(
return(rec_end); return(rec_end);
} }
ut_ad(fil_page_index_page_check(block->frame));
/* This function is never invoked on the clustered index root page, /* This function is never invoked on the clustered index root page,
except in the redo log apply of except in the redo log apply of
page_copy_rec_list_end_to_created_page() which was logged by. page_copy_rec_list_end_to_created_page() which was logged by.
page_copy_rec_list_to_created_page_write_log(). page_copy_rec_list_to_created_page_write_log().
For other pages, this field must be zero-initialized. */ 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) { while (ptr < rec_end) {
ptr = page_cur_parse_insert_rec(TRUE, ptr, end_ptr, ptr = page_cur_parse_insert_rec(TRUE, ptr, end_ptr,
@ -2043,9 +2045,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_dir_get_n_heap(new_page) == PAGE_HEAP_NO_USER_LOW);
ut_ad(page_align(rec) != new_page); ut_ad(page_align(rec) != new_page);
ut_ad(page_rec_is_comp(rec) == page_is_comp(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, /* This function is never invoked on the clustered index root page,
except in btr_lift_page_up(). */ 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)) { if (page_rec_is_infimum(rec)) {
@ -2138,6 +2141,8 @@ page_copy_rec_list_end_to_created_page(
rec = page_rec_get_next(rec); rec = page_rec_get_next(rec);
} while (!page_rec_is_supremum(rec)); } while (!page_rec_is_supremum(rec));
ut_ad(n_recs);
if ((slot_index > 0) && (count + 1 if ((slot_index > 0) && (count + 1
+ (PAGE_DIR_SLOT_MAX_N_OWNED + 1) / 2 + (PAGE_DIR_SLOT_MAX_N_OWNED + 1) / 2
<= PAGE_DIR_SLOT_MAX_N_OWNED)) { <= PAGE_DIR_SLOT_MAX_N_OWNED)) {

View File

@ -2,7 +2,7 @@
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc. 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 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 the terms of the GNU General Public License as published by the Free Software
@ -507,6 +507,8 @@ page_create_empty(
page_zip_des_t* page_zip= buf_block_get_page_zip(block); page_zip_des_t* page_zip= buf_block_get_page_zip(block);
ut_ad(fil_page_index_page_check(page)); 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 /* Multiple transactions cannot simultaneously operate on the
same temp-table in parallel. same temp-table in parallel.
@ -517,7 +519,7 @@ page_create_empty(
&& page_is_leaf(page)) { && page_is_leaf(page)) {
max_trx_id = page_get_max_trx_id(page); max_trx_id = page_get_max_trx_id(page);
ut_ad(max_trx_id); 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. */ /* Preserve PAGE_ROOT_AUTO_INC. */
max_trx_id = page_get_max_trx_id(page); max_trx_id = page_get_max_trx_id(page);
} else { } else {
@ -1210,6 +1212,7 @@ delete_all:
page_header_set_field(page, NULL, PAGE_GARBAGE, size page_header_set_field(page, NULL, PAGE_GARBAGE, size
+ page_header_get_field(page, PAGE_GARBAGE)); + 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, page_header_set_field(page, NULL, PAGE_N_RECS,
(ulint)(page_get_n_recs(page) - n_recs)); (ulint)(page_get_n_recs(page) - n_recs));
} }

View File

@ -4470,10 +4470,12 @@ page_zip_dir_delete(
slot_rec = page_zip_dir_find(page_zip, page_offset(rec)); slot_rec = page_zip_dir_find(page_zip, page_offset(rec));
ut_a(slot_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(). */ /* This could not be done before page_zip_dir_find(). */
page_header_set_field(page, page_zip, PAGE_N_RECS, page_header_set_field(page, page_zip, PAGE_N_RECS,
(ulint)(page_get_n_recs(page) - 1)); n_recs - 1);
if (UNIV_UNLIKELY(!free)) { if (UNIV_UNLIKELY(!free)) {
/* Make the last slot the start of the free list. */ /* Make the last slot the start of the free list. */
@ -4747,7 +4749,7 @@ page_zip_reorganize(
clustered index root pages. */ clustered index root pages. */
ut_ad(page_get_max_trx_id(page) == 0 ut_ad(page_get_max_trx_id(page) == 0
|| (dict_index_is_clust(index) || (dict_index_is_clust(index)
? page_is_root(temp_page) ? !page_has_siblings(temp_page)
: page_is_leaf(temp_page))); : page_is_leaf(temp_page)));
/* Restore logging. */ /* Restore logging. */

View File

@ -670,7 +670,7 @@ dberr_t FetchIndexRootPages::operator()(buf_block_t* block) UNIV_NOTHROW
return set_current_xdes(block->page.id.page_no(), page); return set_current_xdes(block->page.id.page_no(), page);
} else if (fil_page_index_page_check(page) } else if (fil_page_index_page_check(page)
&& !is_free(block->page.id.page_no()) && !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); index_id_t id = btr_page_get_index_id(page);
@ -1829,9 +1829,9 @@ PageConverter::update_index_page(
page, m_page_zip_ptr, m_index->m_srv_index->id, 0); page, m_page_zip_ptr, m_index->m_srv_index->id, 0);
if (dict_index_is_clust(m_index->m_srv_index)) { if (dict_index_is_clust(m_index->m_srv_index)) {
if (page_is_root(page)) { dict_index_t* index = const_cast<dict_index_t*>(
dict_index_t* index = const_cast<dict_index_t*>( m_index->m_srv_index);
m_index->m_srv_index); if (block->page.id.page_no() == index->page) {
/* Preserve the PAGE_ROOT_AUTO_INC. */ /* Preserve the PAGE_ROOT_AUTO_INC. */
if (index->table->supports_instant()) { if (index->table->supports_instant()) {
if (btr_cur_instant_root_init(index, page)) { if (btr_cur_instant_root_init(index, page)) {
@ -1882,7 +1882,7 @@ PageConverter::update_index_page(
if (page_is_empty(page)) { if (page_is_empty(page)) {
/* Only a root page can be empty. */ /* 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 // TODO: We should relax this and skip secondary
// indexes. Mark them as corrupt because they can // indexes. Mark them as corrupt because they can
// always be rebuilt. // always be rebuilt.

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2011, 2018, Oracle and/or its affiliates. All Rights Reserved. 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 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 the terms of the GNU General Public License as published by the Free Software
@ -963,7 +963,8 @@ row_log_table_low(
break; break;
case FIL_PAGE_TYPE_INSTANT: case FIL_PAGE_TYPE_INSTANT:
ut_ad(index->is_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; break;
default: default:
ut_ad(!"wrong page type"); ut_ad(!"wrong page type");