Merge 10.3 into 10.4

This commit is contained in:
Marko Mäkelä 2020-03-30 14:50:23 +03:00
commit e2f1f88fa6
85 changed files with 1554 additions and 797 deletions

View File

@ -222,7 +222,7 @@ ENDIF()
OPTION(WITH_UBSAN "Enable undefined behavior sanitizer" OFF) OPTION(WITH_UBSAN "Enable undefined behavior sanitizer" OFF)
IF (WITH_UBSAN) IF (WITH_UBSAN)
MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=undefined -fno-sanitize=alignment -U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO) MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=undefined -fno-sanitize=alignment -U_FORTIFY_SOURCE -DWITH_UBSAN" DEBUG RELWITHDEBINFO)
ENDIF() ENDIF()
OPTION(WITH_MSAN "Enable memory sanitizer" OFF) OPTION(WITH_MSAN "Enable memory sanitizer" OFF)

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. /* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2009, 2019, MariaDB Corporation. Copyright (c) 2009, 2020, 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
@ -705,7 +705,7 @@ extern void my_mutex_end(void);
We need to have at least 256K stack to handle calls to myisamchk_init() We need to have at least 256K stack to handle calls to myisamchk_init()
with the current number of keys and key parts. with the current number of keys and key parts.
*/ */
#ifdef __SANITIZE_ADDRESS__ #if defined(__SANITIZE_ADDRESS__) || defined(WITH_UBSAN)
#define DEFAULT_THREAD_STACK (383*1024L) /* 392192 */ #define DEFAULT_THREAD_STACK (383*1024L) /* 392192 */
#else #else
#define DEFAULT_THREAD_STACK (292*1024L) /* 299008 */ #define DEFAULT_THREAD_STACK (292*1024L) /* 299008 */

141
include/span.h Normal file
View File

@ -0,0 +1,141 @@
/*****************************************************************************
Copyright (c) 2019, 2020 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
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
*****************************************************************************/
#pragma once
#include <cstddef>
#include <iterator>
namespace st_
{
template <class ElementType> class span
{
public:
typedef ElementType element_type;
typedef ElementType value_type;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef element_type *pointer;
typedef const element_type *const_pointer;
typedef element_type &reference;
typedef const element_type &const_reference;
typedef pointer iterator;
typedef const_pointer const_iterator;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
span() : data_(NULL), size_(0) {}
span(pointer ptr, size_type count) : data_(ptr), size_(count) {}
span(pointer first, pointer last) : data_(first), size_(last - first) {}
template <size_t N> span(element_type (&arr)[N]) : data_(arr), size_(N) {}
template <class Container>
span(Container &cont) : data_(cont.data()), size_(cont.size())
{
}
template <class Container>
span(const Container &cont) : data_(cont.data()), size_(cont.size())
{
}
span(const span &other) : data_(other.data_), size_(other.size_) {}
~span(){};
span &operator=(const span &other)
{
data_= other.data_;
size_= other.size_;
return *this;
}
template <size_t Count> span<element_type> first() const
{
assert(!empty());
return span(data_, 1);
}
template <size_t Count> span<element_type> last() const
{
assert(!empty());
return span(data_ + size() - 1, 1);
}
span<element_type> first(size_type count) const
{
assert(!empty());
return span(data_, 1);
}
span<element_type> last(size_type count) const
{
assert(!empty());
return span(data_ + size() - 1, 1);
}
span<element_type> subspan(size_type offset, size_type count) const
{
assert(!empty());
assert(size() >= offset + count);
return span(data_ + offset, count);
}
size_type size() const { return size_; }
size_type size_bytes() const { return size_ * sizeof(ElementType); }
bool empty() const __attribute__((warn_unused_result)) { return size_ == 0; }
reference operator[](size_type idx) const
{
assert(size() > idx);
return data_[idx];
}
reference front() const
{
assert(!empty());
return data_[0];
}
reference back() const
{
assert(!empty());
return data_[size() - 1];
}
pointer data() const
{
assert(!empty());
return data_;
}
iterator begin() const { return data_; }
iterator end() const { return data_ + size_; }
reverse_iterator rbegin() const
{
return std::reverse_iterator<iterator>(std::advance(end(), -1));
}
reverse_iterator rend() const
{
return std::reverse_iterator<iterator>(std::advance(begin(), -1));
}
private:
pointer data_;
size_type size_;
};
} // namespace st_

View File

@ -1,20 +1,19 @@
# #
# Takes the flag as an argument: # Takes the flag as an argument:
# -- let $io_thd_injection_fault_flag=+d,fault_injection_new_file_rotate_event # -- let $io_thd_injection_fault_flag=d,fault_injection_new_file_rotate_event
# -- source include/io_thd_fault_injection.inc # -- source include/io_thd_fault_injection.inc
# #
SET @old_debug=@@global.debug; SET @saved_debug=@@global.debug_dbug;
-- disable_warnings -- disable_warnings
-- source include/stop_slave.inc -- source include/stop_slave.inc
-- enable_warnings -- enable_warnings
-- eval SET GLOBAL debug_dbug="+d,$io_thd_injection_fault_flag" -- eval SET @@global.debug_dbug="d,$io_thd_injection_fault_flag"
START SLAVE io_thread; START SLAVE io_thread;
-- source include/wait_for_slave_io_error.inc -- source include/wait_for_slave_io_error.inc
-- eval SET GLOBAL debug_dbug="-d,$io_thd_injection_fault_flag" SET @@global.debug_dbug=@saved_debug;
SET GLOBAL debug_dbug=@old_debug;
# restart because slave is in bad shape # restart because slave is in bad shape
--let $rpl_server_number= 2 --let $rpl_server_number= 2

View File

@ -10578,6 +10578,18 @@ a b max_c a b dayname(v1.b)
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1, t2; DROP TABLE t1, t2;
SET optimizer_switch=DEFAULT; SET optimizer_switch=DEFAULT;
#
# MDEV-17177: an attempt to push down IN predicate when one of
# the arguments is too complex to be cloned
#
CREATE TABLE t1 (a VARCHAR(8));
INSERT INTO t1 VALUES ('abc'),('def');
CREATE VIEW v1 AS SELECT * FROM t1 GROUP BY a;
SELECT * FROM v1 WHERE IF( a REGEXP 'def', 'foo', a ) IN ('abc', 'foobar');
a
abc
DROP VIEW v1;
DROP TABLE t1;
# End of 10.2 tests # End of 10.2 tests
# #
# MDEV-14579: pushdown conditions into materialized views/derived tables # MDEV-14579: pushdown conditions into materialized views/derived tables
@ -16912,6 +16924,91 @@ Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` semi join ((/* select#3 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`ro_id` = `test`.`t1`.`id` and `test`.`t2`.`flag` = 1) where `test`.`t1`.`id` = `test`.`t1`.`id` group by `test`.`t1`.`id`) `dt`) where `dt`.`id` = `test`.`t1`.`id` Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` semi join ((/* select#3 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`ro_id` = `test`.`t1`.`id` and `test`.`t2`.`flag` = 1) where `test`.`t1`.`id` = `test`.`t1`.`id` group by `test`.`t1`.`id`) `dt`) where `dt`.`id` = `test`.`t1`.`id`
drop view v1; drop view v1;
drop table t1,t2; drop table t1,t2;
#
# MDEV-21883: potentially splittable materialized derived
# that uses a join of 32 tables
#
CREATE TABLE t (id INT NOT NULL PRIMARY KEY);
INSERT INTO t values (1),(2),(3);
set statement optimizer_switch='split_materialized=off' for SELECT t.id FROM t
LEFT JOIN (
SELECT t0.id FROM t AS t0
LEFT JOIN t AS t1 ON 0=1
LEFT JOIN t AS t2 ON 0=1
LEFT JOIN t AS t3 ON 0=1
LEFT JOIN t AS t4 ON 0=1
LEFT JOIN t AS t5 ON 0=1
LEFT JOIN t AS t6 ON 0=1
LEFT JOIN t AS t7 ON 0=1
LEFT JOIN t AS t8 ON 0=1
LEFT JOIN t AS t9 ON 0=1
LEFT JOIN t AS t10 ON 0=1
LEFT JOIN t AS t11 ON 0=1
LEFT JOIN t AS t12 ON 0=1
LEFT JOIN t AS t13 ON 0=1
LEFT JOIN t AS t14 ON 0=1
LEFT JOIN t AS t15 ON 0=1
LEFT JOIN t AS t16 ON 0=1
LEFT JOIN t AS t17 ON 0=1
LEFT JOIN t AS t18 ON 0=1
LEFT JOIN t AS t19 ON 0=1
LEFT JOIN t AS t20 ON 0=1
LEFT JOIN t AS t21 ON 0=1
LEFT JOIN t AS t22 ON 0=1
LEFT JOIN t AS t23 ON 0=1
LEFT JOIN t AS t24 ON 0=1
LEFT JOIN t AS t25 ON 0=1
LEFT JOIN t AS t26 ON 0=1
LEFT JOIN t AS t27 ON 0=1
LEFT JOIN t AS t28 ON 0=1
LEFT JOIN t AS t29 ON 0=1
LEFT JOIN t AS t30 ON 0=1
LEFT JOIN t AS t31 ON 0=1
GROUP BY t0.id) AS dt ON dt.id = t.id;
id
1
2
3
set statement optimizer_switch='split_materialized=on' for SELECT t.id FROM t
LEFT JOIN (
SELECT t0.id FROM t AS t0
LEFT JOIN t AS t1 ON 0=1
LEFT JOIN t AS t2 ON 0=1
LEFT JOIN t AS t3 ON 0=1
LEFT JOIN t AS t4 ON 0=1
LEFT JOIN t AS t5 ON 0=1
LEFT JOIN t AS t6 ON 0=1
LEFT JOIN t AS t7 ON 0=1
LEFT JOIN t AS t8 ON 0=1
LEFT JOIN t AS t9 ON 0=1
LEFT JOIN t AS t10 ON 0=1
LEFT JOIN t AS t11 ON 0=1
LEFT JOIN t AS t12 ON 0=1
LEFT JOIN t AS t13 ON 0=1
LEFT JOIN t AS t14 ON 0=1
LEFT JOIN t AS t15 ON 0=1
LEFT JOIN t AS t16 ON 0=1
LEFT JOIN t AS t17 ON 0=1
LEFT JOIN t AS t18 ON 0=1
LEFT JOIN t AS t19 ON 0=1
LEFT JOIN t AS t20 ON 0=1
LEFT JOIN t AS t21 ON 0=1
LEFT JOIN t AS t22 ON 0=1
LEFT JOIN t AS t23 ON 0=1
LEFT JOIN t AS t24 ON 0=1
LEFT JOIN t AS t25 ON 0=1
LEFT JOIN t AS t26 ON 0=1
LEFT JOIN t AS t27 ON 0=1
LEFT JOIN t AS t28 ON 0=1
LEFT JOIN t AS t29 ON 0=1
LEFT JOIN t AS t30 ON 0=1
LEFT JOIN t AS t31 ON 0=1
GROUP BY t0.id) AS dt ON dt.id = t.id;
id
1
2
3
DROP TABLE t;
# End of 10.3 tests # End of 10.3 tests
# #
# MDEV-18679: materialized view with SELECT S containing materialized # MDEV-18679: materialized view with SELECT S containing materialized

View File

@ -2169,6 +2169,22 @@ DROP TABLE t1, t2;
SET optimizer_switch=DEFAULT; SET optimizer_switch=DEFAULT;
--echo #
--echo # MDEV-17177: an attempt to push down IN predicate when one of
--echo # the arguments is too complex to be cloned
--echo #
CREATE TABLE t1 (a VARCHAR(8));
INSERT INTO t1 VALUES ('abc'),('def');
CREATE VIEW v1 AS SELECT * FROM t1 GROUP BY a;
SELECT * FROM v1 WHERE IF( a REGEXP 'def', 'foo', a ) IN ('abc', 'foobar');
DROP VIEW v1;
DROP TABLE t1;
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo # --echo #
@ -3371,6 +3387,57 @@ eval explain extended $q2;
drop view v1; drop view v1;
drop table t1,t2; drop table t1,t2;
--echo #
--echo # MDEV-21883: potentially splittable materialized derived
--echo # that uses a join of 32 tables
--echo #
CREATE TABLE t (id INT NOT NULL PRIMARY KEY);
INSERT INTO t values (1),(2),(3);
let $q=
SELECT t.id FROM t
LEFT JOIN (
SELECT t0.id FROM t AS t0
LEFT JOIN t AS t1 ON 0=1
LEFT JOIN t AS t2 ON 0=1
LEFT JOIN t AS t3 ON 0=1
LEFT JOIN t AS t4 ON 0=1
LEFT JOIN t AS t5 ON 0=1
LEFT JOIN t AS t6 ON 0=1
LEFT JOIN t AS t7 ON 0=1
LEFT JOIN t AS t8 ON 0=1
LEFT JOIN t AS t9 ON 0=1
LEFT JOIN t AS t10 ON 0=1
LEFT JOIN t AS t11 ON 0=1
LEFT JOIN t AS t12 ON 0=1
LEFT JOIN t AS t13 ON 0=1
LEFT JOIN t AS t14 ON 0=1
LEFT JOIN t AS t15 ON 0=1
LEFT JOIN t AS t16 ON 0=1
LEFT JOIN t AS t17 ON 0=1
LEFT JOIN t AS t18 ON 0=1
LEFT JOIN t AS t19 ON 0=1
LEFT JOIN t AS t20 ON 0=1
LEFT JOIN t AS t21 ON 0=1
LEFT JOIN t AS t22 ON 0=1
LEFT JOIN t AS t23 ON 0=1
LEFT JOIN t AS t24 ON 0=1
LEFT JOIN t AS t25 ON 0=1
LEFT JOIN t AS t26 ON 0=1
LEFT JOIN t AS t27 ON 0=1
LEFT JOIN t AS t28 ON 0=1
LEFT JOIN t AS t29 ON 0=1
LEFT JOIN t AS t30 ON 0=1
LEFT JOIN t AS t31 ON 0=1
GROUP BY t0.id) AS dt ON dt.id = t.id;
eval set statement optimizer_switch='split_materialized=off' for $q;
eval set statement optimizer_switch='split_materialized=on' for $q;
DROP TABLE t;
--echo # End of 10.3 tests --echo # End of 10.3 tests
--echo # --echo #

View File

@ -2870,6 +2870,20 @@ GROUP BY REPEAT((BINARY pk), v1), AES_DECRYPT((@A := i1), 20852) WITH ROLLUP HAV
1 1
drop table t1; drop table t1;
# #
# MDEV-22019: Sig 11 in next_breadth_first_tab | max_sort_length setting + double
# GROUP BY leads to crash
#
CALL mtr.add_suppression("Out of sort memory");
CALL mtr.add_suppression("Sort aborted");
SET @save_max_sort_length= @@max_sort_length;
SET max_sort_length=2000000;
SELECT * FROM information_schema.tables t JOIN information_schema.columns c
ON t.table_schema=c.table_schema
WHERE c.table_schema=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.columns GROUP BY column_type)
GROUP BY t.table_name;
ERROR HY001: Out of sort memory, consider increasing server sort buffer size
SET max_sort_length= @save_max_sort_length;
#
# MDEV-16170 # MDEV-16170
# Server crashes in Item_null_result::type_handler on SELECT with ROLLUP # Server crashes in Item_null_result::type_handler on SELECT with ROLLUP
# #
@ -2880,3 +2894,4 @@ f COUNT(*)
1 1 1 1
NULL 1 NULL 1
DROP TABLE t1; DROP TABLE t1;
# End of 10.3 tests

View File

@ -1982,6 +1982,23 @@ SELECT 1 FROM t1
GROUP BY REPEAT((BINARY pk), v1), AES_DECRYPT((@A := i1), 20852) WITH ROLLUP HAVING LOAD_FILE('a') ; GROUP BY REPEAT((BINARY pk), v1), AES_DECRYPT((@A := i1), 20852) WITH ROLLUP HAVING LOAD_FILE('a') ;
drop table t1; drop table t1;
--echo #
--echo # MDEV-22019: Sig 11 in next_breadth_first_tab | max_sort_length setting + double
--echo # GROUP BY leads to crash
--echo #
CALL mtr.add_suppression("Out of sort memory");
CALL mtr.add_suppression("Sort aborted");
SET @save_max_sort_length= @@max_sort_length;
SET max_sort_length=2000000;
--error ER_OUT_OF_SORTMEMORY
SELECT * FROM information_schema.tables t JOIN information_schema.columns c
ON t.table_schema=c.table_schema
WHERE c.table_schema=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.columns GROUP BY column_type)
GROUP BY t.table_name;
SET max_sort_length= @save_max_sort_length;
--echo # --echo #
--echo # MDEV-16170 --echo # MDEV-16170
--echo # Server crashes in Item_null_result::type_handler on SELECT with ROLLUP --echo # Server crashes in Item_null_result::type_handler on SELECT with ROLLUP
@ -1991,3 +2008,5 @@ CREATE TABLE t1 (d DATE);
INSERT INTO t1 VALUES ('2032-10-08'); INSERT INTO t1 VALUES ('2032-10-08');
SELECT d != '2023-03-04' AS f, COUNT(*) FROM t1 GROUP BY d WITH ROLLUP; SELECT d != '2023-03-04' AS f, COUNT(*) FROM t1 GROUP BY d WITH ROLLUP;
DROP TABLE t1; DROP TABLE t1;
--echo # End of 10.3 tests

View File

@ -21,6 +21,7 @@ connection con3;
set @@autocommit=0; set @@autocommit=0;
DROP TABLE t1; DROP TABLE t1;
connection con1; connection con1;
# Waiting for until transaction will be locked inside innodb subsystem
# Connection 1 is now holding the lock. # Connection 1 is now holding the lock.
# Issuing insert from connection 1 while connection 2&3 # Issuing insert from connection 1 while connection 2&3
# is waiting for the lock should give a deadlock error. # is waiting for the lock should give a deadlock error.

View File

@ -1,3 +1,4 @@
--source include/have_metadata_lock_info.inc
-- source include/have_innodb.inc -- source include/have_innodb.inc
# Save the initial number of concurrent sessions. # Save the initial number of concurrent sessions.
@ -36,10 +37,12 @@ set @@autocommit=0;
--send DROP TABLE t1 --send DROP TABLE t1
connection con1; connection con1;
--echo # Waiting for until transaction will be locked inside innodb subsystem
let $wait_condition= let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist SELECT COUNT(*) = 1 FROM information_schema.innodb_trx
WHERE info = "INSERT INTO t1 VALUES (1)" and WHERE trx_query = 'INSERT INTO t1 VALUES (1)' AND
state = "update"; trx_operation_state = 'inserting' AND
trx_state = 'LOCK WAIT';
--source include/wait_condition.inc --source include/wait_condition.inc
let $wait_condition= let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist SELECT COUNT(*) = 1 FROM information_schema.processlist

View File

@ -22,7 +22,7 @@ master-bin.000001 #
master-bin.000002 # master-bin.000002 #
###################### TEST #2 ###################### TEST #2
RESET MASTER; RESET MASTER;
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
FLUSH LOGS; FLUSH LOGS;
ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
@ -30,7 +30,7 @@ ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
show binary logs; show binary logs;
Log_name File_size Log_name File_size
master-bin.000001 # master-bin.000001 #
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
RESET MASTER; RESET MASTER;
###################### TEST #3 ###################### TEST #3
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
@ -44,11 +44,11 @@ show binary logs;
Log_name File_size Log_name File_size
master-bin.000001 # master-bin.000001 #
master-bin.000002 # master-bin.000002 #
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
DELETE FROM t2; DELETE FROM t2;
RESET MASTER; RESET MASTER;
###################### TEST #4 ###################### TEST #4
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2;
ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
@ -56,21 +56,21 @@ ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
1 1
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
DELETE FROM t2; DELETE FROM t2;
RESET MASTER; RESET MASTER;
###################### TEST #5 ###################### TEST #5
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166-2.data' INTO TABLE t2; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166-2.data' INTO TABLE t2;
# assert: must show one entry # assert: must show one entry
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
1 1
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
DELETE FROM t2; DELETE FROM t2;
RESET MASTER; RESET MASTER;
###################### TEST #6 ###################### TEST #6
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
SET AUTOCOMMIT=0; SET AUTOCOMMIT=0;
INSERT INTO t2 VALUES ('muse'); INSERT INTO t2 VALUES ('muse');
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2;
@ -83,11 +83,11 @@ SELECT count(*) FROM t2;
count(*) count(*)
3 3
SET AUTOCOMMIT= 1; SET AUTOCOMMIT= 1;
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
DELETE FROM t2; DELETE FROM t2;
RESET MASTER; RESET MASTER;
###################### TEST #7 ###################### TEST #7
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
SET @@binlog_annotate_row_events= 0; SET @@binlog_annotate_row_events= 0;
SELECT count(*) FROM t4; SELECT count(*) FROM t4;
count(*) count(*)
@ -100,14 +100,14 @@ SELECT count(*) FROM t4;
count(*) count(*)
1 1
### check that the incident event is written to the current log ### check that the incident event is written to the current log
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Incident # # #1 (LOST_EVENTS) master-bin.000001 # Incident # # #1 (LOST_EVENTS)
DELETE FROM t4; DELETE FROM t4;
RESET MASTER; RESET MASTER;
###################### TEST #8 ###################### TEST #8
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
# must show 0 entries # must show 0 entries
SELECT count(*) FROM t4; SELECT count(*) FROM t4;
count(*) count(*)
@ -147,9 +147,9 @@ count(*)
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
0 0
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
###################### TEST #9 ###################### TEST #9
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
SET SQL_LOG_BIN=0; SET SQL_LOG_BIN=0;
INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd'); INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd');
INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh'); INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh');
@ -170,17 +170,17 @@ SELECT count(*) FROM t4;
count(*) count(*)
0 0
SET SQL_LOG_BIN=1; SET SQL_LOG_BIN=1;
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
###################### TEST #10 ###################### TEST #10
call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file.");
call mtr.add_suppression("Could not use .*"); call mtr.add_suppression("Could not use .*");
RESET MASTER; RESET MASTER;
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
SET GLOBAL debug_dbug="+d,fault_injection_registering_index"; SET @@global.debug_dbug="d,fault_injection_registering_index";
FLUSH LOGS; FLUSH LOGS;
ERROR HY000: Can't open file: 'master-bin.000002' (errno: 1 "Operation not permitted") ERROR HY000: Can't open file: 'master-bin.000002' (errno: 1 "Operation not permitted")
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
SHOW BINARY LOGS; SHOW BINARY LOGS;
ERROR HY000: You are not using binary logging ERROR HY000: You are not using binary logging
CREATE TABLE t5 (a INT); CREATE TABLE t5 (a INT);
@ -192,10 +192,10 @@ DROP TABLE t5;
flush tables; flush tables;
###################### TEST #11 ###################### TEST #11
include/rpl_restart_server.inc [server_number=1] include/rpl_restart_server.inc [server_number=1]
SET GLOBAL debug_dbug="+d,fault_injection_openning_index"; SET @@global.debug_dbug="d,fault_injection_openning_index";
FLUSH LOGS; FLUSH LOGS;
ERROR HY000: Can't open file: 'master-bin.index' (errno: 1 "Operation not permitted") ERROR HY000: Can't open file: 'master-bin.index' (errno: 1 "Operation not permitted")
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
RESET MASTER; RESET MASTER;
ERROR HY000: Binlog closed, cannot RESET MASTER ERROR HY000: Binlog closed, cannot RESET MASTER
CREATE TABLE t5 (a INT); CREATE TABLE t5 (a INT);
@ -207,10 +207,10 @@ DROP TABLE t5;
flush tables; flush tables;
include/rpl_restart_server.inc [server_number=1] include/rpl_restart_server.inc [server_number=1]
###################### TEST #12 ###################### TEST #12
SET GLOBAL debug_dbug="+d,fault_injection_new_file_rotate_event"; SET @@global.debug_dbug="d,fault_injection_new_file_rotate_event";
FLUSH LOGS; FLUSH LOGS;
ERROR HY000: Can't open file: 'master-bin' (errno: 2 "No such file or directory") ERROR HY000: Can't open file: 'master-bin' (errno: 2 "No such file or directory")
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
RESET MASTER; RESET MASTER;
ERROR HY000: Binlog closed, cannot RESET MASTER ERROR HY000: Binlog closed, cannot RESET MASTER
CREATE TABLE t5 (a INT); CREATE TABLE t5 (a INT);
@ -237,44 +237,40 @@ call mtr.add_suppression("Could not use .*");
call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file.");
call mtr.add_suppression("Can't generate a unique log-filename .*"); call mtr.add_suppression("Can't generate a unique log-filename .*");
###################### TEST #13 ###################### TEST #13
SET @old_debug=@@global.debug; SET @saved_debug=@@global.debug_dbug;
include/stop_slave.inc include/stop_slave.inc
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
START SLAVE io_thread; START SLAVE io_thread;
include/wait_for_slave_io_error.inc [errno=1595] include/wait_for_slave_io_error.inc [errno=1595]
Last_IO_Error = 'Relay log write failure: could not queue event from master' Last_IO_Error = 'Relay log write failure: could not queue event from master'
SET GLOBAL debug_dbug="-d,error_unique_log_filename"; SET @@global.debug_dbug=@saved_debug;
SET GLOBAL debug_dbug=@old_debug;
include/rpl_restart_server.inc [server_number=2] include/rpl_restart_server.inc [server_number=2]
###################### TEST #14 ###################### TEST #14
SET @old_debug=@@global.debug; SET @saved_debug=@@global.debug_dbug;
include/stop_slave.inc include/stop_slave.inc
SET GLOBAL debug_dbug="+d,fault_injection_new_file_rotate_event"; SET @@global.debug_dbug="d,fault_injection_new_file_rotate_event";
START SLAVE io_thread; START SLAVE io_thread;
include/wait_for_slave_io_error.inc [errno=1595] include/wait_for_slave_io_error.inc [errno=1595]
Last_IO_Error = 'Relay log write failure: could not queue event from master' Last_IO_Error = 'Relay log write failure: could not queue event from master'
SET GLOBAL debug_dbug="-d,fault_injection_new_file_rotate_event"; SET @@global.debug_dbug=@saved_debug;
SET GLOBAL debug_dbug=@old_debug;
include/rpl_restart_server.inc [server_number=2] include/rpl_restart_server.inc [server_number=2]
###################### TEST #15 ###################### TEST #15
SET @old_debug=@@global.debug; SET @saved_debug=@@global.debug_dbug;
include/stop_slave.inc include/stop_slave.inc
SET GLOBAL debug_dbug="+d,fault_injection_registering_index"; SET @@global.debug_dbug="d,fault_injection_registering_index";
START SLAVE io_thread; START SLAVE io_thread;
include/wait_for_slave_io_error.inc [errno=1595] include/wait_for_slave_io_error.inc [errno=1595]
Last_IO_Error = 'Relay log write failure: could not queue event from master' Last_IO_Error = 'Relay log write failure: could not queue event from master'
SET GLOBAL debug_dbug="-d,fault_injection_registering_index"; SET @@global.debug_dbug=@saved_debug;
SET GLOBAL debug_dbug=@old_debug;
include/rpl_restart_server.inc [server_number=2] include/rpl_restart_server.inc [server_number=2]
###################### TEST #16 ###################### TEST #16
SET @old_debug=@@global.debug; SET @saved_debug=@@global.debug_dbug;
include/stop_slave.inc include/stop_slave.inc
SET GLOBAL debug_dbug="+d,fault_injection_openning_index"; SET @@global.debug_dbug="d,fault_injection_openning_index";
START SLAVE io_thread; START SLAVE io_thread;
include/wait_for_slave_io_error.inc [errno=1595] include/wait_for_slave_io_error.inc [errno=1595]
Last_IO_Error = 'Relay log write failure: could not queue event from master' Last_IO_Error = 'Relay log write failure: could not queue event from master'
SET GLOBAL debug_dbug="-d,fault_injection_openning_index"; SET @@global.debug_dbug=@saved_debug;
SET GLOBAL debug_dbug=@old_debug;
include/rpl_restart_server.inc [server_number=2] include/rpl_restart_server.inc [server_number=2]
include/stop_slave_sql.inc include/stop_slave_sql.inc
Warnings: Warnings:

View File

@ -13,42 +13,40 @@ connection master;
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c VARCHAR(100)); CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c VARCHAR(100));
include/stop_slave.inc include/stop_slave.inc
# 2. Corruption in master binlog and SHOW BINLOG EVENTS # 2. Corruption in master binlog and SHOW BINLOG EVENTS
set @saved_dbug = @@global.debug_dbug; SET @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char"; SET @@global.debug_dbug="d,corrupt_read_log_event_char";
SHOW BINLOG EVENTS; SHOW BINLOG EVENTS;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char"; SET @@global.debug_dbug=@saved_dbug;
# 3. Master read a corrupted event from binlog and send the error to slave # 3. Master read a corrupted event from binlog and send the error to slave
SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set"; SET @@global.debug_dbug="d,corrupt_read_log_event2_set";
connection slave; connection slave;
START SLAVE IO_THREAD; START SLAVE IO_THREAD;
include/wait_for_slave_io_error.inc [errno=1236] include/wait_for_slave_io_error.inc [errno=1236]
connection master; connection master;
SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; SET @@global.debug_dbug=@saved_dbug;
# 4. Master read a corrupted event from binlog and send it to slave # 4. Master read a corrupted event from binlog and send it to slave
connection master; connection master;
SET GLOBAL master_verify_checksum=0; SET GLOBAL master_verify_checksum=0;
SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set"; SET @@global.debug_dbug="d,corrupt_read_log_event2_set";
connection slave; connection slave;
START SLAVE IO_THREAD; START SLAVE IO_THREAD;
include/wait_for_slave_io_error.inc [errno=1595,1743] include/wait_for_slave_io_error.inc [errno=1595,1743]
connection master; connection master;
SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; SET @@global.debug_dbug=@saved_dbug;
SET GLOBAL debug_dbug=@saved_dbug;
SET GLOBAL master_verify_checksum=1; SET GLOBAL master_verify_checksum=1;
# 5. Slave. Corruption in network # 5. Slave. Corruption in network
connection slave; connection slave;
SET @saved_dbug_slave = @@GLOBAL.debug_dbug; SET @saved_dbug_slave = @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,corrupt_queue_event"; SET @@global.debug_dbug="d,corrupt_queue_event";
START SLAVE IO_THREAD; START SLAVE IO_THREAD;
include/wait_for_slave_io_error.inc [errno=1595,1743] include/wait_for_slave_io_error.inc [errno=1595,1743]
SET GLOBAL debug_dbug="-d,corrupt_queue_event"; SET @@global.debug_dbug=@saved_dbug_slave;
# 6. Slave. Corruption in relay log # 6. Slave. Corruption in relay log
SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char"; SET @@global.debug_dbug="d,corrupt_read_log_event_char";
START SLAVE SQL_THREAD; START SLAVE SQL_THREAD;
include/wait_for_slave_sql_error.inc [errno=1593] include/wait_for_slave_sql_error.inc [errno=1593]
SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char"; SET @@global.debug_dbug=@saved_dbug_slave;
SET GLOBAL debug_dbug=@saved_dbug_slave;
# 7. Seek diff for tables on master and slave # 7. Seek diff for tables on master and slave
connection slave; connection slave;
include/start_slave.inc include/start_slave.inc

View File

@ -12,7 +12,7 @@ CREATE TABLE `t` (
INSERT INTO t VALUES (REPEAT('g', 16000), REPEAT('x', 16000), DEFAULT, "kk", 1); INSERT INTO t VALUES (REPEAT('g', 16000), REPEAT('x', 16000), DEFAULT, "kk", 1);
INSERT INTO t VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, "mm", 2); INSERT INTO t VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, "mm", 2);
CREATE INDEX idx ON t(c(100)); CREATE INDEX idx ON t(c(100));
SET global debug_dbug="+d,ib_purge_virtual_index_callback"; SET global debug_dbug="d,ib_purge_virtual_index_callback";
UPDATE t SET a = REPEAT('m', 16000) WHERE a like "aaa%"; UPDATE t SET a = REPEAT('m', 16000) WHERE a like "aaa%";
InnoDB 0 transactions not purged InnoDB 0 transactions not purged
SET global debug_dbug=@old_dbug; SET global debug_dbug=@old_dbug;
@ -27,7 +27,7 @@ i INT
INSERT INTO t VALUES (REPEAT('g', 100), REPEAT('x', 100), DEFAULT, "kk", 1); INSERT INTO t VALUES (REPEAT('g', 100), REPEAT('x', 100), DEFAULT, "kk", 1);
INSERT INTO t VALUES (REPEAT('a', 100), REPEAT('b', 100), DEFAULT, "mm", 2); INSERT INTO t VALUES (REPEAT('a', 100), REPEAT('b', 100), DEFAULT, "mm", 2);
CREATE INDEX idx ON t(c(100)); CREATE INDEX idx ON t(c(100));
SET global debug_dbug="+d,ib_purge_virtual_index_callback"; SET global debug_dbug="d,ib_purge_virtual_index_callback";
UPDATE t SET a = REPEAT('m', 100) WHERE a like "aaa%"; UPDATE t SET a = REPEAT('m', 100) WHERE a like "aaa%";
InnoDB 0 transactions not purged InnoDB 0 transactions not purged
SET global debug_dbug=@old_dbug; SET global debug_dbug=@old_dbug;
@ -48,7 +48,7 @@ insert into t1 values(3, 4, default);
insert into t1 values(3, 12, default); insert into t1 values(3, 12, default);
insert into t1 values(4, 18, default); insert into t1 values(4, 18, default);
CREATE INDEX idx ON t1(x); CREATE INDEX idx ON t1(x);
SET global debug_dbug="+d,ib_purge_virtual_index_callback"; SET global debug_dbug="d,ib_purge_virtual_index_callback";
UPDATE t1 SET id = 10 WHERE id = 1; UPDATE t1 SET id = 10 WHERE id = 1;
InnoDB 0 transactions not purged InnoDB 0 transactions not purged
SET global debug_dbug=@old_dbug; SET global debug_dbug=@old_dbug;
@ -138,7 +138,7 @@ DROP TABLE t0, t1;
create table t (a blob, b blob, c blob as (concat(a,b)), h varchar(10), index (c(100))); create table t (a blob, b blob, c blob as (concat(a,b)), h varchar(10), index (c(100)));
insert t(a,b,h) values (repeat('g', 16000), repeat('x', 16000), "kk"); insert t(a,b,h) values (repeat('g', 16000), repeat('x', 16000), "kk");
insert t(a,b,h) values (repeat('a', 16000), repeat('b', 16000), "mm"); insert t(a,b,h) values (repeat('a', 16000), repeat('b', 16000), "mm");
set global debug_dbug="+d,ib_purge_virtual_index_callback"; set global debug_dbug="d,ib_purge_virtual_index_callback";
connect prevent_purge, localhost, root; connect prevent_purge, localhost, root;
start transaction with consistent snapshot; start transaction with consistent snapshot;
connection default; connection default;
@ -181,7 +181,7 @@ CREATE TABLE t1 (y YEAR, vy YEAR AS (y) VIRTUAL UNIQUE, pk INT PRIMARY KEY)
ENGINE=InnoDB; ENGINE=InnoDB;
INSERT INTO t1 (pk,y) VALUES (1,2022); INSERT INTO t1 (pk,y) VALUES (1,2022);
CREATE TABLE t2(f1 INT NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB; CREATE TABLE t2(f1 INT NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB;
SET GLOBAL debug_dbug = '+d,ib_purge_virtual_index_callback'; SET GLOBAL debug_dbug = 'd,ib_purge_virtual_index_callback';
BEGIN; BEGIN;
INSERT INTO t2(f1) VALUES(1); INSERT INTO t2(f1) VALUES(1);
connection prevent_purge; connection prevent_purge;
@ -209,8 +209,8 @@ DROP TABLE t1, t2;
# on table with virtual columns and indexes # on table with virtual columns and indexes
# #
InnoDB 0 transactions not purged InnoDB 0 transactions not purged
set @saved_dbug= @@global.debug_dbug; SET @saved_dbug= @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,ib_purge_virtual_mdev_16222_1,ib_purge_virtual_mdev_16222_2"; set global debug_dbug= "d,ib_purge_virtual_mdev_16222_1,ib_purge_virtual_mdev_16222_2";
create table t1 ( create table t1 (
pk serial, vb tinyblob as (b) virtual, b tinyblob, pk serial, vb tinyblob as (b) virtual, b tinyblob,
primary key(pk), index (vb(64))) primary key(pk), index (vb(64)))
@ -219,7 +219,7 @@ insert ignore into t1 (b) values ('foo');
select * into outfile 'load.data' from t1; select * into outfile 'load.data' from t1;
load data infile 'load.data' replace into table t1; load data infile 'load.data' replace into table t1;
set debug_sync= "now WAIT_FOR latch_released"; set debug_sync= "now WAIT_FOR latch_released";
set global debug_dbug= "-d,ib_purge_virtual_mdev_16222_1"; set global debug_dbug= @saved_dbug;
drop table t1; drop table t1;
set debug_sync= "now SIGNAL drop_started WAIT_FOR got_no_such_table"; set debug_sync= "now SIGNAL drop_started WAIT_FOR got_no_such_table";
create table t1 ( create table t1 (
@ -255,7 +255,7 @@ SET GLOBAL innodb_debug_sync = "ib_open_after_dict_open "
"SIGNAL purge_open " "SIGNAL purge_open "
"WAIT_FOR select_open"; "WAIT_FOR select_open";
SET @saved_dbug= @@GLOBAL.debug_dbug; SET @saved_dbug= @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,ib_purge_virtual_index_callback"; set global debug_dbug= "d,ib_purge_virtual_index_callback";
connect purge_waiter,localhost,root; connect purge_waiter,localhost,root;
SET debug_sync= "now WAIT_FOR before_row_allocated"; SET debug_sync= "now WAIT_FOR before_row_allocated";
connection default; connection default;

View File

@ -22,7 +22,7 @@ INSERT INTO t VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, "mm", 2);
CREATE INDEX idx ON t(c(100)); CREATE INDEX idx ON t(c(100));
SET global debug_dbug="+d,ib_purge_virtual_index_callback"; SET global debug_dbug="d,ib_purge_virtual_index_callback";
UPDATE t SET a = REPEAT('m', 16000) WHERE a like "aaa%"; UPDATE t SET a = REPEAT('m', 16000) WHERE a like "aaa%";
--source ../../innodb/include/wait_all_purged.inc --source ../../innodb/include/wait_all_purged.inc
SET global debug_dbug=@old_dbug; SET global debug_dbug=@old_dbug;
@ -41,7 +41,7 @@ INSERT INTO t VALUES (REPEAT('a', 100), REPEAT('b', 100), DEFAULT, "mm", 2);
CREATE INDEX idx ON t(c(100)); CREATE INDEX idx ON t(c(100));
SET global debug_dbug="+d,ib_purge_virtual_index_callback"; SET global debug_dbug="d,ib_purge_virtual_index_callback";
UPDATE t SET a = REPEAT('m', 100) WHERE a like "aaa%"; UPDATE t SET a = REPEAT('m', 100) WHERE a like "aaa%";
--source ../../innodb/include/wait_all_purged.inc --source ../../innodb/include/wait_all_purged.inc
SET global debug_dbug=@old_dbug; SET global debug_dbug=@old_dbug;
@ -68,7 +68,7 @@ insert into t1 values(4, 18, default);
CREATE INDEX idx ON t1(x); CREATE INDEX idx ON t1(x);
SET global debug_dbug="+d,ib_purge_virtual_index_callback"; SET global debug_dbug="d,ib_purge_virtual_index_callback";
UPDATE t1 SET id = 10 WHERE id = 1; UPDATE t1 SET id = 10 WHERE id = 1;
--source ../../innodb/include/wait_all_purged.inc --source ../../innodb/include/wait_all_purged.inc
SET global debug_dbug=@old_dbug; SET global debug_dbug=@old_dbug;
@ -179,7 +179,7 @@ DROP TABLE t0, t1;
create table t (a blob, b blob, c blob as (concat(a,b)), h varchar(10), index (c(100))); create table t (a blob, b blob, c blob as (concat(a,b)), h varchar(10), index (c(100)));
insert t(a,b,h) values (repeat('g', 16000), repeat('x', 16000), "kk"); insert t(a,b,h) values (repeat('g', 16000), repeat('x', 16000), "kk");
insert t(a,b,h) values (repeat('a', 16000), repeat('b', 16000), "mm"); insert t(a,b,h) values (repeat('a', 16000), repeat('b', 16000), "mm");
set global debug_dbug="+d,ib_purge_virtual_index_callback"; set global debug_dbug="d,ib_purge_virtual_index_callback";
connect(prevent_purge, localhost, root); connect(prevent_purge, localhost, root);
start transaction with consistent snapshot; start transaction with consistent snapshot;
connection default; connection default;
@ -228,7 +228,7 @@ ENGINE=InnoDB;
INSERT INTO t1 (pk,y) VALUES (1,2022); INSERT INTO t1 (pk,y) VALUES (1,2022);
CREATE TABLE t2(f1 INT NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB; CREATE TABLE t2(f1 INT NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB;
SET GLOBAL debug_dbug = '+d,ib_purge_virtual_index_callback'; SET GLOBAL debug_dbug = 'd,ib_purge_virtual_index_callback';
BEGIN; BEGIN;
INSERT INTO t2(f1) VALUES(1); INSERT INTO t2(f1) VALUES(1);
@ -266,8 +266,8 @@ DROP TABLE t1, t2;
--source suite/innodb/include/wait_all_purged.inc --source suite/innodb/include/wait_all_purged.inc
--let $datadir= `select @@datadir` --let $datadir= `select @@datadir`
set @saved_dbug= @@global.debug_dbug; SET @saved_dbug= @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,ib_purge_virtual_mdev_16222_1,ib_purge_virtual_mdev_16222_2"; set global debug_dbug= "d,ib_purge_virtual_mdev_16222_1,ib_purge_virtual_mdev_16222_2";
create table t1 ( create table t1 (
pk serial, vb tinyblob as (b) virtual, b tinyblob, pk serial, vb tinyblob as (b) virtual, b tinyblob,
@ -280,7 +280,7 @@ select * into outfile 'load.data' from t1;
load data infile 'load.data' replace into table t1; load data infile 'load.data' replace into table t1;
set debug_sync= "now WAIT_FOR latch_released"; set debug_sync= "now WAIT_FOR latch_released";
set global debug_dbug= "-d,ib_purge_virtual_mdev_16222_1"; set global debug_dbug= @saved_dbug;
drop table t1; drop table t1;
--remove_file $datadir/test/load.data --remove_file $datadir/test/load.data
@ -338,7 +338,7 @@ SET GLOBAL innodb_debug_sync = "ib_open_after_dict_open "
# In 10.2 trx_undo_roll_ptr_is_insert(t_roll_ptr) condition never pass in purge, # In 10.2 trx_undo_roll_ptr_is_insert(t_roll_ptr) condition never pass in purge,
# so this condition is forced to pass in row_vers_old_has_index_entry # so this condition is forced to pass in row_vers_old_has_index_entry
SET @saved_dbug= @@GLOBAL.debug_dbug; SET @saved_dbug= @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,ib_purge_virtual_index_callback"; set global debug_dbug= "d,ib_purge_virtual_index_callback";
# The purge starts from REPLACE command. To avoid possible race, separate # The purge starts from REPLACE command. To avoid possible race, separate
# connection is used. # connection is used.

View File

@ -17,3 +17,19 @@ CHECK TABLE t2;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t2 check status OK test.t2 check status OK
DROP TABLE t1, t2; DROP TABLE t1, t2;
CREATE TABLE t1(pk SERIAL) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2),(3);
connect con1,localhost,root,,;
BEGIN;
DELETE FROM t1 WHERE pk=1;
connection default;
SET GLOBAL innodb_flush_log_at_trx_commit=1;
DELETE FROM t1 WHERE pk=3;
# Kill the server
disconnect con1;
# Corrupt the pages
SELECT * FROM t1;
pk
1
2
DROP TABLE t1;

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,8 @@
# #
# MDEV-11369: Instant ADD COLUMN for InnoDB # MDEV-11369: Instant ADD COLUMN for InnoDB
# #
SET @saved_allowance = @@GLOBAL.innodb_instant_alter_column_allowed;
SET GLOBAL innodb_instant_alter_column_allowed = DEFAULT;
call mtr.add_suppression("Cannot add field `.*` in table `test`.`.*` because after adding it, the row size is"); call mtr.add_suppression("Cannot add field `.*` in table `test`.`.*` because after adding it, the row size is");
CREATE TABLE t(a INT UNIQUE)ENGINE=InnoDB ROW_FORMAT=COMPACT; CREATE TABLE t(a INT UNIQUE)ENGINE=InnoDB ROW_FORMAT=COMPACT;
ALTER TABLE t ADD e INT, ROW_FORMAT=COMPRESSED; ALTER TABLE t ADD e INT, ROW_FORMAT=COMPRESSED;
@ -526,6 +528,44 @@ ALTER TABLE t1 ADD PRIMARY KEY (b,a);
ALTER TABLE t1 ADD va INT AS (a) VIRTUAL; ALTER TABLE t1 ADD va INT AS (a) VIRTUAL;
DROP TABLE t1; DROP TABLE t1;
SET innodb_strict_mode = OFF; SET innodb_strict_mode = OFF;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
INSERT INTO t1 SET a=42;
SET GLOBAL innodb_instant_alter_column_allowed = never;
ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT;
SET GLOBAL innodb_instant_alter_column_allowed = never;
ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY a INT DEFAULT 0;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t1 MODIFY a INT DEFAULT NULL, ALGORITHM=INSTANT;
ALTER TABLE t1 DROP b, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
SET GLOBAL innodb_instant_alter_column_allowed = add_drop_reorder;
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY a INT DEFAULT 0, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY a INT DEFAULT 0;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t1 MODIFY a INT DEFAULT NULL, ALGORITHM=INSTANT;
DROP TABLE t1;
SET GLOBAL innodb_instant_alter_column_allowed = DEFAULT;
CREATE TABLE t1 (a INT, b INT UNIQUE) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; CREATE TABLE t1 (a INT, b INT UNIQUE) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
INSERT INTO t1 (a) VALUES (NULL), (NULL); INSERT INTO t1 (a) VALUES (NULL), (NULL);
ALTER TABLE t1 DROP a, ADD COLUMN a INT; ALTER TABLE t1 DROP a, ADD COLUMN a INT;
@ -1406,6 +1446,44 @@ ALTER TABLE t1 ADD PRIMARY KEY (b,a);
ALTER TABLE t1 ADD va INT AS (a) VIRTUAL; ALTER TABLE t1 ADD va INT AS (a) VIRTUAL;
DROP TABLE t1; DROP TABLE t1;
SET innodb_strict_mode = OFF; SET innodb_strict_mode = OFF;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPACT;
INSERT INTO t1 SET a=42;
SET GLOBAL innodb_instant_alter_column_allowed = never;
ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT;
SET GLOBAL innodb_instant_alter_column_allowed = never;
ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY a INT DEFAULT 0;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t1 MODIFY a INT DEFAULT NULL, ALGORITHM=INSTANT;
ALTER TABLE t1 DROP b, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
SET GLOBAL innodb_instant_alter_column_allowed = add_drop_reorder;
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY a INT DEFAULT 0, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY a INT DEFAULT 0;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t1 MODIFY a INT DEFAULT NULL, ALGORITHM=INSTANT;
DROP TABLE t1;
SET GLOBAL innodb_instant_alter_column_allowed = DEFAULT;
CREATE TABLE t1 (a INT, b INT UNIQUE) ENGINE=InnoDB ROW_FORMAT=COMPACT; CREATE TABLE t1 (a INT, b INT UNIQUE) ENGINE=InnoDB ROW_FORMAT=COMPACT;
INSERT INTO t1 (a) VALUES (NULL), (NULL); INSERT INTO t1 (a) VALUES (NULL), (NULL);
ALTER TABLE t1 DROP a, ADD COLUMN a INT; ALTER TABLE t1 DROP a, ADD COLUMN a INT;
@ -2286,6 +2364,44 @@ ALTER TABLE t1 ADD PRIMARY KEY (b,a);
ALTER TABLE t1 ADD va INT AS (a) VIRTUAL; ALTER TABLE t1 ADD va INT AS (a) VIRTUAL;
DROP TABLE t1; DROP TABLE t1;
SET innodb_strict_mode = OFF; SET innodb_strict_mode = OFF;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t1 SET a=42;
SET GLOBAL innodb_instant_alter_column_allowed = never;
ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT;
SET GLOBAL innodb_instant_alter_column_allowed = never;
ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY a INT DEFAULT 0;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t1 MODIFY a INT DEFAULT NULL, ALGORITHM=INSTANT;
ALTER TABLE t1 DROP b, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
SET GLOBAL innodb_instant_alter_column_allowed = add_drop_reorder;
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY a INT DEFAULT 0, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY a INT DEFAULT 0;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t1 MODIFY a INT DEFAULT NULL, ALGORITHM=INSTANT;
DROP TABLE t1;
SET GLOBAL innodb_instant_alter_column_allowed = DEFAULT;
CREATE TABLE t1 (a INT, b INT UNIQUE) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; CREATE TABLE t1 (a INT, b INT UNIQUE) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t1 (a) VALUES (NULL), (NULL); INSERT INTO t1 (a) VALUES (NULL), (NULL);
ALTER TABLE t1 DROP a, ADD COLUMN a INT; ALTER TABLE t1 DROP a, ADD COLUMN a INT;
@ -2700,8 +2816,9 @@ SELECT variable_value-@old_instant instants
FROM information_schema.global_status FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column'; WHERE variable_name = 'innodb_instant_alter_column';
instants instants
199 205
SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency; SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency;
SET GLOBAL innodb_instant_alter_column_allowed = @saved_allowance;
# #
# MDEV-18266: Changing an index comment unnecessarily rebuilds index # MDEV-18266: Changing an index comment unnecessarily rebuilds index
# #

View File

@ -63,3 +63,31 @@ SELECT * FROM t2;
CHECK TABLE t2; CHECK TABLE t2;
DROP TABLE t1, t2; DROP TABLE t1, t2;
# MDEV-21572 buf_page_get_gen() should apply buffered page
# initialized redo log during recovery
--source ../include/no_checkpoint_start.inc
CREATE TABLE t1(pk SERIAL) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2),(3);
connect (con1,localhost,root,,);
BEGIN;
DELETE FROM t1 WHERE pk=1;
connection default;
SET GLOBAL innodb_flush_log_at_trx_commit=1;
DELETE FROM t1 WHERE pk=3;
--let CLEANUP_IF_CHECKPOINT=DROP TABLE t1;
--source ../include/no_checkpoint_end.inc
disconnect con1;
--echo # Corrupt the pages
perl;
my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd";
open(FILE, "+<$file") || die "Unable to open $file";
binmode FILE;
seek (FILE, $ENV{INNODB_PAGE_SIZE} * 3, SEEK_SET) or die "seek";
print FILE "junk";
close FILE or die "close";
EOF
--source include/start_mysqld.inc
SELECT * FROM t1;
DROP TABLE t1;

View File

@ -4,6 +4,9 @@
--echo # MDEV-11369: Instant ADD COLUMN for InnoDB --echo # MDEV-11369: Instant ADD COLUMN for InnoDB
--echo # --echo #
SET @saved_allowance = @@GLOBAL.innodb_instant_alter_column_allowed;
SET GLOBAL innodb_instant_alter_column_allowed = DEFAULT;
call mtr.add_suppression("Cannot add field `.*` in table `test`.`.*` because after adding it, the row size is"); call mtr.add_suppression("Cannot add field `.*` in table `test`.`.*` because after adding it, the row size is");
let $format= `SELECT CASE WHEN @@GLOBAL.innodb_page_size>16384 let $format= `SELECT CASE WHEN @@GLOBAL.innodb_page_size>16384
@ -418,6 +421,46 @@ ALTER TABLE t1 ADD va INT AS (a) VIRTUAL;
DROP TABLE t1; DROP TABLE t1;
SET innodb_strict_mode = OFF; SET innodb_strict_mode = OFF;
# MDEV-20950 innodb_instant_alter_column_allowed
eval CREATE TABLE t1 (a INT PRIMARY KEY) $engine;
INSERT INTO t1 SET a=42;
SET GLOBAL innodb_instant_alter_column_allowed = never;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT;
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT;
SET GLOBAL innodb_instant_alter_column_allowed = never;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT;
--enable_info
ALTER TABLE t1 MODIFY a INT DEFAULT 0;
--disable_info
ALTER TABLE t1 MODIFY a INT DEFAULT NULL, ALGORITHM=INSTANT;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 DROP b, ALGORITHM=INSTANT;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT;
SET GLOBAL innodb_instant_alter_column_allowed = add_drop_reorder;
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 MODIFY a INT DEFAULT 0, ALGORITHM=INSTANT;
--enable_info
ALTER TABLE t1 MODIFY a INT DEFAULT 0;
--disable_info
ALTER TABLE t1 MODIFY a INT DEFAULT NULL, ALGORITHM=INSTANT;
DROP TABLE t1;
SET GLOBAL innodb_instant_alter_column_allowed = DEFAULT;
# MDEV-15562 Instant DROP/ADD/reorder columns # MDEV-15562 Instant DROP/ADD/reorder columns
eval CREATE TABLE t1 (a INT, b INT UNIQUE) $engine; eval CREATE TABLE t1 (a INT, b INT UNIQUE) $engine;
@ -838,6 +881,7 @@ SELECT variable_value-@old_instant instants
FROM information_schema.global_status FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column'; WHERE variable_name = 'innodb_instant_alter_column';
SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency; SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency;
SET GLOBAL innodb_instant_alter_column_allowed = @saved_allowance;
--echo # --echo #
--echo # MDEV-18266: Changing an index comment unnecessarily rebuilds index --echo # MDEV-18266: Changing an index comment unnecessarily rebuilds index

View File

@ -0,0 +1,34 @@
CREATE TABLE t1 (
id INT NOT NULL,
name VARCHAR(30))ENGINE=InnoDB ROW_FORMAT=COMPACT CHARACTER SET=latin1
PARTITION BY RANGE (id) (
PARTITION p0 VALUES LESS THAN (50),
PARTITION p1 VALUES LESS THAN (MAXVALUE)
);
INSERT INTO t1(id, name) VALUES(16, 'Me'), (337, 'ROFL');
# Add and drop 31 Instant columns
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL,
`name` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
PARTITION BY RANGE (`id`)
(PARTITION `p0` VALUES LESS THAN (50) ENGINE = InnoDB,
PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
ALTER TABLE t2 REMOVE PARTITIONING;
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL,
`name` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
SET ALTER_ALGORITHM=INSTANT;
ALTER TABLE t1 ADD COLUMN col1 VARCHAR(255) NOT NULL DEFAULT repeat('a', 255);
ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE
SET ALTER_ALGORITHM=INPLACE;
ALTER TABLE t1 ADD COLUMN col1 VARCHAR(255) NOT NULL DEFAULT repeat('a', 255);
DROP TABLE t1, t2;
SET ALTER_ALGORITHM=DEFAULT;

View File

@ -0,0 +1,43 @@
--source include/have_partition.inc
--source include/have_innodb.inc
--source include/have_innodb_16k.inc
# MDEV-21832 FORCE all partition to rebuild if any one of the
# partition does rebuild
CREATE TABLE t1 (
id INT NOT NULL,
name VARCHAR(30))ENGINE=InnoDB ROW_FORMAT=COMPACT CHARACTER SET=latin1
PARTITION BY RANGE (id) (
PARTITION p0 VALUES LESS THAN (50),
PARTITION p1 VALUES LESS THAN (MAXVALUE)
);
INSERT INTO t1(id, name) VALUES(16, 'Me'), (337, 'ROFL');
--echo # Add and drop 31 Instant columns
--disable_query_log
let $i = 1;
while ($i < 32) {
--eval ALTER TABLE t1 ADD COLUMN col$i VARCHAR(255) NOT NULL DEFAULT repeat('a', 255);
inc $i;
}
let $i = 31;
while ($i > 0) {
--eval ALTER TABLE t1 DROP COLUMN col$i
dec $i;
}
--enable_query_log
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
ALTER TABLE t2 REMOVE PARTITIONING;
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
SHOW CREATE TABLE t2;
SET ALTER_ALGORITHM=INSTANT;
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 ADD COLUMN col1 VARCHAR(255) NOT NULL DEFAULT repeat('a', 255);
SET ALTER_ALGORITHM=INPLACE;
ALTER TABLE t1 ADD COLUMN col1 VARCHAR(255) NOT NULL DEFAULT repeat('a', 255);
DROP TABLE t1, t2;
SET ALTER_ALGORITHM=DEFAULT;

View File

@ -11,7 +11,7 @@
############################################################################## ##############################################################################
rpl_spec_variables : BUG#11755836 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux rpl_spec_variables : BUG#11755836 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux
rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock #rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock
rpl_partition_archive : MDEV-5077 2013-09-27 svoj Cannot exchange partition with archive table rpl_partition_archive : MDEV-5077 2013-09-27 svoj Cannot exchange partition with archive table
rpl_row_binlog_max_cache_size : MDEV-11092 rpl_row_binlog_max_cache_size : MDEV-11092
rpl_row_index_choice : MDEV-11666 rpl_row_index_choice : MDEV-11666

View File

@ -84,14 +84,14 @@ FLUSH LOGS;
### (should show just one binlog) ### (should show just one binlog)
RESET MASTER; RESET MASTER;
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
-- error ER_NO_UNIQUE_LOGFILE -- error ER_NO_UNIQUE_LOGFILE
FLUSH LOGS; FLUSH LOGS;
-- echo # assert: must show one binlog -- echo # assert: must show one binlog
-- source include/show_binary_logs.inc -- source include/show_binary_logs.inc
### ACTION: clean up and move to next test ### ACTION: clean up and move to next test
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
RESET MASTER; RESET MASTER;
-- echo ###################### TEST #3 -- echo ###################### TEST #3
@ -116,7 +116,7 @@ RESET MASTER;
-- source include/show_binary_logs.inc -- source include/show_binary_logs.inc
# clean up the table and the binlog to be used in next part of test # clean up the table and the binlog to be used in next part of test
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
DELETE FROM t2; DELETE FROM t2;
RESET MASTER; RESET MASTER;
@ -127,7 +127,7 @@ RESET MASTER;
### changes performed despite the fact that it reported an ### changes performed despite the fact that it reported an
### error. ### error.
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- error ER_NO_UNIQUE_LOGFILE -- error ER_NO_UNIQUE_LOGFILE
-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 -- eval LOAD DATA INFILE '$load_file' INTO TABLE t2
@ -137,7 +137,7 @@ SET GLOBAL debug_dbug="+d,error_unique_log_filename";
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
# clean up the table and the binlog to be used in next part of test # clean up the table and the binlog to be used in next part of test
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
DELETE FROM t2; DELETE FROM t2;
RESET MASTER; RESET MASTER;
@ -146,7 +146,7 @@ RESET MASTER;
### ASSERTION: load the small file into a transactional table and ### ASSERTION: load the small file into a transactional table and
### check that it succeeds ### check that it succeeds
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval LOAD DATA INFILE '$load_file2' INTO TABLE t2 -- eval LOAD DATA INFILE '$load_file2' INTO TABLE t2
@ -155,7 +155,7 @@ SET GLOBAL debug_dbug="+d,error_unique_log_filename";
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
# clean up the table and the binlog to be used in next part of test # clean up the table and the binlog to be used in next part of test
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
DELETE FROM t2; DELETE FROM t2;
RESET MASTER; RESET MASTER;
@ -166,7 +166,7 @@ RESET MASTER;
### fails we get the error. Transaction is not rolledback ### fails we get the error. Transaction is not rolledback
### because rotation happens after the commit. ### because rotation happens after the commit.
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
SET AUTOCOMMIT=0; SET AUTOCOMMIT=0;
INSERT INTO t2 VALUES ('muse'); INSERT INTO t2 VALUES ('muse');
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
@ -181,7 +181,7 @@ SELECT count(*) FROM t2;
### ACTION: clean up and move to the next test ### ACTION: clean up and move to the next test
SET AUTOCOMMIT= 1; SET AUTOCOMMIT= 1;
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
DELETE FROM t2; DELETE FROM t2;
RESET MASTER; RESET MASTER;
@ -191,7 +191,7 @@ RESET MASTER;
### fails then an error is reported and an incident event ### fails then an error is reported and an incident event
### is written to the current binary log. ### is written to the current binary log.
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
# Disable logging Annotate_rows events to preserve events count. # Disable logging Annotate_rows events to preserve events count.
let $binlog_annotate_row_events_saved= `SELECT @@binlog_annotate_row_events`; let $binlog_annotate_row_events_saved= `SELECT @@binlog_annotate_row_events`;
@ -206,7 +206,7 @@ SELECT count(*) FROM t4;
SELECT count(*) FROM t4; SELECT count(*) FROM t4;
-- echo ### check that the incident event is written to the current log -- echo ### check that the incident event is written to the current log
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
if (!$binlog_limit) if (!$binlog_limit)
{ {
-- let $binlog_limit= 4,1 -- let $binlog_limit= 4,1
@ -227,7 +227,7 @@ RESET MASTER;
### ASSERTION: check that statements end up in error but they succeed ### ASSERTION: check that statements end up in error but they succeed
### on changing the data. ### on changing the data.
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
-- echo # must show 0 entries -- echo # must show 0 entries
SELECT count(*) FROM t4; SELECT count(*) FROM t4;
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
@ -258,13 +258,13 @@ SELECT count(*) FROM t4;
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
# remove fault injection # remove fault injection
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
-- echo ###################### TEST #9 -- echo ###################### TEST #9
### ASSERTION: check that if we disable binlogging, then statements ### ASSERTION: check that if we disable binlogging, then statements
### succeed. ### succeed.
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
SET SQL_LOG_BIN=0; SET SQL_LOG_BIN=0;
INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd'); INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd');
INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh'); INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh');
@ -277,7 +277,7 @@ DELETE FROM t4;
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
SELECT count(*) FROM t4; SELECT count(*) FROM t4;
SET SQL_LOG_BIN=1; SET SQL_LOG_BIN=1;
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
-- echo ###################### TEST #10 -- echo ###################### TEST #10
@ -292,11 +292,11 @@ RESET MASTER;
SHOW WARNINGS; SHOW WARNINGS;
# +d,fault_injection_registering_index => injects fault on MYSQL_BIN_LOG::open # +d,fault_injection_registering_index => injects fault on MYSQL_BIN_LOG::open
SET GLOBAL debug_dbug="+d,fault_injection_registering_index"; SET @@global.debug_dbug="d,fault_injection_registering_index";
-- replace_regex /\.[\\\/]master/master/ -- replace_regex /\.[\\\/]master/master/
-- error ER_CANT_OPEN_FILE -- error ER_CANT_OPEN_FILE
FLUSH LOGS; FLUSH LOGS;
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
-- error ER_NO_BINARY_LOGGING -- error ER_NO_BINARY_LOGGING
SHOW BINARY LOGS; SHOW BINARY LOGS;
@ -321,11 +321,11 @@ flush tables;
--source include/rpl_restart_server.inc --source include/rpl_restart_server.inc
# +d,fault_injection_openning_index => injects fault on MYSQL_BIN_LOG::open_index_file # +d,fault_injection_openning_index => injects fault on MYSQL_BIN_LOG::open_index_file
SET GLOBAL debug_dbug="+d,fault_injection_openning_index"; SET @@global.debug_dbug="d,fault_injection_openning_index";
-- replace_regex /\.[\\\/]master/master/ -- replace_regex /\.[\\\/]master/master/
-- error ER_CANT_OPEN_FILE -- error ER_CANT_OPEN_FILE
FLUSH LOGS; FLUSH LOGS;
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
-- error ER_FLUSH_MASTER_BINLOG_CLOSED -- error ER_FLUSH_MASTER_BINLOG_CLOSED
RESET MASTER; RESET MASTER;
@ -350,10 +350,10 @@ flush tables;
### file. ### file.
# +d,fault_injection_new_file_rotate_event => injects fault on MYSQL_BIN_LOG::MYSQL_BIN_LOG::new_file_impl # +d,fault_injection_new_file_rotate_event => injects fault on MYSQL_BIN_LOG::MYSQL_BIN_LOG::new_file_impl
SET GLOBAL debug_dbug="+d,fault_injection_new_file_rotate_event"; SET @@global.debug_dbug="d,fault_injection_new_file_rotate_event";
-- error ER_ERROR_ON_WRITE -- error ER_ERROR_ON_WRITE
FLUSH LOGS; FLUSH LOGS;
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
-- error ER_FLUSH_MASTER_BINLOG_CLOSED -- error ER_FLUSH_MASTER_BINLOG_CLOSED
RESET MASTER; RESET MASTER;

View File

@ -73,8 +73,8 @@ while ($i) {
# Emulate corruption in binlog file when SHOW BINLOG EVENTS is executing # Emulate corruption in binlog file when SHOW BINLOG EVENTS is executing
--echo # 2. Corruption in master binlog and SHOW BINLOG EVENTS --echo # 2. Corruption in master binlog and SHOW BINLOG EVENTS
set @saved_dbug = @@global.debug_dbug; SET @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char"; SET @@global.debug_dbug="d,corrupt_read_log_event_char";
--echo SHOW BINLOG EVENTS; --echo SHOW BINLOG EVENTS;
--disable_query_log --disable_query_log
send_eval SHOW BINLOG EVENTS FROM $pos; send_eval SHOW BINLOG EVENTS FROM $pos;
@ -82,7 +82,7 @@ send_eval SHOW BINLOG EVENTS FROM $pos;
--error ER_ERROR_WHEN_EXECUTING_COMMAND --error ER_ERROR_WHEN_EXECUTING_COMMAND
reap; reap;
SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char"; SET @@global.debug_dbug=@saved_dbug;
# Emulate corruption on master with crc checking on master # Emulate corruption on master with crc checking on master
--echo # 3. Master read a corrupted event from binlog and send the error to slave --echo # 3. Master read a corrupted event from binlog and send the error to slave
@ -107,20 +107,20 @@ let $wait_condition=
SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE command = 'Binlog Dump'; SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE command = 'Binlog Dump';
--source include/wait_condition.inc --source include/wait_condition.inc
SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set"; SET @@global.debug_dbug="d,corrupt_read_log_event2_set";
--connection slave --connection slave
START SLAVE IO_THREAD; START SLAVE IO_THREAD;
let $slave_io_errno= 1236; let $slave_io_errno= 1236;
--let $slave_timeout= 10 --let $slave_timeout= 10
--source include/wait_for_slave_io_error.inc --source include/wait_for_slave_io_error.inc
--connection master --connection master
SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; SET @@global.debug_dbug=@saved_dbug;
# Emulate corruption on master without crc checking on master # Emulate corruption on master without crc checking on master
--echo # 4. Master read a corrupted event from binlog and send it to slave --echo # 4. Master read a corrupted event from binlog and send it to slave
--connection master --connection master
SET GLOBAL master_verify_checksum=0; SET GLOBAL master_verify_checksum=0;
SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set"; SET @@global.debug_dbug="d,corrupt_read_log_event2_set";
--connection slave --connection slave
START SLAVE IO_THREAD; START SLAVE IO_THREAD;
# When the checksum error is detected, the slave sets error code 1743 # When the checksum error is detected, the slave sets error code 1743
@ -130,31 +130,29 @@ START SLAVE IO_THREAD;
let $slave_io_errno= 1595,1743; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE let $slave_io_errno= 1595,1743; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE
--source include/wait_for_slave_io_error.inc --source include/wait_for_slave_io_error.inc
--connection master --connection master
SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; SET @@global.debug_dbug=@saved_dbug;
SET GLOBAL debug_dbug=@saved_dbug;
SET GLOBAL master_verify_checksum=1; SET GLOBAL master_verify_checksum=1;
# Emulate corruption in network # Emulate corruption in network
--echo # 5. Slave. Corruption in network --echo # 5. Slave. Corruption in network
--connection slave --connection slave
SET @saved_dbug_slave = @@GLOBAL.debug_dbug; SET @saved_dbug_slave = @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,corrupt_queue_event"; SET @@global.debug_dbug="d,corrupt_queue_event";
START SLAVE IO_THREAD; START SLAVE IO_THREAD;
let $slave_io_errno= 1595,1743; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE let $slave_io_errno= 1595,1743; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE
--source include/wait_for_slave_io_error.inc --source include/wait_for_slave_io_error.inc
SET GLOBAL debug_dbug="-d,corrupt_queue_event"; SET @@global.debug_dbug=@saved_dbug_slave;
# Emulate corruption in relay log # Emulate corruption in relay log
--echo # 6. Slave. Corruption in relay log --echo # 6. Slave. Corruption in relay log
SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char"; SET @@global.debug_dbug="d,corrupt_read_log_event_char";
START SLAVE SQL_THREAD; START SLAVE SQL_THREAD;
let $slave_sql_errno= 1593; let $slave_sql_errno= 1593;
--source include/wait_for_slave_sql_error.inc --source include/wait_for_slave_sql_error.inc
SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char"; SET @@global.debug_dbug=@saved_dbug_slave;
SET GLOBAL debug_dbug=@saved_dbug_slave;
# Start normal replication and compare same table on master # Start normal replication and compare same table on master
# and slave # and slave

View File

@ -41,8 +41,8 @@ if (!$debug_sync_action)
# Restart slave # Restart slave
--source include/stop_slave.inc --source include/stop_slave.inc
SET @old_dbug = @@global.debug_dbug;
eval SET @@global.debug_dbug= "+d,$dbug_sync_point"; eval SET @@global.debug_dbug= "d,$dbug_sync_point";
--source include/start_slave.inc --source include/start_slave.inc
--echo slave is going to hang in get_master_version_and_clock --echo slave is going to hang in get_master_version_and_clock
@ -70,7 +70,7 @@ source include/wait_for_slave_io_error.inc;
# now to avoid restarting IO-thread to re-enter it. # now to avoid restarting IO-thread to re-enter it.
# There will be a new IO thread forked out with its @@session.debug # There will be a new IO thread forked out with its @@session.debug
# unset. # unset.
eval set @@global.debug_dbug= "-d,$dbug_sync_point"; set @@global.debug_dbug= @old_dbug;
--let $rpl_server_number= 1 --let $rpl_server_number= 1
--source include/rpl_start_server.inc --source include/rpl_start_server.inc

View File

@ -14,7 +14,7 @@ create table ti (a int auto_increment primary key) engine=innodb;
sync_slave_with_master; sync_slave_with_master;
SET @saved_dbug = @@GLOBAL.debug_dbug; SET @saved_dbug = @@GLOBAL.debug_dbug;
set @@global.debug_dbug="+d,stop_slave_middle_group"; set @@global.debug_dbug="d,stop_slave_middle_group";
connection master; connection master;
@ -44,7 +44,7 @@ eval SELECT "NO$error" AS Last_SQL_Error, @check as `true`;
select count(*) as one from tm; select count(*) as one from tm;
select count(*) as one from ti; select count(*) as one from ti;
set @@global.debug_dbug="-d"; set @@global.debug_dbug=@saved_dbug;
# #
# bug#45940 issues around rli->last_event_start_time # bug#45940 issues around rli->last_event_start_time
@ -68,8 +68,7 @@ truncate table ti;
#connection slave; #connection slave;
sync_slave_with_master; sync_slave_with_master;
set @@global.debug_dbug="+d,stop_slave_middle_group"; set @@global.debug_dbug="d,stop_slave_middle_group,incomplete_group_in_relay_log";
set @@global.debug_dbug="+d,incomplete_group_in_relay_log";
connection master; connection master;
@ -97,7 +96,7 @@ eval SELECT "$error" AS Last_SQL_Error, @check as `true`;
select count(*) as one from tm; select count(*) as one from tm;
select count(*) as zero from ti; select count(*) as zero from ti;
set @@global.debug_dbug="-d"; set @@global.debug_dbug=@saved_dbug;
# #
# The mixed multi-table update # The mixed multi-table update
@ -110,8 +109,7 @@ connection master;
#connection slave; #connection slave;
sync_slave_with_master; sync_slave_with_master;
set @@global.debug_dbug="+d,stop_slave_middle_group"; set @@global.debug_dbug="d,stop_slave_middle_group,incomplete_group_in_relay_log";
set @@global.debug_dbug="+d,incomplete_group_in_relay_log";
connection master; connection master;
update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2; update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2;

View File

@ -3,8 +3,8 @@ include/rpl_connect.inc [creating M4]
include/rpl_connect.inc [creating M2] include/rpl_connect.inc [creating M2]
connection M2; connection M2;
STOP SLAVE; STOP SLAVE;
SET @old_debug= @@global.debug; SET @old_debug= @@global.debug_dbug;
SET GLOBAL debug_dbug= "+d,dbug.rows_events_to_delay_relay_logging"; SET GLOBAL debug_dbug= "d,dbug.rows_events_to_delay_relay_logging";
START SLAVE IO_THREAD; START SLAVE IO_THREAD;
include/wait_for_slave_io_to_start.inc include/wait_for_slave_io_to_start.inc
connection M2; connection M2;

View File

@ -22,7 +22,7 @@ master-bin.000001 #
master-bin.000002 # master-bin.000002 #
###################### TEST #2 ###################### TEST #2
RESET MASTER; RESET MASTER;
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
FLUSH LOGS; FLUSH LOGS;
ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
@ -30,7 +30,7 @@ ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
show binary logs; show binary logs;
Log_name File_size Log_name File_size
master-bin.000001 # master-bin.000001 #
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
RESET MASTER; RESET MASTER;
###################### TEST #3 ###################### TEST #3
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
@ -44,11 +44,11 @@ show binary logs;
Log_name File_size Log_name File_size
master-bin.000001 # master-bin.000001 #
master-bin.000002 # master-bin.000002 #
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
DELETE FROM t2; DELETE FROM t2;
RESET MASTER; RESET MASTER;
###################### TEST #4 ###################### TEST #4
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2;
ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
@ -56,21 +56,21 @@ ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
1 1
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
DELETE FROM t2; DELETE FROM t2;
RESET MASTER; RESET MASTER;
###################### TEST #5 ###################### TEST #5
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166-2.data' INTO TABLE t2; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166-2.data' INTO TABLE t2;
# assert: must show one entry # assert: must show one entry
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
1 1
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
DELETE FROM t2; DELETE FROM t2;
RESET MASTER; RESET MASTER;
###################### TEST #6 ###################### TEST #6
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
SET AUTOCOMMIT=0; SET AUTOCOMMIT=0;
INSERT INTO t2 VALUES ('muse'); INSERT INTO t2 VALUES ('muse');
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2;
@ -83,11 +83,11 @@ SELECT count(*) FROM t2;
count(*) count(*)
3 3
SET AUTOCOMMIT= 1; SET AUTOCOMMIT= 1;
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
DELETE FROM t2; DELETE FROM t2;
RESET MASTER; RESET MASTER;
###################### TEST #7 ###################### TEST #7
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
SET @@binlog_annotate_row_events= 0; SET @@binlog_annotate_row_events= 0;
SELECT count(*) FROM t4; SELECT count(*) FROM t4;
count(*) count(*)
@ -100,14 +100,14 @@ SELECT count(*) FROM t4;
count(*) count(*)
1 1
### check that the incident event is written to the current log ### check that the incident event is written to the current log
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
include/show_binlog_events.inc include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Incident # # #1 (LOST_EVENTS) master-bin.000001 # Incident # # #1 (LOST_EVENTS)
DELETE FROM t4; DELETE FROM t4;
RESET MASTER; RESET MASTER;
###################### TEST #8 ###################### TEST #8
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
# must show 0 entries # must show 0 entries
SELECT count(*) FROM t4; SELECT count(*) FROM t4;
count(*) count(*)
@ -147,9 +147,9 @@ count(*)
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
0 0
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
###################### TEST #9 ###################### TEST #9
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
SET SQL_LOG_BIN=0; SET SQL_LOG_BIN=0;
INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd'); INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd');
INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh'); INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh');
@ -170,17 +170,17 @@ SELECT count(*) FROM t4;
count(*) count(*)
0 0
SET SQL_LOG_BIN=1; SET SQL_LOG_BIN=1;
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
###################### TEST #10 ###################### TEST #10
call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file.");
call mtr.add_suppression("Could not use .*"); call mtr.add_suppression("Could not use .*");
RESET MASTER; RESET MASTER;
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
SET GLOBAL debug_dbug="+d,fault_injection_registering_index"; SET @@global.debug_dbug="d,fault_injection_registering_index";
FLUSH LOGS; FLUSH LOGS;
ERROR HY000: Can't open file: 'master-bin.000002' (errno: 1 "Operation not permitted") ERROR HY000: Can't open file: 'master-bin.000002' (errno: 1 "Operation not permitted")
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
SHOW BINARY LOGS; SHOW BINARY LOGS;
ERROR HY000: You are not using binary logging ERROR HY000: You are not using binary logging
CREATE TABLE t5 (a INT); CREATE TABLE t5 (a INT);
@ -192,10 +192,10 @@ DROP TABLE t5;
flush tables; flush tables;
###################### TEST #11 ###################### TEST #11
include/rpl_restart_server.inc [server_number=1] include/rpl_restart_server.inc [server_number=1]
SET GLOBAL debug_dbug="+d,fault_injection_openning_index"; SET @@global.debug_dbug="d,fault_injection_openning_index";
FLUSH LOGS; FLUSH LOGS;
ERROR HY000: Can't open file: 'master-bin.index' (errno: 1 "Operation not permitted") ERROR HY000: Can't open file: 'master-bin.index' (errno: 1 "Operation not permitted")
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
RESET MASTER; RESET MASTER;
ERROR HY000: Binlog closed, cannot RESET MASTER ERROR HY000: Binlog closed, cannot RESET MASTER
CREATE TABLE t5 (a INT); CREATE TABLE t5 (a INT);
@ -207,10 +207,10 @@ DROP TABLE t5;
flush tables; flush tables;
include/rpl_restart_server.inc [server_number=1] include/rpl_restart_server.inc [server_number=1]
###################### TEST #12 ###################### TEST #12
SET GLOBAL debug_dbug="+d,fault_injection_new_file_rotate_event"; SET @@global.debug_dbug="d,fault_injection_new_file_rotate_event";
FLUSH LOGS; FLUSH LOGS;
ERROR HY000: Can't open file: 'master-bin' (errno: 2 "No such file or directory") ERROR HY000: Can't open file: 'master-bin' (errno: 2 "No such file or directory")
SET GLOBAL debug_dbug=@old_debug; SET @@global.debug_dbug=@old_debug;
RESET MASTER; RESET MASTER;
ERROR HY000: Binlog closed, cannot RESET MASTER ERROR HY000: Binlog closed, cannot RESET MASTER
CREATE TABLE t5 (a INT); CREATE TABLE t5 (a INT);
@ -237,44 +237,40 @@ call mtr.add_suppression("Could not use .*");
call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file.");
call mtr.add_suppression("Can't generate a unique log-filename .*"); call mtr.add_suppression("Can't generate a unique log-filename .*");
###################### TEST #13 ###################### TEST #13
SET @old_debug=@@global.debug; SET @saved_debug=@@global.debug_dbug;
include/stop_slave.inc include/stop_slave.inc
SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SET @@global.debug_dbug="d,error_unique_log_filename";
START SLAVE io_thread; START SLAVE io_thread;
include/wait_for_slave_io_error.inc [errno=1595] include/wait_for_slave_io_error.inc [errno=1595]
Last_IO_Error = 'Relay log write failure: could not queue event from master' Last_IO_Error = 'Relay log write failure: could not queue event from master'
SET GLOBAL debug_dbug="-d,error_unique_log_filename"; SET @@global.debug_dbug=@saved_debug;
SET GLOBAL debug_dbug=@old_debug;
include/rpl_restart_server.inc [server_number=2] include/rpl_restart_server.inc [server_number=2]
###################### TEST #14 ###################### TEST #14
SET @old_debug=@@global.debug; SET @saved_debug=@@global.debug_dbug;
include/stop_slave.inc include/stop_slave.inc
SET GLOBAL debug_dbug="+d,fault_injection_new_file_rotate_event"; SET @@global.debug_dbug="d,fault_injection_new_file_rotate_event";
START SLAVE io_thread; START SLAVE io_thread;
include/wait_for_slave_io_error.inc [errno=1595] include/wait_for_slave_io_error.inc [errno=1595]
Last_IO_Error = 'Relay log write failure: could not queue event from master' Last_IO_Error = 'Relay log write failure: could not queue event from master'
SET GLOBAL debug_dbug="-d,fault_injection_new_file_rotate_event"; SET @@global.debug_dbug=@saved_debug;
SET GLOBAL debug_dbug=@old_debug;
include/rpl_restart_server.inc [server_number=2] include/rpl_restart_server.inc [server_number=2]
###################### TEST #15 ###################### TEST #15
SET @old_debug=@@global.debug; SET @saved_debug=@@global.debug_dbug;
include/stop_slave.inc include/stop_slave.inc
SET GLOBAL debug_dbug="+d,fault_injection_registering_index"; SET @@global.debug_dbug="d,fault_injection_registering_index";
START SLAVE io_thread; START SLAVE io_thread;
include/wait_for_slave_io_error.inc [errno=1595] include/wait_for_slave_io_error.inc [errno=1595]
Last_IO_Error = 'Relay log write failure: could not queue event from master' Last_IO_Error = 'Relay log write failure: could not queue event from master'
SET GLOBAL debug_dbug="-d,fault_injection_registering_index"; SET @@global.debug_dbug=@saved_debug;
SET GLOBAL debug_dbug=@old_debug;
include/rpl_restart_server.inc [server_number=2] include/rpl_restart_server.inc [server_number=2]
###################### TEST #16 ###################### TEST #16
SET @old_debug=@@global.debug; SET @saved_debug=@@global.debug_dbug;
include/stop_slave.inc include/stop_slave.inc
SET GLOBAL debug_dbug="+d,fault_injection_openning_index"; SET @@global.debug_dbug="d,fault_injection_openning_index";
START SLAVE io_thread; START SLAVE io_thread;
include/wait_for_slave_io_error.inc [errno=1595] include/wait_for_slave_io_error.inc [errno=1595]
Last_IO_Error = 'Relay log write failure: could not queue event from master' Last_IO_Error = 'Relay log write failure: could not queue event from master'
SET GLOBAL debug_dbug="-d,fault_injection_openning_index"; SET @@global.debug_dbug=@saved_debug;
SET GLOBAL debug_dbug=@old_debug;
include/rpl_restart_server.inc [server_number=2] include/rpl_restart_server.inc [server_number=2]
include/stop_slave_sql.inc include/stop_slave_sql.inc
Warnings: Warnings:

View File

@ -13,42 +13,40 @@ connection master;
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c VARCHAR(100)); CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c VARCHAR(100));
include/stop_slave.inc include/stop_slave.inc
# 2. Corruption in master binlog and SHOW BINLOG EVENTS # 2. Corruption in master binlog and SHOW BINLOG EVENTS
set @saved_dbug = @@global.debug_dbug; SET @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char"; SET @@global.debug_dbug="d,corrupt_read_log_event_char";
SHOW BINLOG EVENTS; SHOW BINLOG EVENTS;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char"; SET @@global.debug_dbug=@saved_dbug;
# 3. Master read a corrupted event from binlog and send the error to slave # 3. Master read a corrupted event from binlog and send the error to slave
SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set"; SET @@global.debug_dbug="d,corrupt_read_log_event2_set";
connection slave; connection slave;
START SLAVE IO_THREAD; START SLAVE IO_THREAD;
include/wait_for_slave_io_error.inc [errno=1236] include/wait_for_slave_io_error.inc [errno=1236]
connection master; connection master;
SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; SET @@global.debug_dbug=@saved_dbug;
# 4. Master read a corrupted event from binlog and send it to slave # 4. Master read a corrupted event from binlog and send it to slave
connection master; connection master;
SET GLOBAL master_verify_checksum=0; SET GLOBAL master_verify_checksum=0;
SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set"; SET @@global.debug_dbug="d,corrupt_read_log_event2_set";
connection slave; connection slave;
START SLAVE IO_THREAD; START SLAVE IO_THREAD;
include/wait_for_slave_io_error.inc [errno=1595,1743] include/wait_for_slave_io_error.inc [errno=1595,1743]
connection master; connection master;
SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; SET @@global.debug_dbug=@saved_dbug;
SET GLOBAL debug_dbug=@saved_dbug;
SET GLOBAL master_verify_checksum=1; SET GLOBAL master_verify_checksum=1;
# 5. Slave. Corruption in network # 5. Slave. Corruption in network
connection slave; connection slave;
SET @saved_dbug_slave = @@GLOBAL.debug_dbug; SET @saved_dbug_slave = @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,corrupt_queue_event"; SET @@global.debug_dbug="d,corrupt_queue_event";
START SLAVE IO_THREAD; START SLAVE IO_THREAD;
include/wait_for_slave_io_error.inc [errno=1595,1743] include/wait_for_slave_io_error.inc [errno=1595,1743]
SET GLOBAL debug_dbug="-d,corrupt_queue_event"; SET @@global.debug_dbug=@saved_dbug_slave;
# 6. Slave. Corruption in relay log # 6. Slave. Corruption in relay log
SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char"; SET @@global.debug_dbug="d,corrupt_read_log_event_char";
START SLAVE SQL_THREAD; START SLAVE SQL_THREAD;
include/wait_for_slave_sql_error.inc [errno=1593] include/wait_for_slave_sql_error.inc [errno=1593]
SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char"; SET @@global.debug_dbug=@saved_dbug_slave;
SET GLOBAL debug_dbug=@saved_dbug_slave;
# 7. Seek diff for tables on master and slave # 7. Seek diff for tables on master and slave
connection slave; connection slave;
include/start_slave.inc include/start_slave.inc

View File

@ -27,7 +27,7 @@ include/start_slave.inc
DO_DOMAIN_IDS (AFTER) : DO_DOMAIN_IDS (AFTER) :
IGNORE_DOMAIN_IDS (AFTER) : IGNORE_DOMAIN_IDS (AFTER) :
SET @saved_dbug = @@GLOBAL.debug_dbug; SET @saved_dbug = @@GLOBAL.debug_dbug;
SET @@global.debug_dbug="+d,kill_slave_io_before_commit"; SET @@global.debug_dbug="d,kill_slave_io_before_commit";
connection master; connection master;
START TRANSACTION; START TRANSACTION;
INSERT INTO t1 VALUES(2); INSERT INTO t1 VALUES(2);
@ -43,7 +43,7 @@ include/wait_for_slave_io_error.inc [errno=1595]
SELECT * FROM t1; SELECT * FROM t1;
i i
1 1
SET @@global.debug_dbug="-d"; SET @@global.debug_dbug=@saved_dbug;
START SLAVE io_thread; START SLAVE io_thread;
include/wait_for_slave_io_to_start.inc include/wait_for_slave_io_to_start.inc
SELECT * FROM t1; SELECT * FROM t1;
@ -61,7 +61,7 @@ CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos;
include/start_slave.inc include/start_slave.inc
DO_DOMAIN_IDS (AFTER) : DO_DOMAIN_IDS (AFTER) :
IGNORE_DOMAIN_IDS (AFTER) : 1 IGNORE_DOMAIN_IDS (AFTER) : 1
SET @@global.debug_dbug="+d,kill_slave_io_before_commit"; SET @@global.debug_dbug="d,kill_slave_io_before_commit";
connection master; connection master;
START TRANSACTION; START TRANSACTION;
INSERT INTO t1 VALUES(4); INSERT INTO t1 VALUES(4);
@ -81,7 +81,7 @@ i
1 1
2 2
3 3
SET @@global.debug_dbug="-d"; SET @@global.debug_dbug=@saved_dbug;
START SLAVE io_thread; START SLAVE io_thread;
include/wait_for_slave_io_to_start.inc include/wait_for_slave_io_to_start.inc
SELECT * FROM t1; SELECT * FROM t1;
@ -99,7 +99,7 @@ CHANGE MASTER TO IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
include/start_slave.inc include/start_slave.inc
DO_DOMAIN_IDS (AFTER) : DO_DOMAIN_IDS (AFTER) :
IGNORE_DOMAIN_IDS (AFTER) : IGNORE_DOMAIN_IDS (AFTER) :
SET @@global.debug_dbug="+d,kill_slave_io_before_commit"; SET @@global.debug_dbug="d,kill_slave_io_before_commit";
connection master; connection master;
START TRANSACTION; START TRANSACTION;
INSERT INTO t1 VALUES(6); INSERT INTO t1 VALUES(6);
@ -134,7 +134,7 @@ i
1 1
2 2
3 3
SET @@global.debug_dbug="-d"; SET @@global.debug_dbug=@saved_dbug;
include/stop_slave.inc include/stop_slave.inc
DO_DOMAIN_IDS (BEFORE) : DO_DOMAIN_IDS (BEFORE) :
IGNORE_DOMAIN_IDS (BEFORE) : IGNORE_DOMAIN_IDS (BEFORE) :
@ -159,7 +159,7 @@ CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos;
include/start_slave.inc include/start_slave.inc
DO_DOMAIN_IDS (AFTER) : DO_DOMAIN_IDS (AFTER) :
IGNORE_DOMAIN_IDS (AFTER) : 1 IGNORE_DOMAIN_IDS (AFTER) : 1
SET @@global.debug_dbug="+d,kill_slave_io_before_commit"; SET @@global.debug_dbug="d,kill_slave_io_before_commit";
connection master; connection master;
SET @@session.gtid_domain_id= 1; SET @@session.gtid_domain_id= 1;
START TRANSACTION; START TRANSACTION;
@ -203,7 +203,7 @@ i
3 3
10 10
11 11
SET @@global.debug_dbug="-d"; SET @@global.debug_dbug=@saved_dbug;
include/stop_slave.inc include/stop_slave.inc
DO_DOMAIN_IDS (BEFORE) : DO_DOMAIN_IDS (BEFORE) :
IGNORE_DOMAIN_IDS (BEFORE) : 1 IGNORE_DOMAIN_IDS (BEFORE) : 1
@ -232,7 +232,7 @@ CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos;
include/start_slave.inc include/start_slave.inc
DO_DOMAIN_IDS (AFTER) : DO_DOMAIN_IDS (AFTER) :
IGNORE_DOMAIN_IDS (AFTER) : 1 IGNORE_DOMAIN_IDS (AFTER) : 1
SET @@global.debug_dbug="+d,kill_slave_io_after_2_events"; SET @@global.debug_dbug="d,kill_slave_io_after_2_events";
connection master; connection master;
SET @@session.gtid_domain_id= 1; SET @@session.gtid_domain_id= 1;
START TRANSACTION; START TRANSACTION;
@ -286,7 +286,7 @@ i
15 15
16 16
17 17
SET @@global.debug_dbug="-d"; SET @@global.debug_dbug=@saved_dbug;
include/stop_slave.inc include/stop_slave.inc
DO_DOMAIN_IDS (BEFORE) : DO_DOMAIN_IDS (BEFORE) :
IGNORE_DOMAIN_IDS (BEFORE) : 1 IGNORE_DOMAIN_IDS (BEFORE) : 1
@ -319,7 +319,7 @@ CHANGE MASTER TO IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
include/start_slave.inc include/start_slave.inc
DO_DOMAIN_IDS (AFTER) : DO_DOMAIN_IDS (AFTER) :
IGNORE_DOMAIN_IDS (AFTER) : IGNORE_DOMAIN_IDS (AFTER) :
SET @@global.debug_dbug="+d,kill_slave_io_after_2_events"; SET @@global.debug_dbug="d,kill_slave_io_after_2_events";
connection master; connection master;
SET @@session.gtid_domain_id= 1; SET @@session.gtid_domain_id= 1;
START TRANSACTION; START TRANSACTION;
@ -383,7 +383,7 @@ i
21 21
22 22
23 23
SET @@global.debug_dbug="-d"; SET @@global.debug_dbug=@saved_dbug;
include/stop_slave.inc include/stop_slave.inc
DO_DOMAIN_IDS (BEFORE) : DO_DOMAIN_IDS (BEFORE) :
IGNORE_DOMAIN_IDS (BEFORE) : IGNORE_DOMAIN_IDS (BEFORE) :

View File

@ -1,33 +1,42 @@
include/master-slave.inc include/master-slave.inc
[connection master] [connection master]
connection slave;
call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: .*"); call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: .*");
call mtr.add_suppression("Slave I/O: .* failed with error: Lost connection to MySQL server at 'reading initial communication packet'"); call mtr.add_suppression("Slave I/O: .* failed with error: Lost connection to MySQL server at 'reading initial communication packet'");
call mtr.add_suppression("Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; .*"); call mtr.add_suppression("Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; .*");
call mtr.add_suppression("Slave I/O thread .* register on master"); call mtr.add_suppression("Slave I/O thread .* register on master");
SET @saved_dbug = @@GLOBAL.debug_dbug;
connection slave;
include/stop_slave.inc include/stop_slave.inc
SET @@global.debug= "+d,'debug_lock.before_get_UNIX_TIMESTAMP'"; SET @old_dbug = @@global.debug_dbug;
SET @@global.debug_dbug= "d,'debug_lock.before_get_UNIX_TIMESTAMP'";
include/start_slave.inc include/start_slave.inc
slave is going to hang in get_master_version_and_clock slave is going to hang in get_master_version_and_clock
include/rpl_stop_server.inc [server_number=1] include/rpl_stop_server.inc [server_number=1]
slave is unblocked slave is unblocked
SET DEBUG_SYNC='now SIGNAL signal.get_unix_timestamp'; SET DEBUG_SYNC='now SIGNAL signal.get_unix_timestamp';
connection slave;
Check network error happened here Check network error happened here
include/wait_for_slave_io_error.inc [errno=1053, 2002, 2003, 2006, 2013] include/wait_for_slave_io_error.inc [errno=1053, 2002, 2003, 2006, 2013]
set @@global.debug = "-d,'debug_lock.before_get_UNIX_TIMESTAMP'"; set @@global.debug_dbug= @old_dbug;
include/rpl_start_server.inc [server_number=1] include/rpl_start_server.inc [server_number=1]
include/wait_for_slave_param.inc [Slave_IO_Running] include/wait_for_slave_param.inc [Slave_IO_Running]
connection slave;
connection slave;
include/stop_slave.inc include/stop_slave.inc
SET @@global.debug= "+d,'debug_lock.before_get_SERVER_ID'"; SET @old_dbug = @@global.debug_dbug;
SET @@global.debug_dbug= "d,'debug_lock.before_get_SERVER_ID'";
include/start_slave.inc include/start_slave.inc
slave is going to hang in get_master_version_and_clock slave is going to hang in get_master_version_and_clock
include/rpl_stop_server.inc [server_number=1] include/rpl_stop_server.inc [server_number=1]
slave is unblocked slave is unblocked
SET DEBUG_SYNC='now SIGNAL signal.get_server_id'; SET DEBUG_SYNC='now SIGNAL signal.get_server_id';
connection slave;
Check network error happened here Check network error happened here
include/wait_for_slave_io_error.inc [errno=1053, 2002, 2003, 2006, 2013] include/wait_for_slave_io_error.inc [errno=1053, 2002, 2003, 2006, 2013]
set @@global.debug = "-d,'debug_lock.before_get_SERVER_ID'"; set @@global.debug_dbug= @old_dbug;
include/rpl_start_server.inc [server_number=1] include/rpl_start_server.inc [server_number=1]
include/wait_for_slave_param.inc [Slave_IO_Running] include/wait_for_slave_param.inc [Slave_IO_Running]
set global debug= ''; SET @@GLOBAL.debug_dbug = @saved_dbug;
SET DEBUG_SYNC= 'RESET'; SET DEBUG_SYNC= 'RESET';
include/rpl_end.inc include/rpl_end.inc

View File

@ -27,16 +27,17 @@ master-bin.000001 # Xid # # COMMIT /* XID */
SET server_id= 3; SET server_id= 3;
SET gtid_seq_no= 3; SET gtid_seq_no= 3;
ERROR HY000: An attempt was made to binlog GTID 0-3-3 which would create an out-of-order sequence number with existing GTID 0-1-3, and gtid strict mode is enabled ERROR HY000: An attempt was made to binlog GTID 0-3-3 which would create an out-of-order sequence number with existing GTID 0-1-3, and gtid strict mode is enabled
SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check"; SET @old_dbug = @@session.debug_dbug;
SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check";
SET gtid_seq_no= 3; SET gtid_seq_no= 3;
SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check"; SET SESSION debug_dbug=@old_dbug;
INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (2);
ERROR HY000: An attempt was made to binlog GTID 0-3-3 which would create an out-of-order sequence number with existing GTID 0-1-3, and gtid strict mode is enabled ERROR HY000: An attempt was made to binlog GTID 0-3-3 which would create an out-of-order sequence number with existing GTID 0-1-3, and gtid strict mode is enabled
SET gtid_seq_no= 2; SET gtid_seq_no= 2;
ERROR HY000: An attempt was made to binlog GTID 0-3-2 which would create an out-of-order sequence number with existing GTID 0-1-3, and gtid strict mode is enabled ERROR HY000: An attempt was made to binlog GTID 0-3-2 which would create an out-of-order sequence number with existing GTID 0-1-3, and gtid strict mode is enabled
SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check"; SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check";
SET gtid_seq_no= 2; SET gtid_seq_no= 2;
SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check"; SET SESSION debug_dbug=@old_dbug;
INSERT INTO t1 VALUES (3); INSERT INTO t1 VALUES (3);
ERROR HY000: An attempt was made to binlog GTID 0-3-2 which would create an out-of-order sequence number with existing GTID 0-1-3, and gtid strict mode is enabled ERROR HY000: An attempt was made to binlog GTID 0-3-2 which would create an out-of-order sequence number with existing GTID 0-1-3, and gtid strict mode is enabled
SET server_id= 1; SET server_id= 1;
@ -62,9 +63,9 @@ master-bin.000001 # Xid # # COMMIT /* XID */
SET server_id= 3; SET server_id= 3;
SET gtid_seq_no= 1; SET gtid_seq_no= 1;
ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-1-4, and gtid strict mode is enabled ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-1-4, and gtid strict mode is enabled
SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check"; SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check";
SET gtid_seq_no= 1; SET gtid_seq_no= 1;
SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check"; SET SESSION debug_dbug=@old_dbug;
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=MyISAM; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=MyISAM;
ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-1-4, and gtid strict mode is enabled ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-1-4, and gtid strict mode is enabled
SET sql_log_bin= 0; SET sql_log_bin= 0;
@ -73,9 +74,9 @@ SET sql_log_bin= 1;
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=MyISAM; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=MyISAM;
SET gtid_seq_no= 1; SET gtid_seq_no= 1;
ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-3-5, and gtid strict mode is enabled ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-3-5, and gtid strict mode is enabled
SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check"; SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check";
SET gtid_seq_no= 1; SET gtid_seq_no= 1;
SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check"; SET SESSION debug_dbug=@old_dbug;
INSERT INTO t2 VALUES (1); INSERT INTO t2 VALUES (1);
ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-3-5, and gtid strict mode is enabled ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-3-5, and gtid strict mode is enabled
SET server_id= 1; SET server_id= 1;

View File

@ -7,15 +7,15 @@ INSERT INTO t2_11753004 VALUES (2);
connection slave; connection slave;
call mtr.add_suppression(".*Found table map event mapping table id 0 which was already mapped but with different settings.*"); call mtr.add_suppression(".*Found table map event mapping table id 0 which was already mapped but with different settings.*");
include/stop_slave.inc include/stop_slave.inc
SET @save_debug= @@global.debug; SET @saved_debug= @@global.debug_dbug;
SET GLOBAL debug_dbug="+d,inject_tblmap_same_id_maps_diff_table"; SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table";
include/start_slave.inc include/start_slave.inc
connection master; connection master;
UPDATE t1_11753004, t2_11753004 SET t1_11753004.c1=3, t2_11753004.c1=4 WHERE t1_11753004.c1=1 OR t2_11753004.c1=2; UPDATE t1_11753004, t2_11753004 SET t1_11753004.c1=3, t2_11753004.c1=4 WHERE t1_11753004.c1=1 OR t2_11753004.c1=2;
connection slave; connection slave;
include/wait_for_slave_sql_error.inc [errno=1593 ] include/wait_for_slave_sql_error.inc [errno=1593 ]
include/stop_slave.inc include/stop_slave.inc
SET GLOBAL debug_dbug="-d,inject_tblmap_same_id_maps_diff_table"; SET @@global.debug_dbug=@saved_debug;
include/start_slave.inc include/start_slave.inc
connection master; connection master;
include/rpl_reset.inc include/rpl_reset.inc
@ -23,7 +23,7 @@ DROP TABLE t1_11753004, t2_11753004;
connection slave; connection slave;
connection slave; connection slave;
include/stop_slave.inc include/stop_slave.inc
SET GLOBAL debug_dbug="+d,inject_tblmap_same_id_maps_diff_table"; SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table";
include/start_slave.inc include/start_slave.inc
include/rpl_reset.inc include/rpl_reset.inc
connection master; connection master;
@ -41,7 +41,7 @@ BINLOG '
SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8= AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=
'/*!*/; '/*!*/;
SET GLOBAL debug_dbug="+d,inject_tblmap_same_id_maps_diff_table"; SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table";
BINLOG ' BINLOG '
SOgWThMBAAAAKQAAAAYDAAAAAEIAAAAAAAEABHRlc3QAAnQxAAEDAAE= SOgWThMBAAAAKQAAAAYDAAAAAEIAAAAAAAEABHRlc3QAAnQxAAEDAAE=
SOgWThMBAAAAKQAAAC8DAAAAAEMAAAAAAAEABHRlc3QAAnQyAAEDAAE= SOgWThMBAAAAKQAAAC8DAAAAAEMAAAAAAAEABHRlc3QAAnQyAAEDAAE=
@ -51,10 +51,10 @@ SOgWThgBAAAAKAAAAH8DAAAAAEMAAAAAAAEAAf///gEAAAD+BAAAAA==
ERROR HY000: Fatal error: Found table map event mapping table id 0 which was already mapped but with different settings. ERROR HY000: Fatal error: Found table map event mapping table id 0 which was already mapped but with different settings.
DROP TABLE t1,t2; DROP TABLE t1,t2;
connection slave; connection slave;
SET GLOBAL debug_dbug="-d,inject_tblmap_same_id_maps_diff_table"; SET @@global.debug_dbug=@saved_debug;
connection master; connection master;
DROP TABLE t1_11753004; DROP TABLE t1_11753004;
DROP TABLE t2_11753004_ign; DROP TABLE t2_11753004_ign;
connection slave; connection slave;
SET GLOBAL debug_dbug= @save_debug; SET @@global.debug_dbug= @save_debug;
include/rpl_end.inc include/rpl_end.inc

View File

@ -7,7 +7,7 @@ create table tm (a int auto_increment primary key) engine=myisam;
create table ti (a int auto_increment primary key) engine=innodb; create table ti (a int auto_increment primary key) engine=innodb;
connection slave; connection slave;
SET @saved_dbug = @@GLOBAL.debug_dbug; SET @saved_dbug = @@GLOBAL.debug_dbug;
set @@global.debug_dbug="+d,stop_slave_middle_group"; set @@global.debug_dbug="d,stop_slave_middle_group";
connection master; connection master;
begin; begin;
insert into ti set a=null; insert into ti set a=null;
@ -28,14 +28,13 @@ one
select count(*) as one from ti; select count(*) as one from ti;
one one
1 1
set @@global.debug_dbug="-d"; set @@global.debug_dbug=@saved_dbug;
include/start_slave.inc include/start_slave.inc
connection master; connection master;
truncate table tm; truncate table tm;
truncate table ti; truncate table ti;
connection slave; connection slave;
set @@global.debug_dbug="+d,stop_slave_middle_group"; set @@global.debug_dbug="d,stop_slave_middle_group,incomplete_group_in_relay_log";
set @@global.debug_dbug="+d,incomplete_group_in_relay_log";
connection master; connection master;
begin; begin;
insert into ti set a=null; insert into ti set a=null;
@ -54,14 +53,13 @@ one
select count(*) as zero from ti; select count(*) as zero from ti;
zero zero
0 0
set @@global.debug_dbug="-d"; set @@global.debug_dbug=@saved_dbug;
stop slave; stop slave;
truncate table tm; truncate table tm;
include/start_slave.inc include/start_slave.inc
connection master; connection master;
connection slave; connection slave;
set @@global.debug_dbug="+d,stop_slave_middle_group"; set @@global.debug_dbug="d,stop_slave_middle_group,incomplete_group_in_relay_log";
set @@global.debug_dbug="+d,incomplete_group_in_relay_log";
connection master; connection master;
update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2; update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2;
connection slave; connection slave;

View File

@ -24,8 +24,8 @@
--connection M2 --connection M2
STOP SLAVE; STOP SLAVE;
SET @old_debug= @@global.debug; SET @old_debug= @@global.debug_dbug;
SET GLOBAL debug_dbug= "+d,dbug.rows_events_to_delay_relay_logging"; SET GLOBAL debug_dbug= "d,dbug.rows_events_to_delay_relay_logging";
START SLAVE IO_THREAD; START SLAVE IO_THREAD;
--source include/wait_for_slave_io_to_start.inc --source include/wait_for_slave_io_to_start.inc

View File

@ -1 +0,0 @@
--loose-debug=-d,simulate_find_log_pos_error

View File

@ -36,7 +36,7 @@ let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignor
--echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after --echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after
SET @saved_dbug = @@GLOBAL.debug_dbug; SET @saved_dbug = @@GLOBAL.debug_dbug;
SET @@global.debug_dbug="+d,kill_slave_io_before_commit"; SET @@global.debug_dbug="d,kill_slave_io_before_commit";
connection master; connection master;
@ -51,7 +51,7 @@ connection slave;
--let $slave_io_errno= 1595 --let $slave_io_errno= 1595
--source include/wait_for_slave_io_error.inc --source include/wait_for_slave_io_error.inc
SELECT * FROM t1; SELECT * FROM t1;
SET @@global.debug_dbug="-d"; SET @@global.debug_dbug=@saved_dbug;
START SLAVE io_thread; START SLAVE io_thread;
--source include/wait_for_slave_io_to_start.inc --source include/wait_for_slave_io_to_start.inc
@ -77,7 +77,7 @@ let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignor
--echo DO_DOMAIN_IDS (AFTER) : $do_domain_ids_after --echo DO_DOMAIN_IDS (AFTER) : $do_domain_ids_after
--echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after --echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after
SET @@global.debug_dbug="+d,kill_slave_io_before_commit"; SET @@global.debug_dbug="d,kill_slave_io_before_commit";
connection master; connection master;
@ -93,7 +93,7 @@ connection slave;
--let $slave_io_errno= 1595 --let $slave_io_errno= 1595
--source include/wait_for_slave_io_error.inc --source include/wait_for_slave_io_error.inc
SELECT * FROM t1; SELECT * FROM t1;
SET @@global.debug_dbug="-d"; SET @@global.debug_dbug=@saved_dbug;
START SLAVE io_thread; START SLAVE io_thread;
--source include/wait_for_slave_io_to_start.inc --source include/wait_for_slave_io_to_start.inc
@ -119,7 +119,7 @@ let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignor
--echo DO_DOMAIN_IDS (AFTER) : $do_domain_ids_after --echo DO_DOMAIN_IDS (AFTER) : $do_domain_ids_after
--echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after --echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after
SET @@global.debug_dbug="+d,kill_slave_io_before_commit"; SET @@global.debug_dbug="d,kill_slave_io_before_commit";
connection master; connection master;
@ -148,7 +148,7 @@ connection slave;
--source include/wait_for_slave_io_error.inc --source include/wait_for_slave_io_error.inc
SELECT * FROM t1; SELECT * FROM t1;
SET @@global.debug_dbug="-d"; SET @@global.debug_dbug=@saved_dbug;
--source include/stop_slave.inc --source include/stop_slave.inc
let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1); let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
@ -186,7 +186,7 @@ let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignor
--echo DO_DOMAIN_IDS (AFTER) : $do_domain_ids_after --echo DO_DOMAIN_IDS (AFTER) : $do_domain_ids_after
--echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after --echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after
SET @@global.debug_dbug="+d,kill_slave_io_before_commit"; SET @@global.debug_dbug="d,kill_slave_io_before_commit";
connection master; connection master;
@ -216,7 +216,7 @@ connection slave;
--source include/wait_for_slave_io_error.inc --source include/wait_for_slave_io_error.inc
SELECT * FROM t1; SELECT * FROM t1;
SET @@global.debug_dbug="-d"; SET @@global.debug_dbug=@saved_dbug;
--source include/stop_slave.inc --source include/stop_slave.inc
let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1); let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
@ -254,7 +254,7 @@ let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignor
--echo DO_DOMAIN_IDS (AFTER) : $do_domain_ids_after --echo DO_DOMAIN_IDS (AFTER) : $do_domain_ids_after
--echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after --echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after
SET @@global.debug_dbug="+d,kill_slave_io_after_2_events"; SET @@global.debug_dbug="d,kill_slave_io_after_2_events";
connection master; connection master;
@ -284,7 +284,7 @@ connection slave;
--source include/wait_for_slave_io_error.inc --source include/wait_for_slave_io_error.inc
SELECT * FROM t1; SELECT * FROM t1;
SET @@global.debug_dbug="-d"; SET @@global.debug_dbug=@saved_dbug;
--source include/stop_slave.inc --source include/stop_slave.inc
let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1); let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
@ -322,7 +322,7 @@ let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignor
--echo DO_DOMAIN_IDS (AFTER) : $do_domain_ids_after --echo DO_DOMAIN_IDS (AFTER) : $do_domain_ids_after
--echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after --echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after
SET @@global.debug_dbug="+d,kill_slave_io_after_2_events"; SET @@global.debug_dbug="d,kill_slave_io_after_2_events";
connection master; connection master;
@ -352,7 +352,7 @@ connection slave;
--source include/wait_for_slave_io_error.inc --source include/wait_for_slave_io_error.inc
SELECT * FROM t1; SELECT * FROM t1;
SET @@global.debug_dbug="-d"; SET @@global.debug_dbug=@saved_dbug;
--source include/stop_slave.inc --source include/stop_slave.inc
let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1); let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);

View File

@ -29,17 +29,18 @@ INSERT INTO t1 VALUES (1);
SET server_id= 3; SET server_id= 3;
--error ER_GTID_STRICT_OUT_OF_ORDER --error ER_GTID_STRICT_OUT_OF_ORDER
SET gtid_seq_no= 3; SET gtid_seq_no= 3;
SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check"; SET @old_dbug = @@session.debug_dbug;
SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check";
SET gtid_seq_no= 3; SET gtid_seq_no= 3;
SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check"; SET SESSION debug_dbug=@old_dbug;
--error ER_GTID_STRICT_OUT_OF_ORDER --error ER_GTID_STRICT_OUT_OF_ORDER
INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (2);
--error ER_GTID_STRICT_OUT_OF_ORDER --error ER_GTID_STRICT_OUT_OF_ORDER
SET gtid_seq_no= 2; SET gtid_seq_no= 2;
SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check"; SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check";
SET gtid_seq_no= 2; SET gtid_seq_no= 2;
SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check"; SET SESSION debug_dbug=@old_dbug;
--error ER_GTID_STRICT_OUT_OF_ORDER --error ER_GTID_STRICT_OUT_OF_ORDER
INSERT INTO t1 VALUES (3); INSERT INTO t1 VALUES (3);
SET server_id= 1; SET server_id= 1;
@ -52,9 +53,9 @@ SELECT * FROM t1 ORDER BY 1;
SET server_id= 3; SET server_id= 3;
--error ER_GTID_STRICT_OUT_OF_ORDER --error ER_GTID_STRICT_OUT_OF_ORDER
SET gtid_seq_no= 1; SET gtid_seq_no= 1;
SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check"; SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check";
SET gtid_seq_no= 1; SET gtid_seq_no= 1;
SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check"; SET SESSION debug_dbug=@old_dbug;
--error ER_GTID_STRICT_OUT_OF_ORDER --error ER_GTID_STRICT_OUT_OF_ORDER
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=MyISAM; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=MyISAM;
# The table is still created, DDL cannot be rolled back. # The table is still created, DDL cannot be rolled back.
@ -66,9 +67,9 @@ CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=MyISAM;
--error ER_GTID_STRICT_OUT_OF_ORDER --error ER_GTID_STRICT_OUT_OF_ORDER
SET gtid_seq_no= 1; SET gtid_seq_no= 1;
SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check"; SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check";
SET gtid_seq_no= 1; SET gtid_seq_no= 1;
SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check"; SET SESSION debug_dbug=@old_dbug;
--error ER_GTID_STRICT_OUT_OF_ORDER --error ER_GTID_STRICT_OUT_OF_ORDER
INSERT INTO t2 VALUES (1); INSERT INTO t2 VALUES (1);
# The value is still inserted, cannot be rolled back. # The value is still inserted, cannot be rolled back.

View File

@ -27,8 +27,8 @@ call mtr.add_suppression(".*Found table map event mapping table id 0 which was a
# stop the slave and inject corruption # stop the slave and inject corruption
--source include/stop_slave.inc --source include/stop_slave.inc
SET @save_debug= @@global.debug; SET @saved_debug= @@global.debug_dbug;
SET GLOBAL debug_dbug="+d,inject_tblmap_same_id_maps_diff_table"; SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table";
--source include/start_slave.inc --source include/start_slave.inc
--connection master --connection master
# both tables get mapped to 0 (in a way, simulating scenario # both tables get mapped to 0 (in a way, simulating scenario
@ -42,7 +42,7 @@ SET GLOBAL debug_dbug="+d,inject_tblmap_same_id_maps_diff_table";
--source include/stop_slave.inc --source include/stop_slave.inc
# clean up # clean up
SET GLOBAL debug_dbug="-d,inject_tblmap_same_id_maps_diff_table"; SET @@global.debug_dbug=@saved_debug;
--source include/start_slave.inc --source include/start_slave.inc
--connection master --connection master
--source include/rpl_reset.inc --source include/rpl_reset.inc
@ -55,7 +55,7 @@ SET GLOBAL debug_dbug="-d,inject_tblmap_same_id_maps_diff_table";
--connection slave --connection slave
--source include/stop_slave.inc --source include/stop_slave.inc
SET GLOBAL debug_dbug="+d,inject_tblmap_same_id_maps_diff_table"; SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table";
--source include/start_slave.inc --source include/start_slave.inc
--source include/rpl_reset.inc --source include/rpl_reset.inc
--connection master --connection master
@ -92,7 +92,7 @@ AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=
#110708 12:21:44 server id 1 end_log_pos 855 Update_rows: table id 66 #110708 12:21:44 server id 1 end_log_pos 855 Update_rows: table id 66
# at 855 # at 855
#110708 12:21:44 server id 1 end_log_pos 895 Update_rows: table id 67 flags: STMT_END_F #110708 12:21:44 server id 1 end_log_pos 895 Update_rows: table id 67 flags: STMT_END_F
SET GLOBAL debug_dbug="+d,inject_tblmap_same_id_maps_diff_table"; SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table";
--error ER_SLAVE_FATAL_ERROR --error ER_SLAVE_FATAL_ERROR
BINLOG ' BINLOG '
SOgWThMBAAAAKQAAAAYDAAAAAEIAAAAAAAEABHRlc3QAAnQxAAEDAAE= SOgWThMBAAAAKQAAAAYDAAAAAEIAAAAAAAEABHRlc3QAAnQxAAEDAAE=
@ -105,11 +105,11 @@ SOgWThgBAAAAKAAAAH8DAAAAAEMAAAAAAAEAAf///gEAAAD+BAAAAA==
# clean up # clean up
DROP TABLE t1,t2; DROP TABLE t1,t2;
--connection slave --connection slave
SET GLOBAL debug_dbug="-d,inject_tblmap_same_id_maps_diff_table"; SET @@global.debug_dbug=@saved_debug;
--connection master --connection master
--eval DROP TABLE $t1 --eval DROP TABLE $t1
--eval DROP TABLE $t2_ign --eval DROP TABLE $t2_ign
--sync_slave_with_master --sync_slave_with_master
SET GLOBAL debug_dbug= @save_debug; SET @@global.debug_dbug= @save_debug;
--source include/rpl_end.inc --source include/rpl_end.inc

View File

@ -0,0 +1,49 @@
SET @start_global_value = @@global.innodb_instant_alter_column_allowed;
SET GLOBAL innodb_instant_alter_column_allowed=never;
select @@session.innodb_instant_alter_column_allowed;
ERROR HY000: Variable 'innodb_instant_alter_column_allowed' is a GLOBAL variable
show global variables like 'innodb_instant_alter_column_allowed';
Variable_name Value
innodb_instant_alter_column_allowed never
show session variables like 'innodb_instant_alter_column_allowed';
Variable_name Value
innodb_instant_alter_column_allowed never
SELECT * FROM information_schema.global_variables
WHERE variable_name='innodb_instant_alter_column_allowed';
VARIABLE_NAME VARIABLE_VALUE
INNODB_INSTANT_ALTER_COLUMN_ALLOWED never
SELECT * FROM information_schema.session_variables
WHERE variable_name='innodb_instant_alter_column_allowed';
VARIABLE_NAME VARIABLE_VALUE
INNODB_INSTANT_ALTER_COLUMN_ALLOWED never
set global innodb_instant_alter_column_allowed=no;
ERROR 42000: Variable 'innodb_instant_alter_column_allowed' can't be set to the value of 'no'
set global innodb_instant_alter_column_allowed=1.1;
ERROR 42000: Incorrect argument type to variable 'innodb_instant_alter_column_allowed'
set global innodb_instant_alter_column_allowed=-1;
ERROR 42000: Variable 'innodb_instant_alter_column_allowed' can't be set to the value of '-1'
select @@global.innodb_instant_alter_column_allowed;
@@global.innodb_instant_alter_column_allowed
never
set global innodb_instant_alter_column_allowed=3;
ERROR 42000: Variable 'innodb_instant_alter_column_allowed' can't be set to the value of '3'
select @@global.innodb_instant_alter_column_allowed;
@@global.innodb_instant_alter_column_allowed
never
set global innodb_instant_alter_column_allowed=2;
select @@global.innodb_instant_alter_column_allowed;
@@global.innodb_instant_alter_column_allowed
add_drop_reorder
set global innodb_instant_alter_column_allowed=1;
select @@global.innodb_instant_alter_column_allowed;
@@global.innodb_instant_alter_column_allowed
add_last
set global innodb_instant_alter_column_allowed=0;
select @@global.innodb_instant_alter_column_allowed;
@@global.innodb_instant_alter_column_allowed
never
set global innodb_instant_alter_column_allowed=default;
select @@global.innodb_instant_alter_column_allowed;
@@global.innodb_instant_alter_column_allowed
add_drop_reorder
SET GLOBAL innodb_instant_alter_column_allowed = @start_global_value;

View File

@ -1137,6 +1137,18 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON ENUM_VALUE_LIST OFF,ON
READ_ONLY NO READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_INSTANT_ALTER_COLUMN_ALLOWED
SESSION_VALUE NULL
DEFAULT_VALUE add_drop_reorder
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE ENUM
VARIABLE_COMMENT File format constraint for ALTER TABLE
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST never,add_last,add_drop_reorder
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_IO_CAPACITY VARIABLE_NAME INNODB_IO_CAPACITY
SESSION_VALUE NULL SESSION_VALUE NULL
DEFAULT_VALUE 200 DEFAULT_VALUE 200

View File

@ -0,0 +1,34 @@
--source include/have_innodb.inc
SET @start_global_value = @@global.innodb_instant_alter_column_allowed;
SET GLOBAL innodb_instant_alter_column_allowed=never;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.innodb_instant_alter_column_allowed;
show global variables like 'innodb_instant_alter_column_allowed';
show session variables like 'innodb_instant_alter_column_allowed';
SELECT * FROM information_schema.global_variables
WHERE variable_name='innodb_instant_alter_column_allowed';
SELECT * FROM information_schema.session_variables
WHERE variable_name='innodb_instant_alter_column_allowed';
--error ER_WRONG_VALUE_FOR_VAR
set global innodb_instant_alter_column_allowed=no;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_instant_alter_column_allowed=1.1;
--error ER_WRONG_VALUE_FOR_VAR
set global innodb_instant_alter_column_allowed=-1;
select @@global.innodb_instant_alter_column_allowed;
--error ER_WRONG_VALUE_FOR_VAR
set global innodb_instant_alter_column_allowed=3;
select @@global.innodb_instant_alter_column_allowed;
set global innodb_instant_alter_column_allowed=2;
select @@global.innodb_instant_alter_column_allowed;
set global innodb_instant_alter_column_allowed=1;
select @@global.innodb_instant_alter_column_allowed;
set global innodb_instant_alter_column_allowed=0;
select @@global.innodb_instant_alter_column_allowed;
set global innodb_instant_alter_column_allowed=default;
select @@global.innodb_instant_alter_column_allowed;
SET GLOBAL innodb_instant_alter_column_allowed = @start_global_value;

View File

@ -10071,7 +10071,8 @@ ha_partition::check_if_supported_inplace_alter(TABLE *altered_table,
Alter_inplace_info *ha_alter_info) Alter_inplace_info *ha_alter_info)
{ {
uint index= 0; uint index= 0;
enum_alter_inplace_result result= HA_ALTER_INPLACE_NO_LOCK; enum_alter_inplace_result result;
alter_table_operations orig_ops;
ha_partition_inplace_ctx *part_inplace_ctx; ha_partition_inplace_ctx *part_inplace_ctx;
bool first_is_set= false; bool first_is_set= false;
THD *thd= ha_thd(); THD *thd= ha_thd();
@ -10098,33 +10099,35 @@ ha_partition::check_if_supported_inplace_alter(TABLE *altered_table,
if (!part_inplace_ctx->handler_ctx_array) if (!part_inplace_ctx->handler_ctx_array)
DBUG_RETURN(HA_ALTER_ERROR); DBUG_RETURN(HA_ALTER_ERROR);
/* Set all to NULL, including the terminating one. */ do {
for (index= 0; index <= m_tot_parts; index++) result= HA_ALTER_INPLACE_NO_LOCK;
part_inplace_ctx->handler_ctx_array[index]= NULL; /* Set all to NULL, including the terminating one. */
for (index= 0; index <= m_tot_parts; index++)
part_inplace_ctx->handler_ctx_array[index]= NULL;
ha_alter_info->handler_flags |= ALTER_PARTITIONED; ha_alter_info->handler_flags |= ALTER_PARTITIONED;
for (index= 0; index < m_tot_parts; index++) orig_ops= ha_alter_info->handler_flags;
{ for (index= 0; index < m_tot_parts; index++)
enum_alter_inplace_result p_result= {
m_file[index]->check_if_supported_inplace_alter(altered_table, enum_alter_inplace_result p_result=
ha_alter_info); m_file[index]->check_if_supported_inplace_alter(altered_table,
part_inplace_ctx->handler_ctx_array[index]= ha_alter_info->handler_ctx; ha_alter_info);
part_inplace_ctx->handler_ctx_array[index]= ha_alter_info->handler_ctx;
if (index == 0) if (index == 0)
{ first_is_set= (ha_alter_info->handler_ctx != NULL);
first_is_set= (ha_alter_info->handler_ctx != NULL); else if (first_is_set != (ha_alter_info->handler_ctx != NULL))
{
/* Either none or all partitions must set handler_ctx! */
DBUG_ASSERT(0);
DBUG_RETURN(HA_ALTER_ERROR);
}
if (p_result < result)
result= p_result;
if (result == HA_ALTER_ERROR)
break;
} }
else if (first_is_set != (ha_alter_info->handler_ctx != NULL)) } while (orig_ops != ha_alter_info->handler_flags);
{
/* Either none or all partitions must set handler_ctx! */
DBUG_ASSERT(0);
DBUG_RETURN(HA_ALTER_ERROR);
}
if (p_result < result)
result= p_result;
if (result == HA_ALTER_ERROR)
break;
}
ha_alter_info->handler_ctx= part_inplace_ctx; ha_alter_info->handler_ctx= part_inplace_ctx;
/* /*

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2018, Oracle and/or its affiliates. Copyright (c) 2000, 2018, Oracle and/or its affiliates.
Copyright (c) 2010, 2019, MariaDB Corporation Copyright (c) 2010, 2020, 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
@ -2559,42 +2559,46 @@ bool Type_std_attributes::agg_item_set_converter(const DTCollation &coll,
/** /**
@brief @brief
Building clone for Item_func_or_sum Building clone for Item_func_or_sum
@param thd thread handle @param thd thread handle
@param mem_root part of the memory for the clone @param mem_root part of the memory for the clone
@details @details
This method gets copy of the current item and also This method first builds clones of the arguments. If it is successful with
build clones for its referencies. For the referencies buiding the clones then it constructs a copy of this Item_func_or_sum object
build_copy is called again. and attaches to it the built clones of the arguments.
@retval @return clone of the item
clone of the item @retval 0 on a failure
0 if an error occurred */
*/
Item* Item_func_or_sum::build_clone(THD *thd) Item* Item_func_or_sum::build_clone(THD *thd)
{ {
Item_func_or_sum *copy= (Item_func_or_sum *) get_copy(thd); Item *copy_tmp_args[2]= {0,0};
if (unlikely(!copy)) Item **copy_args= copy_tmp_args;
return 0;
if (arg_count > 2) if (arg_count > 2)
{ {
copy->args= copy_args= static_cast<Item**>
(Item**) alloc_root(thd->mem_root, sizeof(Item*) * arg_count); (alloc_root(thd->mem_root, sizeof(Item*) * arg_count));
if (unlikely(!copy->args)) if (unlikely(!copy_args))
return 0; return 0;
} }
else if (arg_count > 0)
copy->args= copy->tmp_arg;
for (uint i= 0; i < arg_count; i++) for (uint i= 0; i < arg_count; i++)
{ {
Item *arg_clone= args[i]->build_clone(thd); Item *arg_clone= args[i]->build_clone(thd);
if (!arg_clone) if (unlikely(!arg_clone))
return 0; return 0;
copy->args[i]= arg_clone; copy_args[i]= arg_clone;
}
Item_func_or_sum *copy= static_cast<Item_func_or_sum *>(get_copy(thd));
if (unlikely(!copy))
return 0;
if (arg_count > 2)
copy->args= copy_args;
else if (arg_count > 0)
{
copy->args= copy->tmp_arg;
memcpy(copy->args, copy_args, sizeof(Item *) * arg_count);
} }
return copy; return copy;
} }

View File

@ -1,5 +1,6 @@
/* /*
Copyright (c) 2002, 2011, Oracle and/or its affiliates. Copyright (c) 2002, 2011, Oracle and/or its affiliates.
Copyright (c) 2011, 2020, 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
@ -165,16 +166,20 @@ void Item_row::bring_value()
Item* Item_row::build_clone(THD *thd) Item* Item_row::build_clone(THD *thd)
{ {
Item_row *copy= (Item_row *) get_copy(thd); Item **copy_args= static_cast<Item**>
if (!copy) (alloc_root(thd->mem_root, sizeof(Item*) * arg_count));
if (unlikely(!copy_args))
return 0; return 0;
copy->args= (Item**) alloc_root(thd->mem_root, sizeof(Item*) * arg_count);
for (uint i= 0; i < arg_count; i++) for (uint i= 0; i < arg_count; i++)
{ {
Item *arg_clone= args[i]->build_clone(thd); Item *arg_clone= args[i]->build_clone(thd);
if (!arg_clone) if (!arg_clone)
return 0; return 0;
copy->args[i]= arg_clone; copy_args[i]= arg_clone;
} }
Item_row *copy= (Item_row *) get_copy(thd);
if (unlikely(!copy))
return 0;
copy->args= copy_args;
return copy; return copy;
} }

View File

@ -968,7 +968,7 @@ SplM_plan_info * JOIN_TAB::choose_best_splitting(double record_count,
The plan for the chosen key has not been found in the cache. The plan for the chosen key has not been found in the cache.
Build a new plan and save info on it in the cache Build a new plan and save info on it in the cache
*/ */
table_map all_table_map= (1 << join->table_count) - 1; table_map all_table_map= (((table_map) 1) << join->table_count) - 1;
reset_validity_vars_for_keyuses(best_key_keyuse_ext_start, best_table, reset_validity_vars_for_keyuses(best_key_keyuse_ext_start, best_table,
best_key, remaining_tables, true); best_key, remaining_tables, true);
choose_plan(join, all_table_map & ~join->const_table_map); choose_plan(join, all_table_map & ~join->const_table_map);

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. /* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, MariaDB Corporation Copyright (c) 2009, 2020, 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

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2015, Oracle and/or its affiliates. Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2019, MariaDB Corporation. Copyright (c) 2008, 2020, 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
@ -608,6 +608,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
m_current_stage_key(0), m_current_stage_key(0),
in_sub_stmt(0), log_all_errors(0), in_sub_stmt(0), log_all_errors(0),
binlog_unsafe_warning_flags(0), binlog_unsafe_warning_flags(0),
current_stmt_binlog_format(BINLOG_FORMAT_MIXED),
binlog_table_maps(0), binlog_table_maps(0),
bulk_param(0), bulk_param(0),
table_map_for_update(0), table_map_for_update(0),

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2007, 2013, Oracle and/or its affiliates. Copyright (c) 2007, 2013, Oracle and/or its affiliates.
Copyright (c) 2008, 2016, MariaDB Copyright (c) 2008, 2020, MariaDB
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

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. /* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2008, 2019, MariaDB Copyright (c) 2008, 2020, MariaDB
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

View File

@ -2958,8 +2958,12 @@ int JOIN::optimize_stage2()
having_is_correlated= MY_TEST(having->used_tables() & OUTER_REF_TABLE_BIT); having_is_correlated= MY_TEST(having->used_tables() & OUTER_REF_TABLE_BIT);
tmp_having= having; tmp_having= having;
if ((select_lex->options & OPTION_SCHEMA_TABLE)) if ((select_lex->options & OPTION_SCHEMA_TABLE) &&
optimize_schema_tables_reads(this); optimize_schema_tables_reads(this))
DBUG_RETURN(TRUE);
if (unlikely(thd->is_error()))
DBUG_RETURN(TRUE);
/* /*
The loose index scan access method guarantees that all grouping or The loose index scan access method guarantees that all grouping or

View File

@ -2,7 +2,7 @@
#define SQL_SELECT_INCLUDED #define SQL_SELECT_INCLUDED
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. /* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2008, 2017, MariaDB Corporation. Copyright (c) 2008, 2020, 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
@ -1665,6 +1665,9 @@ public:
void copy_ref_ptr_array(Ref_ptr_array dst_arr, Ref_ptr_array src_arr) void copy_ref_ptr_array(Ref_ptr_array dst_arr, Ref_ptr_array src_arr)
{ {
DBUG_ASSERT(dst_arr.size() >= src_arr.size()); DBUG_ASSERT(dst_arr.size() >= src_arr.size());
if (src_arr.size() == 0)
return;
void *dest= dst_arr.array(); void *dest= dst_arr.array();
const void *src= src_arr.array(); const void *src= src_arr.array();
memcpy(dest, src, src_arr.size() * src_arr.element_size()); memcpy(dest, src, src_arr.size() * src_arr.element_size());

View File

@ -8765,7 +8765,6 @@ end:
bool optimize_schema_tables_reads(JOIN *join) bool optimize_schema_tables_reads(JOIN *join)
{ {
THD *thd= join->thd; THD *thd= join->thd;
bool result= 0;
DBUG_ENTER("optimize_schema_tables_reads"); DBUG_ENTER("optimize_schema_tables_reads");
JOIN_TAB *tab; JOIN_TAB *tab;
@ -8800,11 +8799,11 @@ bool optimize_schema_tables_reads(JOIN *join)
*/ */
cond= tab->cache_select->cond; cond= tab->cache_select->cond;
} }
if (optimize_for_get_all_tables(thd, table_list, cond))
optimize_for_get_all_tables(thd, table_list, cond); DBUG_RETURN(TRUE); // Handle OOM
} }
} }
DBUG_RETURN(result); DBUG_RETURN(FALSE);
} }

View File

@ -3,7 +3,7 @@
/* /*
Copyright (c) 2000, 2013, Oracle and/or its affiliates. Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2008, 2019, MariaDB Corporation. Copyright (c) 2008, 2020, 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
@ -79,6 +79,10 @@ public:
Well_formed_prefix(CHARSET_INFO *cs, const char *str, size_t length) Well_formed_prefix(CHARSET_INFO *cs, const char *str, size_t length)
:Well_formed_prefix_status(cs, str, str + length, length), m_str(str) :Well_formed_prefix_status(cs, str, str + length, length), m_str(str)
{ } { }
Well_formed_prefix(CHARSET_INFO *cs, LEX_STRING str, size_t nchars)
:Well_formed_prefix_status(cs, str.str, str.str + str.length, nchars),
m_str(str.str)
{ }
size_t length() const { return m_source_end_pos - m_str; } size_t length() const { return m_source_end_pos - m_str; }
}; };

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2019, Oracle and/or its affiliates. Copyright (c) 2000, 2019, Oracle and/or its affiliates.
Copyright (c) 2010, 2019, MariaDB Copyright (c) 2010, 2020, MariaDB
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
@ -4392,8 +4392,14 @@ bool validate_comment_length(THD *thd, LEX_CSTRING *comment, size_t max_len,
uint err_code, const char *name) uint err_code, const char *name)
{ {
DBUG_ENTER("validate_comment_length"); DBUG_ENTER("validate_comment_length");
size_t tmp_len= my_charpos(system_charset_info, comment->str, if (comment->length == 0)
comment->str + comment->length, max_len); DBUG_RETURN(false);
if (max_len > comment->length)
max_len= comment->length;
size_t tmp_len=
Well_formed_prefix(system_charset_info, comment->str, max_len).length();
if (tmp_len < comment->length) if (tmp_len < comment->length)
{ {
if (thd->is_strict_mode()) if (thd->is_strict_mode())

View File

@ -766,7 +766,6 @@ void JDBConn::AddJars(PSTRG jpop, char sep)
/***********************************************************************/ /***********************************************************************/
bool JDBConn::Connect(PJPARM sop) bool JDBConn::Connect(PJPARM sop)
{ {
int irc = RC_FX;
bool err = false; bool err = false;
jint rc; jint rc;
jboolean jt = (trace(1)); jboolean jt = (trace(1));

View File

@ -167,8 +167,7 @@ PQRYRES __stdcall ColREST(PGLOBAL g, PTOS tp, char *tab, char *db, bool info)
#endif // !MARIADB #endif // !MARIADB
// We used the file name relative to recorded datapath // We used the file name relative to recorded datapath
strcat(strcat(strcat(strcpy(filename, "."), slash), db), slash); snprintf(filename, sizeof filename, IF_WIN(".\\%s\\%s","./%s/%s"), db, fn);
strncat(filename, fn, _MAX_PATH - strlen(filename));
// Retrieve the file from the web and copy it locally // Retrieve the file from the web and copy it locally
if (http && grf(g->Message, trace(515), http, uri, filename)) { if (http && grf(g->Message, trace(515), http, uri, filename)) {

View File

@ -5,10 +5,7 @@
/***********************************************************************/ /***********************************************************************/
#pragma once #pragma once
#if defined(__WIN__) #ifndef __WIN__
static PCSZ slash = "\\";
#else // !__WIN__
static PCSZ slash = "/";
#define stricmp strcasecmp #define stricmp strcasecmp
#endif // !__WIN__ #endif // !__WIN__

View File

@ -75,6 +75,8 @@ Created 11/5/1995 Heikki Tuuri
#include "lzo/lzo1x.h" #include "lzo/lzo1x.h"
#endif #endif
using st_::span;
#ifdef HAVE_LIBNUMA #ifdef HAVE_LIBNUMA
#include <numa.h> #include <numa.h>
#include <numaif.h> #include <numaif.h>
@ -457,7 +459,7 @@ buf_pool_register_chunk(
@return true if temporary tablespace decrypted, false if not */ @return true if temporary tablespace decrypted, false if not */
static bool buf_tmp_page_decrypt(byte* tmp_frame, byte* src_frame) static bool buf_tmp_page_decrypt(byte* tmp_frame, byte* src_frame)
{ {
if (buf_page_is_zeroes(src_frame, srv_page_size)) { if (buf_is_zeroes(span<const byte>(src_frame, srv_page_size))) {
return true; return true;
} }
@ -964,20 +966,14 @@ static void buf_page_check_lsn(bool check_lsn, const byte* read_buf)
#endif /* !UNIV_INNOCHECKSUM */ #endif /* !UNIV_INNOCHECKSUM */
} }
/** Check if a page is all zeroes.
@param[in] read_buf database page /** Check if a buffer is all zeroes.
@param[in] page_size page frame size @param[in] buf data to check
@return whether the page is all zeroes */ @return whether the buffer is all zeroes */
bool buf_page_is_zeroes(const void* read_buf, size_t page_size) bool buf_is_zeroes(span<const byte> buf)
{ {
const ulint* b = reinterpret_cast<const ulint*>(read_buf); ut_ad(buf.size() <= sizeof field_ref_zero);
const ulint* const e = b + page_size / sizeof *b; return memcmp(buf.data(), field_ref_zero, buf.size()) == 0;
do {
if (*b++) {
return false;
}
} while (b != e);
return true;
} }
/** Check if a page is corrupt. /** Check if a page is corrupt.
@ -1006,7 +1002,7 @@ buf_page_is_corrupted(
uint crc32 = mach_read_from_4(end); uint crc32 = mach_read_from_4(end);
if (!crc32 && size == srv_page_size if (!crc32 && size == srv_page_size
&& buf_page_is_zeroes(read_buf, size)) { && buf_is_zeroes(span<const byte>(read_buf, size))) {
return false; return false;
} }
@ -1095,8 +1091,9 @@ buf_page_is_corrupted(
compile_time_assert(!(FIL_PAGE_LSN % 8)); compile_time_assert(!(FIL_PAGE_LSN % 8));
/* A page filled with NUL bytes is considered not corrupted. /* A page filled with NUL bytes is considered not corrupted.
The FIL_PAGE_FILE_FLUSH_LSN field may be written nonzero for Before MariaDB Server 10.1.25 (MDEV-12113) or 10.2.2 (or MySQL 5.7),
the first page of each file of the system tablespace. the FIL_PAGE_FILE_FLUSH_LSN field may have been written nonzero
for the first page of each file of the system tablespace.
We want to ignore it for the system tablespace, but because We want to ignore it for the system tablespace, but because
we do not know the expected tablespace here, we ignore the we do not know the expected tablespace here, we ignore the
field for all data files, except for field for all data files, except for
@ -4209,7 +4206,45 @@ buf_wait_for_read(
} }
} }
/** This is the general function used to get access to a database page. /** Lock the page with the given latch type.
@param[in,out] block block to be locked
@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH
@param[in] mtr mini-transaction
@param[in] file file name
@param[in] line line where called
@return pointer to locked block */
static buf_block_t* buf_page_mtr_lock(buf_block_t *block,
ulint rw_latch,
mtr_t* mtr,
const char *file,
unsigned line)
{
mtr_memo_type_t fix_type;
switch (rw_latch)
{
case RW_NO_LATCH:
fix_type= MTR_MEMO_BUF_FIX;
break;
case RW_S_LATCH:
rw_lock_s_lock_inline(&block->lock, 0, file, line);
fix_type= MTR_MEMO_PAGE_S_FIX;
break;
case RW_SX_LATCH:
rw_lock_sx_lock_inline(&block->lock, 0, file, line);
fix_type= MTR_MEMO_PAGE_SX_FIX;
break;
default:
ut_ad(rw_latch == RW_X_LATCH);
rw_lock_x_lock_inline(&block->lock, 0, file, line);
fix_type= MTR_MEMO_PAGE_X_FIX;
break;
}
mtr_memo_push(mtr, block, fix_type);
return block;
}
/** This is the low level function used to get access to a database page.
@param[in] page_id page id @param[in] page_id page id
@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH @param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH
@ -4222,7 +4257,7 @@ BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH
@param[out] err DB_SUCCESS or error code @param[out] err DB_SUCCESS or error code
@return pointer to the block or NULL */ @return pointer to the block or NULL */
buf_block_t* buf_block_t*
buf_page_get_gen( buf_page_get_low(
const page_id_t page_id, const page_id_t page_id,
ulint zip_size, ulint zip_size,
ulint rw_latch, ulint rw_latch,
@ -4868,35 +4903,7 @@ evict_from_pool:
return NULL; return NULL;
} }
mtr_memo_type_t fix_type; fix_block = buf_page_mtr_lock(fix_block, rw_latch, mtr, file, line);
switch (rw_latch) {
case RW_NO_LATCH:
fix_type = MTR_MEMO_BUF_FIX;
break;
case RW_S_LATCH:
rw_lock_s_lock_inline(&fix_block->lock, 0, file, line);
fix_type = MTR_MEMO_PAGE_S_FIX;
break;
case RW_SX_LATCH:
rw_lock_sx_lock_inline(&fix_block->lock, 0, file, line);
fix_type = MTR_MEMO_PAGE_SX_FIX;
break;
default:
ut_ad(rw_latch == RW_X_LATCH);
rw_lock_x_lock_inline(&fix_block->lock, 0, file, line);
fix_type = MTR_MEMO_PAGE_X_FIX;
break;
}
mtr_memo_push(mtr, fix_block, fix_type);
if (mode != BUF_PEEK_IF_IN_POOL && !access_time) { if (mode != BUF_PEEK_IF_IN_POOL && !access_time) {
/* In the case of a first access, try to apply linear /* In the case of a first access, try to apply linear
@ -4911,6 +4918,43 @@ evict_from_pool:
return(fix_block); return(fix_block);
} }
/** This is the general function used to get access to a database page.
It does page initialization and applies the buffered redo logs.
@param[in] page_id page id
@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH
@param[in] guess guessed block or NULL
@param[in] mode BUF_GET, BUF_GET_IF_IN_POOL,
BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH
@param[in] file file name
@param[in] line line where called
@param[in] mtr mini-transaction
@param[out] err DB_SUCCESS or error code
@return pointer to the block or NULL */
buf_block_t*
buf_page_get_gen(
const page_id_t page_id,
ulint zip_size,
ulint rw_latch,
buf_block_t* guess,
ulint mode,
const char* file,
unsigned line,
mtr_t* mtr,
dberr_t* err)
{
if (buf_block_t *block= recv_recovery_create_page(page_id))
{
block->fix();
ut_ad(rw_lock_s_lock_nowait(block->debug_latch, file, line));
block= buf_page_mtr_lock(block, rw_latch, mtr, file, line);
return block;
}
return buf_page_get_low(page_id, zip_size, rw_latch,
guess, mode, file, line, mtr, err);
}
/********************************************************************//** /********************************************************************//**
This is the general function used to get optimistic access to a database This is the general function used to get optimistic access to a database
page. page.
@ -5927,7 +5971,8 @@ static dberr_t buf_page_check_corrupt(buf_page_t* bpage, fil_space_t* space)
/* If traditional checksums match, we assume that page is /* If traditional checksums match, we assume that page is
not anymore encrypted. */ not anymore encrypted. */
if (space->full_crc32() if (space->full_crc32()
&& !buf_page_is_zeroes(dst_frame, space->physical_size()) && !buf_is_zeroes(span<const byte>(dst_frame,
space->physical_size()))
&& (key_version || space->is_compressed() && (key_version || space->is_compressed()
|| space->purpose == FIL_TYPE_TEMPORARY)) { || space->purpose == FIL_TYPE_TEMPORARY)) {
if (buf_page_full_crc32_is_corrupted( if (buf_page_full_crc32_is_corrupted(

View File

@ -34,6 +34,8 @@ Created 2011/12/19
#include "fil0crypt.h" #include "fil0crypt.h"
#include "fil0pagecompress.h" #include "fil0pagecompress.h"
using st_::span;
/** The doublewrite buffer */ /** The doublewrite buffer */
buf_dblwr_t* buf_dblwr = NULL; buf_dblwr_t* buf_dblwr = NULL;
@ -577,7 +579,7 @@ buf_dblwr_process()
const ulint physical_size = space->physical_size(); const ulint physical_size = space->physical_size();
const ulint zip_size = space->zip_size(); const ulint zip_size = space->zip_size();
ut_ad(!buf_page_is_zeroes(page, physical_size)); ut_ad(!buf_is_zeroes(span<const byte>(page, physical_size)));
/* We want to ensure that for partial reads the /* We want to ensure that for partial reads the
unread portion of the page is NUL. */ unread portion of the page is NUL. */
@ -600,8 +602,8 @@ buf_dblwr_process()
<< "error: " << ut_strerr(err); << "error: " << ut_strerr(err);
} }
const bool is_all_zero = buf_page_is_zeroes( const bool is_all_zero = buf_is_zeroes(
read_buf, physical_size); span<const byte>(read_buf, physical_size));
const bool expect_encrypted = space->crypt_data const bool expect_encrypted = space->crypt_data
&& space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED; && space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED;
bool is_corrupted = false; bool is_corrupted = false;

View File

@ -198,9 +198,6 @@ static char* innodb_large_prefix;
stopword table to be used */ stopword table to be used */
static char* innobase_server_stopword_table; static char* innobase_server_stopword_table;
/* Below we have boolean-valued start-up parameters, and their default
values */
static my_bool innobase_use_atomic_writes; static my_bool innobase_use_atomic_writes;
static my_bool innobase_use_checksums; static my_bool innobase_use_checksums;
static my_bool innobase_locks_unsafe_for_binlog; static my_bool innobase_locks_unsafe_for_binlog;
@ -224,6 +221,9 @@ my_bool innodb_evict_tables_on_commit_debug;
extern my_bool srv_scrub_force_testing; extern my_bool srv_scrub_force_testing;
#endif #endif
/** File format constraint for ALTER TABLE */
ulong innodb_instant_alter_column_allowed;
/** Note we cannot use rec_format_enum because we do not allow /** Note we cannot use rec_format_enum because we do not allow
COMPRESSED row format for innodb_default_row_format option. */ COMPRESSED row format for innodb_default_row_format option. */
enum default_row_format_enum { enum default_row_format_enum {
@ -457,6 +457,22 @@ static TYPELIB innodb_change_buffering_typelib = {
NULL NULL
}; };
/** Allowed values of innodb_instant_alter_column_allowed */
const char* innodb_instant_alter_column_allowed_names[] = {
"never", /* compatible with MariaDB 5.5 to 10.2 */
"add_last",/* allow instant ADD COLUMN ... LAST */
"add_drop_reorder", /* allow instant ADD anywhere & DROP & reorder */
NullS
};
/** Enumeration of innodb_instant_alter_column_allowed */
static TYPELIB innodb_instant_alter_column_allowed_typelib = {
array_elements(innodb_instant_alter_column_allowed_names) - 1,
"innodb_instant_alter_column_allowed_typelib",
innodb_instant_alter_column_allowed_names,
NULL
};
/** Retrieve the FTS Relevance Ranking result for doc with doc_id /** Retrieve the FTS Relevance Ranking result for doc with doc_id
of m_prebuilt->fts_doc_id of m_prebuilt->fts_doc_id
@param[in,out] fts_hdl FTS handler @param[in,out] fts_hdl FTS handler
@ -18899,6 +18915,12 @@ static MYSQL_SYSVAR_BOOL(stats_include_delete_marked,
"Include delete marked records when calculating persistent statistics", "Include delete marked records when calculating persistent statistics",
NULL, NULL, FALSE); NULL, NULL, FALSE);
static MYSQL_SYSVAR_ENUM(instant_alter_column_allowed,
innodb_instant_alter_column_allowed,
PLUGIN_VAR_RQCMDARG,
"File format constraint for ALTER TABLE", NULL, NULL, 2/*add_drop_reorder*/,
&innodb_instant_alter_column_allowed_typelib);
static MYSQL_SYSVAR_ULONG(io_capacity, srv_io_capacity, static MYSQL_SYSVAR_ULONG(io_capacity, srv_io_capacity,
PLUGIN_VAR_RQCMDARG, PLUGIN_VAR_RQCMDARG,
"Number of IOPs the server can do. Tunes the background IO rate", "Number of IOPs the server can do. Tunes the background IO rate",
@ -19015,6 +19037,7 @@ static MYSQL_SYSVAR_ENUM(flush_method, innodb_flush_method,
static MYSQL_SYSVAR_STR(file_format, innodb_file_format, static MYSQL_SYSVAR_STR(file_format, innodb_file_format,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Deprecated parameter with no effect.", NULL, NULL, NULL); "Deprecated parameter with no effect.", NULL, NULL, NULL);
static MYSQL_SYSVAR_STR(large_prefix, innodb_large_prefix, static MYSQL_SYSVAR_STR(large_prefix, innodb_large_prefix,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Deprecated parameter with no effect.", NULL, NULL, NULL); "Deprecated parameter with no effect.", NULL, NULL, NULL);
@ -20181,6 +20204,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(random_read_ahead), MYSQL_SYSVAR(random_read_ahead),
MYSQL_SYSVAR(read_ahead_threshold), MYSQL_SYSVAR(read_ahead_threshold),
MYSQL_SYSVAR(read_only), MYSQL_SYSVAR(read_only),
MYSQL_SYSVAR(instant_alter_column_allowed),
MYSQL_SYSVAR(io_capacity), MYSQL_SYSVAR(io_capacity),
MYSQL_SYSVAR(io_capacity_max), MYSQL_SYSVAR(io_capacity_max),
MYSQL_SYSVAR(page_cleaners), MYSQL_SYSVAR(page_cleaners),

View File

@ -59,6 +59,8 @@ Smart ALTER TABLE
#include "span.h" #include "span.h"
using st_::span; using st_::span;
/** File format constraint for ALTER TABLE */
extern ulong innodb_instant_alter_column_allowed;
static const char *MSG_UNSUPPORTED_ALTER_ONLINE_ON_VIRTUAL_COLUMN= static const char *MSG_UNSUPPORTED_ALTER_ONLINE_ON_VIRTUAL_COLUMN=
"INPLACE ADD or DROP of virtual columns cannot be " "INPLACE ADD or DROP of virtual columns cannot be "
@ -1998,6 +2000,37 @@ ha_innobase::check_if_supported_inplace_alter(
const char* reason_rebuild = NULL; const char* reason_rebuild = NULL;
switch (innodb_instant_alter_column_allowed) {
case 0: /* never */
if ((ha_alter_info->handler_flags
& (ALTER_ADD_STORED_BASE_COLUMN
| ALTER_STORED_COLUMN_ORDER
| ALTER_DROP_STORED_COLUMN))
|| m_prebuilt->table->is_instant()) {
reason_rebuild =
"innodb_instant_alter_column_allowed=never";
innodb_instant_alter_column_allowed_reason:
if (ha_alter_info->handler_flags
& ALTER_RECREATE_TABLE) {
reason_rebuild = NULL;
} else {
ha_alter_info->handler_flags
|= ALTER_RECREATE_TABLE;
ha_alter_info->unsupported_reason
= reason_rebuild;
}
}
break;
case 1: /* add_last */
if ((ha_alter_info->handler_flags
& (ALTER_STORED_COLUMN_ORDER | ALTER_DROP_STORED_COLUMN))
|| m_prebuilt->table->instant) {
reason_rebuild = "innodb_instant_atler_column_allowed="
"add_last";
goto innodb_instant_alter_column_allowed_reason;
}
}
switch (ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE) { switch (ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE) {
case ALTER_OPTIONS: case ALTER_OPTIONS:
if (alter_options_need_rebuild(ha_alter_info, table)) { if (alter_options_need_rebuild(ha_alter_info, table)) {
@ -2488,6 +2521,7 @@ cannot_create_many_fulltext_index:
} }
if (need_rebuild || fts_need_rebuild) { if (need_rebuild || fts_need_rebuild) {
ha_alter_info->handler_flags |= ALTER_RECREATE_TABLE;
DBUG_RETURN(online DBUG_RETURN(online
? HA_ALTER_INPLACE_COPY_NO_LOCK ? HA_ALTER_INPLACE_COPY_NO_LOCK
: HA_ALTER_INPLACE_COPY_LOCK); : HA_ALTER_INPLACE_COPY_LOCK);

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, 2019, MariaDB Corporation. Copyright (c) 2016, 2020, 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
@ -28,6 +28,8 @@ Created 7/19/1997 Heikki Tuuri
#include "sync0sync.h" #include "sync0sync.h"
#include "btr0sea.h" #include "btr0sea.h"
using st_::span;
#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
my_bool srv_ibuf_disable_background_merge; my_bool srv_ibuf_disable_background_merge;
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
@ -4896,7 +4898,8 @@ dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space)
bitmap_page = ibuf_bitmap_get_map_page( bitmap_page = ibuf_bitmap_get_map_page(
page_id_t(space->id, page_no), zip_size, &mtr); page_id_t(space->id, page_no), zip_size, &mtr);
if (buf_page_is_zeroes(bitmap_page, physical_size)) { if (buf_is_zeroes(span<const byte>(bitmap_page,
physical_size))) {
/* This means we got all-zero page instead of /* This means we got all-zero page instead of
ibuf bitmap page. The subsequent page should be ibuf bitmap page. The subsequent page should be
all-zero pages. */ all-zero pages. */
@ -4908,7 +4911,9 @@ dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space)
page_id_t(space->id, curr_page), page_id_t(space->id, curr_page),
zip_size, RW_S_LATCH, &mtr); zip_size, RW_S_LATCH, &mtr);
page_t* page = buf_block_get_frame(block); page_t* page = buf_block_get_frame(block);
ut_ad(buf_page_is_zeroes(page, physical_size)); ut_ad(buf_is_zeroes(span<const byte>(
page,
physical_size)));
} }
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
ibuf_exit(&mtr); ibuf_exit(&mtr);

View File

@ -56,10 +56,4 @@ in the index record. */
#define BTR_EXTERN_LOCAL_STORED_MAX_SIZE \ #define BTR_EXTERN_LOCAL_STORED_MAX_SIZE \
(BTR_EXTERN_FIELD_REF_SIZE * 2) (BTR_EXTERN_FIELD_REF_SIZE * 2)
/** A field reference full of zero, for use in assertions and checks,
and dummy default values of instantly dropped columns.
Initially, BLOB field references are set to zero, in
dtuple_convert_big_rec(). */
extern const byte field_ref_zero[UNIV_PAGE_SIZE_MAX];
#endif #endif

View File

@ -33,6 +33,7 @@ Created 11/5/1995 Heikki Tuuri
#include "fil0fil.h" #include "fil0fil.h"
#include "mtr0types.h" #include "mtr0types.h"
#include "buf0types.h" #include "buf0types.h"
#include "span.h"
#ifndef UNIV_INNOCHECKSUM #ifndef UNIV_INNOCHECKSUM
#include "hash0hash.h" #include "hash0hash.h"
#include "ut0byte.h" #include "ut0byte.h"
@ -431,6 +432,7 @@ the same set of mutexes or latches.
buf_page_t* buf_page_get_zip(const page_id_t page_id, ulint zip_size); buf_page_t* buf_page_get_zip(const page_id_t page_id, ulint zip_size);
/** This is the general function used to get access to a database page. /** This is the general function used to get access to a database page.
It does page initialization and applies the buffered redo logs.
@param[in] page_id page id @param[in] page_id page id
@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH @param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH
@ -454,6 +456,30 @@ buf_page_get_gen(
mtr_t* mtr, mtr_t* mtr,
dberr_t* err); dberr_t* err);
/** Low level function used to get access to a database page.
@param[in] page_id page id
@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH
@param[in] guess guessed block or NULL
@param[in] mode BUF_GET, BUF_GET_IF_IN_POOL,
BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH
@param[in] file file name
@param[in] line line where called
@param[in] mtr mini-transaction
@param[out] err DB_SUCCESS or error code
@return pointer to the block or NULL */
buf_block_t*
buf_page_get_low(
const page_id_t page_id,
ulint zip_size,
ulint rw_latch,
buf_block_t* guess,
ulint mode,
const char* file,
unsigned line,
mtr_t* mtr,
dberr_t* err);
/** Initialize a page in the buffer pool. The page is usually not read /** Initialize a page in the buffer pool. The page is usually not read
from a file even if it cannot be found in the buffer buf_pool. This is one from a file even if it cannot be found in the buffer buf_pool. This is one
of the functions which perform to a block a state transition NOT_USED => of the functions which perform to a block a state transition NOT_USED =>
@ -616,11 +642,10 @@ buf_block_buf_fix_inc_func(
# endif /* UNIV_DEBUG */ # endif /* UNIV_DEBUG */
#endif /* !UNIV_INNOCHECKSUM */ #endif /* !UNIV_INNOCHECKSUM */
/** Check if a page is all zeroes. /** Check if a buffer is all zeroes.
@param[in] read_buf database page @param[in] buf data to check
@param[in] page_size page frame size @return whether the buffer is all zeroes */
@return whether the page is all zeroes */ bool buf_is_zeroes(st_::span<const byte> buf);
bool buf_page_is_zeroes(const void* read_buf, size_t page_size);
/** Checks if the page is in crc32 checksum format. /** Checks if the page is in crc32 checksum format.
@param[in] read_buf database page @param[in] read_buf database page

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved. Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2019, MariaDB Corporation. Copyright (c) 2019, 2020, 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
@ -211,6 +211,12 @@ private:
const page_id_t page_id); const page_id_t page_id);
}; };
/** A field reference full of zero, for use in assertions and checks,
and dummy default values of instantly dropped columns.
Initially, BLOB field references are set to zero, in
dtuple_convert_big_rec(). */
extern const byte field_ref_zero[UNIV_PAGE_SIZE_MAX];
#ifndef UNIV_INNOCHECKSUM #ifndef UNIV_INNOCHECKSUM
#include "ut0mutex.h" #include "ut0mutex.h"

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, 2019, MariaDB Corporation. Copyright (c) 2017, 2019, 2020 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
@ -32,6 +32,7 @@ Created 5/30/1994 Heikki Tuuri
#include "mem0mem.h" #include "mem0mem.h"
#include "dict0types.h" #include "dict0types.h"
#include "btr0types.h" #include "btr0types.h"
#include <vector>
#include <ostream> #include <ostream>
@ -526,9 +527,6 @@ struct dtuple_t {
dfield_t* fields; /*!< fields */ dfield_t* fields; /*!< fields */
ulint n_v_fields; /*!< number of virtual fields */ ulint n_v_fields; /*!< number of virtual fields */
dfield_t* v_fields; /*!< fields on virtual column */ dfield_t* v_fields; /*!< fields on virtual column */
UT_LIST_NODE_T(dtuple_t) tuple_list;
/*!< data tuples can be linked into a
list using this field */
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
ulint magic_n; /*!< magic number, used in ulint magic_n; /*!< magic number, used in
debug assertions */ debug assertions */

View File

@ -971,7 +971,7 @@ public:
/** Return the next fil_space_t from key rotation list. /** Return the next fil_space_t from key rotation list.
Once started, the caller must keep calling this until it returns NULL. Once started, the caller must keep calling this until it returns NULL.
fil_space_acquire() and fil_space_release() are invoked here which fil_space_acquire() and fil_space_t::release() are invoked here, which
blocks a concurrent operation from dropping the tablespace. blocks a concurrent operation from dropping the tablespace.
@param[in] prev_space Previous tablespace or NULL to start @param[in] prev_space Previous tablespace or NULL to start
from beginning of fil_system->rotation from beginning of fil_system->rotation

View File

@ -336,4 +336,22 @@ times! */
roll-forward */ roll-forward */
#define RECV_SCAN_SIZE (4U << srv_page_size_shift) #define RECV_SCAN_SIZE (4U << srv_page_size_shift)
/** This is a low level function for the recovery system
to create a page which has buffered intialized redo log records.
@param[in] page_id page to be created using redo logs
@return whether the page creation successfully */
buf_block_t* recv_recovery_create_page_low(const page_id_t page_id);
/** Recovery system creates a page which has buffered intialized
redo log records.
@param[in] page_id page to be created using redo logs
@return block which contains page was initialized */
inline buf_block_t* recv_recovery_create_page(const page_id_t page_id)
{
if (UNIV_LIKELY(!recv_recovery_on))
return NULL;
return recv_recovery_create_page_low(page_id);
}
#endif #endif

View File

@ -497,7 +497,7 @@ page_zip_calc_checksum(
@param data ROW_FORMAT=COMPRESSED page @param data ROW_FORMAT=COMPRESSED page
@param size size of the page, in bytes @param size size of the page, in bytes
@return whether the stored checksum matches innodb_checksum_algorithm */ @return whether the stored checksum matches innodb_checksum_algorithm */
bool page_zip_verify_checksum(const void *data, size_t size); bool page_zip_verify_checksum(const byte *data, size_t size);
#ifndef UNIV_INNOCHECKSUM #ifndef UNIV_INNOCHECKSUM
/**********************************************************************//** /**********************************************************************//**

View File

@ -1,7 +1,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) 2017, 2019, MariaDB Corporation. Copyright (c) 2017, 2020, 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
@ -31,6 +31,7 @@ Created 4/20/1996 Heikki Tuuri
#include "que0types.h" #include "que0types.h"
#include "trx0types.h" #include "trx0types.h"
#include "row0types.h" #include "row0types.h"
#include <vector>
/***************************************************************//** /***************************************************************//**
Checks if foreign key constraint fails for an index entry. Sets shared locks Checks if foreign key constraint fails for an index entry. Sets shared locks
@ -52,15 +53,7 @@ row_ins_check_foreign_constraint(
dtuple_t* entry, /*!< in: index entry for index */ dtuple_t* entry, /*!< in: index entry for index */
que_thr_t* thr) /*!< in: query thread */ que_thr_t* thr) /*!< in: query thread */
MY_ATTRIBUTE((nonnull, warn_unused_result)); MY_ATTRIBUTE((nonnull, warn_unused_result));
/*********************************************************************//**
Creates an insert node struct.
@return own: insert node struct */
ins_node_t*
ins_node_create(
/*============*/
ulint ins_type, /*!< in: INS_VALUES, ... */
dict_table_t* table, /*!< in: table where to insert */
mem_heap_t* heap); /*!< in: mem heap where created */
/*********************************************************************//** /*********************************************************************//**
Sets a new row to insert for an INS_DIRECT node. This function is only used Sets a new row to insert for an INS_DIRECT node. This function is only used
if we have constructed the row separately, which is a rare case; this if we have constructed the row separately, which is a rare case; this
@ -158,10 +151,31 @@ row_ins_step(
/*=========*/ /*=========*/
que_thr_t* thr); /*!< in: query thread */ que_thr_t* thr); /*!< in: query thread */
/* Insert node structure */ /* Insert node types */
#define INS_SEARCHED 0 /* INSERT INTO ... SELECT ... */
#define INS_VALUES 1 /* INSERT INTO ... VALUES ... */
#define INS_DIRECT 2 /* this is for internal use in dict0crea:
insert the row directly */
struct ins_node_t{ /* Node execution states */
que_common_t common; /*!< node type: QUE_NODE_INSERT */ #define INS_NODE_SET_IX_LOCK 1 /* we should set an IX lock on table */
#define INS_NODE_ALLOC_ROW_ID 2 /* row id should be allocated */
#define INS_NODE_INSERT_ENTRIES 3 /* index entries should be built and
inserted */
/** Insert node structure */
struct ins_node_t
{
explicit ins_node_t(ulint ins_type, dict_table_t *table) :
common(QUE_NODE_INSERT, NULL),
ins_type(ins_type),
row(NULL), table(table), select(NULL), values_list(NULL),
state(INS_NODE_SET_IX_LOCK), index(NULL),
entry_list(), entry(entry_list.end()),
trx_id(0), entry_sys_heap(mem_heap_create(128))
{
}
que_common_t common; /*!< node type: QUE_NODE_INSERT */
ulint ins_type;/* INS_VALUES, INS_SEARCHED, or INS_DIRECT */ ulint ins_type;/* INS_VALUES, INS_SEARCHED, or INS_DIRECT */
dtuple_t* row; /*!< row to insert */ dtuple_t* row; /*!< row to insert */
dict_table_t* table; /*!< table where to insert */ dict_table_t* table; /*!< table where to insert */
@ -171,11 +185,12 @@ struct ins_node_t{
ulint state; /*!< node execution state */ ulint state; /*!< node execution state */
dict_index_t* index; /*!< NULL, or the next index where the index dict_index_t* index; /*!< NULL, or the next index where the index
entry should be inserted */ entry should be inserted */
dtuple_t* entry; /*!< NULL, or entry to insert in the index; std::vector<dtuple_t*>
entry_list;/* list of entries, one for each index */
std::vector<dtuple_t*>::iterator
entry; /*!< NULL, or entry to insert in the index;
after a successful insert of the entry, after a successful insert of the entry,
this should be reset to NULL */ this should be reset to NULL */
UT_LIST_BASE_NODE_T(dtuple_t)
entry_list;/* list of entries, one for each index */
/** buffer for the system columns */ /** buffer for the system columns */
byte sys_buf[DATA_ROW_ID_LEN byte sys_buf[DATA_ROW_ID_LEN
+ DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN]; + DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN];
@ -188,20 +203,18 @@ struct ins_node_t{
entry_list and sys fields are stored here; entry_list and sys fields are stored here;
if this is NULL, entry list should be created if this is NULL, entry list should be created
and buffers for sys fields in row allocated */ and buffers for sys fields in row allocated */
ulint magic_n;
}; };
#define INS_NODE_MAGIC_N 15849075 /** Create an insert object.
@param ins_type INS_VALUES, ...
@param table table where to insert
@param heap memory heap
@return the created object */
inline ins_node_t *ins_node_create(ulint ins_type, dict_table_t *table,
mem_heap_t *heap)
{
return new (mem_heap_alloc(heap, sizeof(ins_node_t)))
ins_node_t(ins_type, table);
}
/* Insert node types */
#define INS_SEARCHED 0 /* INSERT INTO ... SELECT ... */
#define INS_VALUES 1 /* INSERT INTO ... VALUES ... */
#define INS_DIRECT 2 /* this is for internal use in dict0crea:
insert the row directly */
/* Node execution states */
#define INS_NODE_SET_IX_LOCK 1 /* we should set an IX lock on table */
#define INS_NODE_ALLOC_ROW_ID 2 /* row id should be allocated */
#define INS_NODE_INSERT_ENTRIES 3 /* index entries should be built and
inserted */
#endif #endif

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2018, MariaDB Corporation. Copyright (c) 2018, 2020, 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
@ -24,8 +24,8 @@ Row operation global types
Created 12/27/1996 Heikki Tuuri Created 12/27/1996 Heikki Tuuri
*******************************************************/ *******************************************************/
#ifndef row0types_h #pragma once
#define row0types_h #include "buf0types.h"
struct plan_t; struct plan_t;
@ -146,5 +146,3 @@ public:
return first_use; return first_use;
} }
}; };
#endif

View File

@ -1,145 +0,0 @@
/*****************************************************************************
Copyright (c) 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
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
*****************************************************************************/
#pragma once
#include <cstddef>
#include <iterator>
namespace st_ {
template <class ElementType> class span {
public:
typedef ElementType element_type;
typedef ElementType value_type;
typedef size_t index_type;
typedef ptrdiff_t difference_type;
typedef element_type* pointer;
typedef const element_type* const_pointer;
typedef element_type& reference;
typedef const element_type& const_reference;
typedef pointer iterator;
typedef const pointer const_iterator;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
span() : data_(NULL), size_(0) {}
span(pointer ptr, index_type count) : data_(ptr), size_(count) {}
span(pointer first, pointer last) : data_(first), size_(last - first) {}
template <size_t N> span(element_type (&arr)[N]) : data_(arr), size_(N)
{
}
template <class Container>
span(Container& cont) : data_(cont.begin()), size_(cont.size())
{
}
template <class Container>
span(const Container& cont) : data_(cont.begin()), size_(cont.size())
{
}
span(const span& other) : data_(other.data_), size_(other.size_) {}
~span(){};
span& operator=(const span& other)
{
data_ = other.data_;
size_ = other.size_;
return *this;
}
template <size_t Count> span<element_type> first() const
{
assert(!empty());
return span(data_, 1);
}
template <size_t Count> span<element_type> last() const
{
assert(!empty());
return span(data_ + size() - 1, 1);
}
span<element_type> first(index_type count) const
{
assert(!empty());
return span(data_, 1);
}
span<element_type> last(index_type count) const
{
assert(!empty());
return span(data_ + size() - 1, 1);
}
span<element_type> subspan(index_type offset, index_type count) const
{
assert(!empty());
assert(size() >= offset + count);
return span(data_ + offset, count);
}
index_type size() const { return size_; }
index_type size_bytes() const { return size_ * sizeof(ElementType); }
bool empty() const __attribute__((warn_unused_result))
{
return size_ == 0;
}
reference operator[](index_type idx) const
{
assert(size() > idx);
return data_[idx];
}
reference front() const
{
assert(!empty());
return data_[0];
}
reference back() const
{
assert(!empty());
return data_[size() - 1];
}
pointer data() const
{
assert(!empty());
return data_;
}
iterator begin() const { return data_; }
iterator end() const { return data_ + size_; }
reverse_iterator rbegin() const
{
return std::reverse_iterator<iterator>(std::advance(end(), -1));
}
reverse_iterator rend() const
{
return std::reverse_iterator<iterator>(
std::advance(begin(), -1));
}
private:
pointer data_;
index_type size_;
};
} // namespace st_

View File

@ -308,7 +308,7 @@ public:
if (!i.second.created) { if (!i.second.created) {
continue; continue;
} }
if (buf_block_t* block = buf_page_get_gen( if (buf_block_t* block = buf_page_get_low(
i.first, 0, RW_X_LATCH, NULL, i.first, 0, RW_X_LATCH, NULL,
BUF_GET_IF_IN_POOL, __FILE__, __LINE__, BUF_GET_IF_IN_POOL, __FILE__, __LINE__,
&mtr, NULL)) { &mtr, NULL)) {
@ -2177,6 +2177,96 @@ static void recv_read_in_area(const page_id_t page_id)
mutex_enter(&recv_sys.mutex); mutex_enter(&recv_sys.mutex);
} }
/** This is another low level function for the recovery system
to create a page which has buffered page intialization redo log records.
@param[in] page_id page to be created using redo logs
@param[in,out] recv_addr Hashed redo logs for the given page id
@return whether the page creation successfully */
static buf_block_t* recv_recovery_create_page_low(const page_id_t page_id,
recv_addr_t* recv_addr)
{
mtr_t mtr;
mlog_init_t::init &i= mlog_init.last(page_id);
const lsn_t end_lsn= UT_LIST_GET_LAST(recv_addr->rec_list)->end_lsn;
if (end_lsn < i.lsn)
{
DBUG_LOG("ib_log", "skip log for page "
<< page_id
<< " LSN " << end_lsn
<< " < " << i.lsn);
recv_addr->state= RECV_PROCESSED;
ignore:
ut_a(recv_sys.n_addrs);
recv_sys.n_addrs--;
return NULL;
}
fil_space_t *space= fil_space_acquire_for_io(recv_addr->space);
if (!space)
{
recv_addr->state= RECV_PROCESSED;
goto ignore;
}
if (space->enable_lsn)
{
init_fail:
space->release_for_io();
recv_addr->state= RECV_NOT_PROCESSED;
return NULL;
}
/* Determine if a tablespace could be for an internal table
for FULLTEXT INDEX. For those tables, no MLOG_INDEX_LOAD record
used to be written when redo logging was disabled. Hence, we
cannot optimize away page reads, because all the redo
log records for initializing and modifying the page in the
past could be older than the page in the data file.
The check is too broad, causing all
tables whose names start with FTS_ to skip the optimization. */
if (strstr(space->name, "/FTS_"))
goto init_fail;
mtr.start();
mtr.set_log_mode(MTR_LOG_NONE);
buf_block_t *block= buf_page_create(page_id, space->zip_size(), &mtr);
if (recv_addr->state == RECV_PROCESSED)
/* The page happened to exist in the buffer pool, or it was
just being read in. Before buf_page_get_with_no_latch() returned,
all changes must have been applied to the page already. */
mtr.commit();
else
{
i.created= true;
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
mtr.x_latch_at_savepoint(0, block);
recv_recover_page(block, mtr, recv_addr, &i);
ut_ad(mtr.has_committed());
}
space->release_for_io();
return block;
}
/** This is a low level function for the recovery system
to create a page which has buffered intialized redo log records.
@param[in] page_id page to be created using redo logs
@return whether the page creation successfully */
buf_block_t* recv_recovery_create_page_low(const page_id_t page_id)
{
buf_block_t* block= nullptr;
mutex_enter(&recv_sys.mutex);
recv_addr_t* recv_addr= recv_get_fil_addr_struct(page_id.space(),
page_id.page_no());
if (recv_addr && recv_addr->state == RECV_WILL_NOT_READ)
block= recv_recovery_create_page_low(page_id, recv_addr);
mutex_exit(&recv_sys.mutex);
return block;
}
/** Apply the hash table of stored log records to persistent data pages. /** Apply the hash table of stored log records to persistent data pages.
@param[in] last_batch whether the change buffer merge will be @param[in] last_batch whether the change buffer merge will be
performed as part of the operation */ performed as part of the operation */
@ -2272,7 +2362,7 @@ ignore:
apply: apply:
mtr.start(); mtr.start();
mtr.set_log_mode(MTR_LOG_NONE); mtr.set_log_mode(MTR_LOG_NONE);
if (buf_block_t* block = buf_page_get_gen( if (buf_block_t* block = buf_page_get_low(
page_id, 0, RW_X_LATCH, NULL, page_id, 0, RW_X_LATCH, NULL,
BUF_GET_IF_IN_POOL, BUF_GET_IF_IN_POOL,
__FILE__, __LINE__, &mtr, NULL)) { __FILE__, __LINE__, &mtr, NULL)) {
@ -2285,79 +2375,9 @@ apply:
mtr.commit(); mtr.commit();
recv_read_in_area(page_id); recv_read_in_area(page_id);
} }
} else { } else if (!recv_recovery_create_page_low(
mlog_init_t::init& i = mlog_init.last(page_id); page_id, recv_addr)) {
const lsn_t end_lsn = UT_LIST_GET_LAST( goto apply;
recv_addr->rec_list)->end_lsn;
if (end_lsn < i.lsn) {
DBUG_LOG("ib_log", "skip log for page "
<< page_id
<< " LSN " << end_lsn
<< " < " << i.lsn);
skip:
recv_addr->state = RECV_PROCESSED;
goto ignore;
}
fil_space_t* space = fil_space_acquire_for_io(
recv_addr->space);
if (!space) {
goto skip;
}
if (space->enable_lsn) {
do_read:
space->release_for_io();
recv_addr->state = RECV_NOT_PROCESSED;
goto apply;
}
/* Determine if a tablespace could be
for an internal table for FULLTEXT INDEX.
For those tables, no MLOG_INDEX_LOAD record
used to be written when redo logging was
disabled. Hence, we cannot optimize
away page reads when crash-upgrading
from MariaDB versions before 10.4,
because all the redo log records for
initializing and modifying the page in
the past could be older than the page
in the data file.
The check is too broad, causing all
tables whose names start with FTS_ to
skip the optimization. */
if ((log_sys.log.format
& ~log_t::FORMAT_ENCRYPTED)
!= log_t::FORMAT_10_4
&& strstr(space->name, "/FTS_")) {
goto do_read;
}
mtr.start();
mtr.set_log_mode(MTR_LOG_NONE);
buf_block_t* block = buf_page_create(
page_id, space->zip_size(), &mtr);
if (recv_addr->state == RECV_PROCESSED) {
/* The page happened to exist
in the buffer pool, or it was
just being read in. Before
buf_page_get_with_no_latch()
returned, all changes must have
been applied to the page already. */
mtr.commit();
} else {
i.created = true;
buf_block_dbg_add_level(
block, SYNC_NO_ORDER_CHECK);
mtr.x_latch_at_savepoint(0, block);
recv_recover_page(block, mtr,
recv_addr, &i);
ut_ad(mtr.has_committed());
}
space->release_for_io();
} }
} }
} }

View File

@ -31,14 +31,17 @@ Created June 2005 by Marko Makela
#include "buf0checksum.h" #include "buf0checksum.h"
#include "ut0crc32.h" #include "ut0crc32.h"
#include "zlib.h" #include "zlib.h"
#include "span.h"
#ifndef UNIV_INNOCHECKSUM using st_::span;
/** A BLOB field reference full of zero, for use in assertions and tests. /** A BLOB field reference full of zero, for use in assertions and tests.
Initially, BLOB field references are set to zero, in Initially, BLOB field references are set to zero, in
dtuple_convert_big_rec(). */ dtuple_convert_big_rec(). */
alignas(UNIV_PAGE_SIZE_MIN)
const byte field_ref_zero[UNIV_PAGE_SIZE_MAX] = { 0, }; const byte field_ref_zero[UNIV_PAGE_SIZE_MAX] = { 0, };
#ifndef UNIV_INNOCHECKSUM
#include "mtr0log.h" #include "mtr0log.h"
#include "dict0dict.h" #include "dict0dict.h"
#include "btr0cur.h" #include "btr0cur.h"
@ -4992,7 +4995,7 @@ page_zip_calc_checksum(
@param data ROW_FORMAT=COMPRESSED page @param data ROW_FORMAT=COMPRESSED page
@param size size of the page, in bytes @param size size of the page, in bytes
@return whether the stored checksum matches innodb_checksum_algorithm */ @return whether the stored checksum matches innodb_checksum_algorithm */
bool page_zip_verify_checksum(const void *data, size_t size) bool page_zip_verify_checksum(const byte *data, size_t size)
{ {
const srv_checksum_algorithm_t curr_algo = const srv_checksum_algorithm_t curr_algo =
static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm); static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
@ -5001,17 +5004,12 @@ bool page_zip_verify_checksum(const void *data, size_t size)
return true; return true;
} }
for (size_t i = 0; i < size; i++) { if (buf_is_zeroes(span<const byte>(data, size))) {
if (static_cast<const byte*>(data)[i] != 0) { return true;
goto not_all_zeroes;
}
} }
return true;
not_all_zeroes:
const uint32_t stored = mach_read_from_4( const uint32_t stored = mach_read_from_4(
static_cast<const byte*>(data) + FIL_PAGE_SPACE_OR_CHKSUM); data + FIL_PAGE_SPACE_OR_CHKSUM);
uint32_t calc = page_zip_calc_checksum(data, size, curr_algo); uint32_t calc = page_zip_calc_checksum(data, size, curr_algo);

View File

@ -1,7 +1,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) 2017, 2018, MariaDB Corporation. Copyright (c) 2017, 2018, 2020 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
@ -460,6 +460,8 @@ que_graph_free_recursive(
que_graph_free_recursive(ins->select); que_graph_free_recursive(ins->select);
ins->select = NULL; ins->select = NULL;
ins->~ins_node_t();
if (ins->entry_sys_heap != NULL) { if (ins->entry_sys_heap != NULL) {
mem_heap_free(ins->entry_sys_heap); mem_heap_free(ins->entry_sys_heap);
ins->entry_sys_heap = NULL; ins->entry_sys_heap = NULL;

View File

@ -50,6 +50,8 @@ Created 2012-02-08 by Sunny Bains.
#include <my_aes.h> #include <my_aes.h>
#endif #endif
using st_::span;
/** The size of the buffer to use for IO. /** The size of the buffer to use for IO.
@param n physical page size @param n physical page size
@return number of pages */ @return number of pages */
@ -3454,7 +3456,8 @@ fil_iterate(
byte* src = readptr + i * size; byte* src = readptr + i * size;
const ulint page_no = page_get_page_no(src); const ulint page_no = page_get_page_no(src);
if (!page_no && block->page.id.page_no()) { if (!page_no && block->page.id.page_no()) {
if (!buf_page_is_zeroes(src, size)) { if (!buf_is_zeroes(span<const byte>(src,
size))) {
goto page_corrupted; goto page_corrupted;
} }
/* Proceed to the next page, /* Proceed to the next page,

View File

@ -1,7 +1,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) 2016, 2018, MariaDB Corporation. Copyright (c) 2016, 2020, 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
@ -58,39 +58,6 @@ check.
If you make a change in this module make sure that no codepath is If you make a change in this module make sure that no codepath is
introduced where a call to log_free_check() is bypassed. */ introduced where a call to log_free_check() is bypassed. */
/*********************************************************************//**
Creates an insert node struct.
@return own: insert node struct */
ins_node_t*
ins_node_create(
/*============*/
ulint ins_type, /*!< in: INS_VALUES, ... */
dict_table_t* table, /*!< in: table where to insert */
mem_heap_t* heap) /*!< in: mem heap where created */
{
ins_node_t* node;
node = static_cast<ins_node_t*>(
mem_heap_zalloc(heap, sizeof(ins_node_t)));
if (!node) {
return(NULL);
}
node->common.type = QUE_NODE_INSERT;
node->ins_type = ins_type;
node->state = INS_NODE_SET_IX_LOCK;
node->table = table;
node->entry_sys_heap = mem_heap_create(128);
node->magic_n = INS_NODE_MAGIC_N;
return(node);
}
/***********************************************************//** /***********************************************************//**
Creates an entry template for each index of a table. */ Creates an entry template for each index of a table. */
static static
@ -104,12 +71,12 @@ ins_node_create_entry_list(
ut_ad(node->entry_sys_heap); ut_ad(node->entry_sys_heap);
UT_LIST_INIT(node->entry_list, &dtuple_t::tuple_list);
/* We will include all indexes (include those corrupted /* We will include all indexes (include those corrupted
secondary indexes) in the entry list. Filteration of secondary indexes) in the entry list. Filtration of
these corrupted index will be done in row_ins() */ these corrupted index will be done in row_ins() */
node->entry_list.reserve(UT_LIST_GET_LEN(node->table->indexes));
for (index = dict_table_get_first_index(node->table); for (index = dict_table_get_first_index(node->table);
index != 0; index != 0;
index = dict_table_get_next_index(index)) { index = dict_table_get_next_index(index)) {
@ -118,7 +85,7 @@ ins_node_create_entry_list(
node->row, NULL, index, node->entry_sys_heap, node->row, NULL, index, node->entry_sys_heap,
ROW_BUILD_FOR_INSERT); ROW_BUILD_FOR_INSERT);
UT_LIST_ADD_LAST(node->entry_list, entry); node->entry_list.push_back(entry);
} }
} }
@ -186,7 +153,8 @@ ins_node_set_new_row(
{ {
node->state = INS_NODE_SET_IX_LOCK; node->state = INS_NODE_SET_IX_LOCK;
node->index = NULL; node->index = NULL;
node->entry = NULL; node->entry_list.clear();
node->entry = node->entry_list.end();
node->row = row; node->row = row;
@ -3516,16 +3484,16 @@ row_ins_index_entry_step(
ut_ad(dtuple_check_typed(node->row)); ut_ad(dtuple_check_typed(node->row));
err = row_ins_index_entry_set_vals(node->index, node->entry, err = row_ins_index_entry_set_vals(node->index, *node->entry,
node->row); node->row);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
DBUG_RETURN(err); DBUG_RETURN(err);
} }
ut_ad(dtuple_check_typed(node->entry)); ut_ad(dtuple_check_typed(*node->entry));
err = row_ins_index_entry(node->index, node->entry, thr); err = row_ins_index_entry(node->index, *node->entry, thr);
DEBUG_SYNC_C_IF_THD(thr_get_trx(thr)->mysql_thd, DEBUG_SYNC_C_IF_THD(thr_get_trx(thr)->mysql_thd,
"after_row_ins_index_entry_step"); "after_row_ins_index_entry_step");
@ -3643,7 +3611,8 @@ row_ins(
row_ins_alloc_row_id_step(node); row_ins_alloc_row_id_step(node);
node->index = dict_table_get_first_index(node->table); node->index = dict_table_get_first_index(node->table);
node->entry = UT_LIST_GET_FIRST(node->entry_list); ut_ad(node->entry_list.empty() == false);
node->entry = node->entry_list.begin();
if (node->ins_type == INS_SEARCHED) { if (node->ins_type == INS_SEARCHED) {
@ -3669,20 +3638,16 @@ row_ins(
} }
node->index = dict_table_get_next_index(node->index); node->index = dict_table_get_next_index(node->index);
node->entry = UT_LIST_GET_NEXT(tuple_list, node->entry); ++node->entry;
DBUG_EXECUTE_IF(
"row_ins_skip_sec",
node->index = NULL; node->entry = NULL; break;);
/* Skip corrupted secondary index and its entry */ /* Skip corrupted secondary index and its entry */
while (node->index && node->index->is_corrupted()) { while (node->index && node->index->is_corrupted()) {
node->index = dict_table_get_next_index(node->index); node->index = dict_table_get_next_index(node->index);
node->entry = UT_LIST_GET_NEXT(tuple_list, node->entry); ++node->entry;
} }
} }
ut_ad(node->entry == NULL); ut_ad(node->entry == node->entry_list.end());
node->state = INS_NODE_ALLOC_ROW_ID; node->state = INS_NODE_ALLOC_ROW_ID;
@ -3738,14 +3703,14 @@ row_ins_step(
DBUG_ASSERT(node->table->get_ref_count() > 0); DBUG_ASSERT(node->table->get_ref_count() > 0);
DBUG_ASSERT(node->ins_type == INS_DIRECT); DBUG_ASSERT(node->ins_type == INS_DIRECT);
/* No-rollback tables can consist only of a single index. */ /* No-rollback tables can consist only of a single index. */
DBUG_ASSERT(UT_LIST_GET_LEN(node->entry_list) == 1); DBUG_ASSERT(node->entry_list.size() == 1);
DBUG_ASSERT(UT_LIST_GET_LEN(node->table->indexes) == 1); DBUG_ASSERT(UT_LIST_GET_LEN(node->table->indexes) == 1);
/* There should be no possibility for interruption and /* There should be no possibility for interruption and
restarting here. In theory, we could allow resumption restarting here. In theory, we could allow resumption
from the INS_NODE_INSERT_ENTRIES state here. */ from the INS_NODE_INSERT_ENTRIES state here. */
DBUG_ASSERT(node->state == INS_NODE_SET_IX_LOCK); DBUG_ASSERT(node->state == INS_NODE_SET_IX_LOCK);
node->index = dict_table_get_first_index(node->table); node->index = dict_table_get_first_index(node->table);
node->entry = UT_LIST_GET_FIRST(node->entry_list); node->entry = node->entry_list.begin();
node->state = INS_NODE_INSERT_ENTRIES; node->state = INS_NODE_INSERT_ENTRIES;
goto do_insert; goto do_insert;
} }

View File

@ -1098,7 +1098,7 @@ row_get_prebuilt_insert_row(
may need to rebuild the row insert template. */ may need to rebuild the row insert template. */
if (prebuilt->trx_id == table->def_trx_id if (prebuilt->trx_id == table->def_trx_id
&& UT_LIST_GET_LEN(prebuilt->ins_node->entry_list) && prebuilt->ins_node->entry_list.size()
== UT_LIST_GET_LEN(table->indexes)) { == UT_LIST_GET_LEN(table->indexes)) {
return(prebuilt->ins_node->row); return(prebuilt->ins_node->row);

View File

@ -43,10 +43,8 @@ Created 3/26/1996 Heikki Tuuri
const dtuple_t trx_undo_metadata = { const dtuple_t trx_undo_metadata = {
/* This also works for REC_INFO_METADATA_ALTER, because the /* This also works for REC_INFO_METADATA_ALTER, because the
delete-mark (REC_INFO_DELETED_FLAG) is ignored when searching. */ delete-mark (REC_INFO_DELETED_FLAG) is ignored when searching. */
REC_INFO_METADATA_ADD, REC_INFO_METADATA_ADD, 0, 0,
0, 0, NULL, 0, NULL
NULL, 0, NULL,
UT_LIST_NODE_T(dtuple_t)()
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
, DATA_TUPLE_MAGIC_N , DATA_TUPLE_MAGIC_N
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */

View File

@ -60,10 +60,10 @@ if(BZIP2_FOUND AND (NOT WITH_ROCKSDB_BZIP2 STREQUAL "OFF"))
list(APPEND THIRDPARTY_LIBS ${BZIP2_LIBRARIES}) list(APPEND THIRDPARTY_LIBS ${BZIP2_LIBRARIES})
endif() endif()
if(SNAPPY_FOUND AND (NOT WITH_ROCKSDB_SNAPPY STREQUAL "OFF")) if(snappy_FOUND AND (NOT WITH_ROCKSDB_SNAPPY STREQUAL "OFF"))
add_definitions(-DSNAPPY) add_definitions(-DSNAPPY)
include_directories(${SNAPPY_INCLUDE_DIR}) include_directories(${snappy_INCLUDE_DIR})
list(APPEND THIRDPARTY_LIBS ${SNAPPY_LIBRARIES}) list(APPEND THIRDPARTY_LIBS ${snappy_LIBRARIES})
endif() endif()
include(CheckFunctionExists) include(CheckFunctionExists)
@ -189,31 +189,32 @@ set(ROCKSDB_SOURCES
cache/clock_cache.cc cache/clock_cache.cc
cache/lru_cache.cc cache/lru_cache.cc
cache/sharded_cache.cc cache/sharded_cache.cc
db/arena_wrapped_db_iter.cc
db/builder.cc db/builder.cc
db/c.cc db/c.cc
db/column_family.cc db/column_family.cc
db/compacted_db_impl.cc db/compacted_db_impl.cc
db/compaction/compaction.cc db/compaction/compaction.cc
db/compaction/compaction_iterator.cc db/compaction/compaction_iterator.cc
db/compaction/compaction_job.cc
db/compaction/compaction_picker.cc db/compaction/compaction_picker.cc
db/compaction/compaction_job.cc
db/compaction/compaction_picker_fifo.cc db/compaction/compaction_picker_fifo.cc
db/compaction/compaction_picker_level.cc db/compaction/compaction_picker_level.cc
db/compaction/compaction_picker_universal.cc db/compaction/compaction_picker_universal.cc
db/convenience.cc db/convenience.cc
db/db_filesnapshot.cc db/db_filesnapshot.cc
db/dbformat.cc
db/db_impl/db_impl.cc db/db_impl/db_impl.cc
db/db_impl/db_impl_write.cc
db/db_impl/db_impl_compaction_flush.cc db/db_impl/db_impl_compaction_flush.cc
db/db_impl/db_impl_debug.cc
db/db_impl/db_impl_experimental.cc
db/db_impl/db_impl_files.cc db/db_impl/db_impl_files.cc
db/db_impl/db_impl_open.cc db/db_impl/db_impl_open.cc
db/db_impl/db_impl_debug.cc
db/db_impl/db_impl_experimental.cc
db/db_impl/db_impl_readonly.cc db/db_impl/db_impl_readonly.cc
db/db_impl/db_impl_secondary.cc db/db_impl/db_impl_secondary.cc
db/db_impl/db_impl_write.cc
db/db_info_dumper.cc db/db_info_dumper.cc
db/db_iter.cc db/db_iter.cc
db/dbformat.cc
db/error_handler.cc db/error_handler.cc
db/event_helpers.cc db/event_helpers.cc
db/experimental.cc db/experimental.cc
@ -222,9 +223,10 @@ set(ROCKSDB_SOURCES
db/flush_job.cc db/flush_job.cc
db/flush_scheduler.cc db/flush_scheduler.cc
db/forward_iterator.cc db/forward_iterator.cc
db/import_column_family_job.cc
db/internal_stats.cc db/internal_stats.cc
db/log_reader.cc
db/logs_with_prep_tracker.cc db/logs_with_prep_tracker.cc
db/log_reader.cc
db/log_writer.cc db/log_writer.cc
db/malloc_stats.cc db/malloc_stats.cc
db/memtable.cc db/memtable.cc
@ -238,22 +240,31 @@ set(ROCKSDB_SOURCES
db/table_cache.cc db/table_cache.cc
db/table_properties_collector.cc db/table_properties_collector.cc
db/transaction_log_impl.cc db/transaction_log_impl.cc
db/trim_history_scheduler.cc
db/version_builder.cc db/version_builder.cc
db/version_edit.cc db/version_edit.cc
db/version_set.cc db/version_set.cc
db/wal_manager.cc db/wal_manager.cc
db/write_batch_base.cc
db/write_batch.cc db/write_batch.cc
db/write_batch_base.cc
db/write_controller.cc db/write_controller.cc
db/write_thread.cc db/write_thread.cc
env/env.cc env/env.cc
env/env_chroot.cc env/env_chroot.cc
env/env_encryption.cc
env/env_hdfs.cc env/env_hdfs.cc
env/file_system.cc
env/mock_env.cc env/mock_env.cc
file/delete_scheduler.cc file/delete_scheduler.cc
file/filename.cc file/file_prefetch_buffer.cc
file/file_util.cc file/file_util.cc
file/filename.cc
file/random_access_file_reader.cc
file/read_write_util.cc
file/readahead_raf.cc
file/sequence_file_reader.cc
file/sst_file_manager_impl.cc file/sst_file_manager_impl.cc
file/writable_file_writer.cc
logging/auto_roll_logger.cc logging/auto_roll_logger.cc
logging/event_logger.cc logging/event_logger.cc
logging/log_buffer.cc logging/log_buffer.cc
@ -268,8 +279,8 @@ set(ROCKSDB_SOURCES
memtable/write_buffer_manager.cc memtable/write_buffer_manager.cc
monitoring/histogram.cc monitoring/histogram.cc
monitoring/histogram_windowing.cc monitoring/histogram_windowing.cc
monitoring/instrumented_mutex.cc
monitoring/in_memory_stats_history.cc monitoring/in_memory_stats_history.cc
monitoring/instrumented_mutex.cc
monitoring/iostats_context.cc monitoring/iostats_context.cc
monitoring/perf_context.cc monitoring/perf_context.cc
monitoring/perf_level.cc monitoring/perf_level.cc
@ -277,7 +288,6 @@ set(ROCKSDB_SOURCES
monitoring/statistics.cc monitoring/statistics.cc
monitoring/thread_status_impl.cc monitoring/thread_status_impl.cc
monitoring/thread_status_updater.cc monitoring/thread_status_updater.cc
monitoring/thread_status_updater_debug.cc
monitoring/thread_status_util.cc monitoring/thread_status_util.cc
monitoring/thread_status_util_debug.cc monitoring/thread_status_util_debug.cc
options/cf_options.cc options/cf_options.cc
@ -288,21 +298,24 @@ set(ROCKSDB_SOURCES
options/options_sanity_check.cc options/options_sanity_check.cc
port/stack_trace.cc port/stack_trace.cc
table/adaptive/adaptive_table_factory.cc table/adaptive/adaptive_table_factory.cc
table/block_based/block.cc
table/block_based/block_based_filter_block.cc table/block_based/block_based_filter_block.cc
table/block_based/block_based_table_builder.cc table/block_based/block_based_table_builder.cc
table/block_based/block_based_table_factory.cc table/block_based/block_based_table_factory.cc
table/block_based/block_based_table_reader.cc table/block_based/block_based_table_reader.cc
table/block_based/block_builder.cc table/block_based/block_builder.cc
table/block_based/block.cc
table/block_based/block_prefix_index.cc table/block_based/block_prefix_index.cc
table/block_based/data_block_footer.cc
table/block_based/data_block_hash_index.cc table/block_based/data_block_hash_index.cc
table/block_based/data_block_footer.cc
table/block_based/filter_block_reader_common.cc
table/block_based/filter_policy.cc
table/block_based/flush_block_policy.cc table/block_based/flush_block_policy.cc
table/block_based/full_filter_block.cc table/block_based/full_filter_block.cc
table/block_based/index_builder.cc table/block_based/index_builder.cc
table/block_based/parsed_full_filter_block.cc
table/block_based/partitioned_filter_block.cc table/block_based/partitioned_filter_block.cc
table/block_based/uncompression_dict_reader.cc
table/block_fetcher.cc table/block_fetcher.cc
table/bloom_block.cc
table/cuckoo/cuckoo_table_builder.cc table/cuckoo/cuckoo_table_builder.cc
table/cuckoo/cuckoo_table_factory.cc table/cuckoo/cuckoo_table_factory.cc
table/cuckoo/cuckoo_table_reader.cc table/cuckoo/cuckoo_table_reader.cc
@ -312,6 +325,7 @@ set(ROCKSDB_SOURCES
table/merging_iterator.cc table/merging_iterator.cc
table/meta_blocks.cc table/meta_blocks.cc
table/persistent_cache_helper.cc table/persistent_cache_helper.cc
table/plain/plain_table_bloom.cc
table/plain/plain_table_builder.cc table/plain/plain_table_builder.cc
table/plain/plain_table_factory.cc table/plain/plain_table_factory.cc
table/plain/plain_table_index.cc table/plain/plain_table_index.cc
@ -323,23 +337,34 @@ set(ROCKSDB_SOURCES
table/two_level_iterator.cc table/two_level_iterator.cc
test_util/sync_point.cc test_util/sync_point.cc
test_util/sync_point_impl.cc test_util/sync_point_impl.cc
test_util/testutil.cc
test_util/transaction_test_util.cc
tools/block_cache_analyzer/block_cache_trace_analyzer.cc
tools/dump/db_dump_tool.cc
tools/ldb_cmd.cc tools/ldb_cmd.cc
tools/ldb_tool.cc tools/ldb_tool.cc
tools/sst_dump_tool.cc tools/sst_dump_tool.cc
trace_replay/block_cache_tracer.cc tools/trace_analyzer_tool.cc
trace_replay/trace_replay.cc trace_replay/trace_replay.cc
util/bloom.cc trace_replay/block_cache_tracer.cc
util/coding.cc util/coding.cc
util/compaction_job_stats_impl.cc util/compaction_job_stats_impl.cc
util/comparator.cc util/comparator.cc
util/compression_context_cache.cc util/compression_context_cache.cc
util/concurrent_task_limiter_impl.cc util/concurrent_task_limiter_impl.cc
util/crc32c_arm64.cc
util/crc32c.cc util/crc32c.cc
util/dynamic_bloom.cc util/dynamic_bloom.cc
util/file_reader_writer.cc
util/filter_policy.cc
util/hash.cc util/hash.cc
util/murmurhash.cc
util/random.cc
util/rate_limiter.cc
util/slice.cc
util/file_checksum_helper.cc
util/status.cc
util/string_util.cc
util/thread_local.cc
util/threadpool_imp.cc
util/xxhash.cc
utilities/backupable/backupable_db.cc utilities/backupable/backupable_db.cc
utilities/blob_db/blob_compaction_filter.cc utilities/blob_db/blob_compaction_filter.cc
utilities/blob_db/blob_db.cc utilities/blob_db/blob_db.cc
@ -347,12 +372,11 @@ set(ROCKSDB_SOURCES
utilities/blob_db/blob_db_impl_filesnapshot.cc utilities/blob_db/blob_db_impl_filesnapshot.cc
utilities/blob_db/blob_dump_tool.cc utilities/blob_db/blob_dump_tool.cc
utilities/blob_db/blob_file.cc utilities/blob_db/blob_file.cc
utilities/blob_db/blob_log_format.cc
utilities/blob_db/blob_log_reader.cc utilities/blob_db/blob_log_reader.cc
utilities/blob_db/blob_log_writer.cc utilities/blob_db/blob_log_writer.cc
utilities/blob_db/blob_log_format.cc
utilities/checkpoint/checkpoint_impl.cc utilities/checkpoint/checkpoint_impl.cc
utilities/compaction_filters/remove_emptyvalue_compactionfilter.cc utilities/compaction_filters/remove_emptyvalue_compactionfilter.cc
utilities/convenience/info_log_finder.cc
utilities/debug.cc utilities/debug.cc
utilities/env_mirror.cc utilities/env_mirror.cc
utilities/env_timed.cc utilities/env_timed.cc
@ -361,9 +385,11 @@ set(ROCKSDB_SOURCES
utilities/merge_operators/bytesxor.cc utilities/merge_operators/bytesxor.cc
utilities/merge_operators/max.cc utilities/merge_operators/max.cc
utilities/merge_operators/put.cc utilities/merge_operators/put.cc
utilities/merge_operators/string_append/stringappend2.cc utilities/merge_operators/sortlist.cc
utilities/merge_operators/string_append/stringappend.cc utilities/merge_operators/string_append/stringappend.cc
utilities/merge_operators/string_append/stringappend2.cc
utilities/merge_operators/uint64add.cc utilities/merge_operators/uint64add.cc
utilities/object_registry.cc
utilities/option_change_migration/option_change_migration.cc utilities/option_change_migration/option_change_migration.cc
utilities/options/options_util.cc utilities/options/options_util.cc
utilities/persistent_cache/block_cache_tier.cc utilities/persistent_cache/block_cache_tier.cc
@ -371,11 +397,12 @@ set(ROCKSDB_SOURCES
utilities/persistent_cache/block_cache_tier_metadata.cc utilities/persistent_cache/block_cache_tier_metadata.cc
utilities/persistent_cache/persistent_cache_tier.cc utilities/persistent_cache/persistent_cache_tier.cc
utilities/persistent_cache/volatile_tier_impl.cc utilities/persistent_cache/volatile_tier_impl.cc
utilities/simulator_cache/cache_simulator.cc
utilities/simulator_cache/sim_cache.cc utilities/simulator_cache/sim_cache.cc
utilities/table_properties_collectors/compact_on_deletion_collector.cc utilities/table_properties_collectors/compact_on_deletion_collector.cc
utilities/trace/file_trace_reader_writer.cc utilities/trace/file_trace_reader_writer.cc
utilities/transactions/optimistic_transaction.cc
utilities/transactions/optimistic_transaction_db_impl.cc utilities/transactions/optimistic_transaction_db_impl.cc
utilities/transactions/optimistic_transaction.cc
utilities/transactions/pessimistic_transaction.cc utilities/transactions/pessimistic_transaction.cc
utilities/transactions/pessimistic_transaction_db.cc utilities/transactions/pessimistic_transaction_db.cc
utilities/transactions/snapshot_checker.cc utilities/transactions/snapshot_checker.cc
@ -390,15 +417,6 @@ set(ROCKSDB_SOURCES
utilities/ttl/db_ttl_impl.cc utilities/ttl/db_ttl_impl.cc
utilities/write_batch_with_index/write_batch_with_index.cc utilities/write_batch_with_index/write_batch_with_index.cc
utilities/write_batch_with_index/write_batch_with_index_internal.cc utilities/write_batch_with_index/write_batch_with_index_internal.cc
util/murmurhash.cc
util/random.cc
util/rate_limiter.cc
util/slice.cc
util/status.cc
util/string_util.cc
util/thread_local.cc
util/threadpool_imp.cc
util/xxhash.cc
) )
@ -415,7 +433,8 @@ else()
list(APPEND ROCKSDB_SOURCES list(APPEND ROCKSDB_SOURCES
port/port_posix.cc port/port_posix.cc
env/env_posix.cc env/env_posix.cc
env/io_posix.cc) env/io_posix.cc
env/fs_posix.cc)
# ppc64 or ppc64le # ppc64 or ppc64le
if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64") if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
enable_language(ASM) enable_language(ASM)

View File

@ -510,7 +510,7 @@ void Rdb_sst_info::set_error_msg(const std::string &sst_file_name,
void Rdb_sst_info::report_error_msg(const rocksdb::Status &s, void Rdb_sst_info::report_error_msg(const rocksdb::Status &s,
const char *sst_file_name) { const char *sst_file_name) {
if (s.IsInvalidArgument() && if (s.IsInvalidArgument() &&
strcmp(s.getState(), "Keys must be added in order") == 0) { strcmp(s.getState(), "Keys must be added in strict ascending order.") == 0) {
my_printf_error(ER_KEYS_OUT_OF_ORDER, my_printf_error(ER_KEYS_OUT_OF_ORDER,
"Rows must be inserted in primary key order " "Rows must be inserted in primary key order "
"during bulk load operation", "during bulk load operation",

@ -1 +1 @@
Subproject commit e731f4402258554812c46334dc0d9483e6cc769b Subproject commit bba5e7bc21093d7cfa765e1280a7c4fdcd284288

View File

@ -23,7 +23,7 @@ Created 2012/04/12 by Sunny Bains
#include <string.h> #include <string.h>
/** CPU cache line size */ /** CPU cache line size */
#define CACHE_LINE_SIZE 64 #define UT_CACHE_LINE_SIZE 64
/** Default number of slots to use in ib_counter_t */ /** Default number of slots to use in ib_counter_t */
#define IB_N_SLOTS 64 #define IB_N_SLOTS 64
@ -43,7 +43,7 @@ struct generic_indexer_t {
/** @return offset within m_counter */ /** @return offset within m_counter */
size_t offset(size_t index) const { size_t offset(size_t index) const {
return(((index % N) + 1) * (CACHE_LINE_SIZE / sizeof(Type))); return(((index % N) + 1) * (UT_CACHE_LINE_SIZE / sizeof(Type)));
} }
}; };
@ -90,7 +90,7 @@ struct single_indexer_t {
/** @return offset within m_counter */ /** @return offset within m_counter */
size_t offset(size_t index) const { size_t offset(size_t index) const {
DBUG_ASSERT(N == 1); DBUG_ASSERT(N == 1);
return((CACHE_LINE_SIZE / sizeof(Type))); return((UT_CACHE_LINE_SIZE / sizeof(Type)));
} }
/* @return 1 */ /* @return 1 */
@ -103,7 +103,7 @@ struct single_indexer_t {
/** Class for using fuzzy counters. The counter is not protected by any /** Class for using fuzzy counters. The counter is not protected by any
mutex and the results are not guaranteed to be 100% accurate but close mutex and the results are not guaranteed to be 100% accurate but close
enough. Creates an array of counters and separates each element by the enough. Creates an array of counters and separates each element by the
CACHE_LINE_SIZE bytes */ UT_CACHE_LINE_SIZE bytes */
template < template <
typename Type, typename Type,
int N = IB_N_SLOTS, int N = IB_N_SLOTS,
@ -119,7 +119,7 @@ public:
bool validate() { bool validate() {
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
size_t n = (CACHE_LINE_SIZE / sizeof(Type)); size_t n = (UT_CACHE_LINE_SIZE / sizeof(Type));
/* Check that we aren't writing outside our defined bounds. */ /* Check that we aren't writing outside our defined bounds. */
for (size_t i = 0; i < UT_ARRAY_SIZE(m_counter); i += n) { for (size_t i = 0; i < UT_ARRAY_SIZE(m_counter); i += n) {
@ -197,7 +197,7 @@ private:
Indexer<Type, N>m_policy; Indexer<Type, N>m_policy;
/** Slot 0 is unused. */ /** Slot 0 is unused. */
Type m_counter[(N + 1) * (CACHE_LINE_SIZE / sizeof(Type))]; Type m_counter[(N + 1) * (UT_CACHE_LINE_SIZE / sizeof(Type))];
}; };
#endif /* UT0COUNTER_H */ #endif /* UT0COUNTER_H */

View File

@ -1,5 +1,5 @@
/* Copyright (C) 2008-2019 Kentoku Shiba /* Copyright (C) 2008-2019 Kentoku Shiba
Copyright (C) 2019 MariaDB corp Copyright (C) 2019, 2020, 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