Merge 10.2 into 10.3

This commit is contained in:
Marko Mäkelä 2020-07-31 13:51:28 +03:00
commit 66ec3a770f
73 changed files with 880 additions and 349 deletions

View File

@ -249,12 +249,6 @@ my_bool innobase_locks_unsafe_for_binlog;
my_bool innobase_rollback_on_timeout;
my_bool innobase_create_status_file;
/* The following counter is used to convey information to InnoDB
about server activity: in selects it is not sensible to call
srv_active_wake_master_thread after each fetch or search, we only do
it every INNOBASE_WAKE_INTERVAL'th step. */
#define INNOBASE_WAKE_INTERVAL 32
ulong innobase_active_counter = 0;
#ifndef _WIN32

View File

@ -341,3 +341,16 @@ RENAME TABLE t1 TO t2;
ERROR 42S02: Table 'test.t1' doesn't exist
DROP TABLE t1;
# End of 10.1 test
#
# MDEV-21258: Can't uninstall plugin if the library file doesn't exist
#
insert into mysql.plugin values ("unexisting_plugin", "soname");
select * from mysql.plugin WHERE name='unexisting_plugin';
name dl
unexisting_plugin soname
UNINSTALL PLUGIN unexisting_plugin;
select * from mysql.plugin WHERE name='unexisting_plugin';
name dl
UNINSTALL PLUGIN unexisting_plugin;
ERROR 42000: PLUGIN unexisting_plugin does not exist
# End of 10.2 tests

View File

@ -276,3 +276,23 @@ RENAME TABLE t1 TO t2;
DROP TABLE t1;
--echo # End of 10.1 test
--echo #
--echo # MDEV-21258: Can't uninstall plugin if the library file doesn't exist
--echo #
insert into mysql.plugin values ("unexisting_plugin", "soname");
# check that we have the plugin installed
select * from mysql.plugin WHERE name='unexisting_plugin';
# make attempt to uninstall the plugin
UNINSTALL PLUGIN unexisting_plugin;
# check that we have the plugin uninstalled
select * from mysql.plugin WHERE name='unexisting_plugin';
--error ER_SP_DOES_NOT_EXIST
UNINSTALL PLUGIN unexisting_plugin;
--echo # End of 10.2 tests

View File

@ -3843,6 +3843,13 @@ ROW_NUMBER() OVER w2
5
DROP TABLE t1;
#
# MDEV-18916: crash in Window_spec::print_partition() with decimals
#
SELECT cast((rank() over w1) as decimal (53,56));
ERROR 42000: Too big scale 56 specified for 'rank() over w1'. Maximum is 38
SELECT cast((rank() over w1) as decimal (53,30));
ERROR HY000: Window specification with name 'w1' is not defined
#
# End of 10.2 tests
#
#

View File

@ -2497,6 +2497,15 @@ SELECT a,b FROM t1 WINDOW w2 AS (PARTITION BY -1,1,0,2,3,4);
SELECT ROW_NUMBER() OVER w2 FROM t1 WINDOW w2 AS (PARTITION BY -1,0,1,2,3,4,5,6);
DROP TABLE t1;
--echo #
--echo # MDEV-18916: crash in Window_spec::print_partition() with decimals
--echo #
--error ER_TOO_BIG_SCALE
SELECT cast((rank() over w1) as decimal (53,56));
--error ER_WRONG_WINDOW_SPEC_NAME
SELECT cast((rank() over w1) as decimal (53,30));
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -433,3 +433,81 @@ ntile((select a from t1)) over (partition by b order by pk)
from t1;
ERROR 21000: Subquery returns more than 1 row
drop table t1;
#
# MDEV-9911 NTILE must return an error when parameter is not stable
#
create table t1 (
pk int primary key,
c1 nvarchar(10),
c2 nvarchar(10),
c3 int
);
insert into t1 values
(1, 'Mark', 'Male', 5),
(2, 'John', 'Male', 5),
(3, 'Pam', 'Female', 6),
(4, 'Sara', 'Female', 6),
(5, 'Todd', 'Male', 5),
(6, 'Mary', 'Female', 6),
(7, 'Ben', 'Male', 5),
(8, 'Jodi', 'Female', 6),
(9, 'Tom', 'Male', 5),
(10, 'Lucky', 'Male', 5),
(11, 'Mark', 'Male', 5),
(12, 'John', 'Male', 5),
(13, 'Pam', 'Female', 6),
(14, 'Sara', 'Female', 6),
(15, 'Todd', 'Male', 5),
(16, 'Mary', 'Female', 6),
(17, 'Ben', 'Male', 5),
(18, 'Jodi', 'Female', 6),
(19, 'Tom', 'Male', 5),
(20, 'Lucky', 'Male', 5);
select c1, c2, c3, ntile(6) over (partition by c2 order by pk) from t1;
c1 c2 c3 ntile(6) over (partition by c2 order by pk)
Pam Female 6 1
Sara Female 6 1
Mary Female 6 2
Jodi Female 6 2
Pam Female 6 3
Sara Female 6 4
Mary Female 6 5
Jodi Female 6 6
Mark Male 5 1
John Male 5 1
Todd Male 5 2
Ben Male 5 2
Tom Male 5 3
Lucky Male 5 3
Mark Male 5 4
John Male 5 4
Todd Male 5 5
Ben Male 5 5
Tom Male 5 6
Lucky Male 5 6
select c1, c2, c3, ntile(c3) over (partition by c2 order by pk) from t1;
c1 c2 c3 ntile(c3) over (partition by c2 order by pk)
Pam Female 6 1
Sara Female 6 1
Mary Female 6 2
Jodi Female 6 2
Pam Female 6 3
Sara Female 6 4
Mary Female 6 5
Jodi Female 6 6
Mark Male 5 1
John Male 5 1
Todd Male 5 1
Ben Male 5 2
Tom Male 5 2
Lucky Male 5 2
Mark Male 5 3
John Male 5 3
Todd Male 5 4
Ben Male 5 4
Tom Male 5 5
Lucky Male 5 5
update t1 set c3= 1 where pk = 1;
select c1, c2, c3, ntile(c3) over (partition by c2 order by pk) from t1;
ERROR HY000: Argument of NTILE must be greater than 0
drop table t1;

View File

@ -168,4 +168,47 @@ select pk, a, b,
from t1;
drop table t1;
--echo #
--echo # MDEV-9911 NTILE must return an error when parameter is not stable
--echo #
create table t1 (
pk int primary key,
c1 nvarchar(10),
c2 nvarchar(10),
c3 int
);
insert into t1 values
(1, 'Mark', 'Male', 5),
(2, 'John', 'Male', 5),
(3, 'Pam', 'Female', 6),
(4, 'Sara', 'Female', 6),
(5, 'Todd', 'Male', 5),
(6, 'Mary', 'Female', 6),
(7, 'Ben', 'Male', 5),
(8, 'Jodi', 'Female', 6),
(9, 'Tom', 'Male', 5),
(10, 'Lucky', 'Male', 5),
(11, 'Mark', 'Male', 5),
(12, 'John', 'Male', 5),
(13, 'Pam', 'Female', 6),
(14, 'Sara', 'Female', 6),
(15, 'Todd', 'Male', 5),
(16, 'Mary', 'Female', 6),
(17, 'Ben', 'Male', 5),
(18, 'Jodi', 'Female', 6),
(19, 'Tom', 'Male', 5),
(20, 'Lucky', 'Male', 5);
# Correct usage of NTILE with a fix argument NTILE(6).
select c1, c2, c3, ntile(6) over (partition by c2 order by pk) from t1;
# Correct usage - constant NTILE (argument) in each partition.
select c1, c2, c3, ntile(c3) over (partition by c2 order by pk) from t1;
update t1 set c3= 1 where pk = 1;
--error ER_INVALID_NTILE_ARGUMENT
select c1, c2, c3, ntile(c3) over (partition by c2 order by pk) from t1;
drop table t1;

View File

@ -9,6 +9,9 @@ INSERT INTO t2 (f1,f2,f3) SELECT '', '', '' FROM seq_1_to_8192;
SELECT COUNT(*) FROM t1;
COUNT(*)
8192
SELECT COUNT(*) FROM t2;
COUNT(*)
8192
SELECT variable_value > @old_encrypted FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted';
variable_value > @old_encrypted

View File

@ -15,6 +15,8 @@ CREATE TEMPORARY TABLE t2(f1 CHAR(100), f2 CHAR(200), f3 CHAR(200))ENGINE=InnoDB
INSERT INTO t2 (f1,f2,f3) SELECT '', '', '' FROM seq_1_to_8192;
SELECT COUNT(*) FROM t1;
SELECT COUNT(*) FROM t2;
SELECT variable_value > @old_encrypted FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted';

View File

@ -14,10 +14,8 @@ MW-286 : MDEV-18464 Killing thread can cause mutex deadlock if done concurrently
MW-329 : MDEV-19962 Galera test failure on MW-329
galera.galera_defaults : MDEV-21494 Galera test sporadic failure on galera.galera_defaults
galera_as_slave_replication_bundle : MDEV-15785 OPTION_GTID_BEGIN is set in Gtid_log_event::do_apply_event()
galera_autoinc_sst_mariabackup : Known issue, may require porting MDEV-17458 from later versions
galera_binlog_stmt_autoinc : MDEV-19959 Galera test failure on galera_binlog_stmt_autoinc
galera_gcache_recover_manytrx : MDEV-18834 Galera test failure
galera_ist_progress : MDEV-15236 fails when trying to read transfer status
galera_load_data : MDEV-19968 galera.galera_load_data
galera_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails
galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim

View File

@ -102,12 +102,18 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
ROLLBACK;
--let $wait_condition = SELECT COUNT(*)=35 FROM t1
--source include/wait_condition.inc
SELECT COUNT(*) = 35 FROM t1;
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
COMMIT;
SET AUTOCOMMIT=ON;
--connection node_1
--let $wait_condition = SELECT COUNT(*)=35 FROM t1
--source include/wait_condition.inc
SELECT COUNT(*) = 35 FROM t1;
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
DROP TABLE t1;

View File

@ -92,12 +92,18 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
ROLLBACK;
--let $wait_condition = SELECT COUNT(*)=35 FROM t1
--source include/wait_condition.inc
SELECT COUNT(*) = 35 FROM t1;
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
COMMIT;
SET AUTOCOMMIT=ON;
--connection node_1
--let $wait_condition = SELECT COUNT(*)=35 FROM t1
--source include/wait_condition.inc
SELECT COUNT(*) = 35 FROM t1;
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
DROP TABLE t1;

View File

@ -96,12 +96,18 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
ROLLBACK;
--let $wait_condition = SELECT COUNT(*)=35 FROM t1
--source include/wait_condition.inc
SELECT COUNT(*) = 35 FROM t1;
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
COMMIT;
SET AUTOCOMMIT=ON;
--connection node_1
--let $wait_condition = SELECT COUNT(*)=35 FROM t1
--source include/wait_condition.inc
SELECT COUNT(*) = 35 FROM t1;
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
DROP TABLE t1;

View File

@ -110,6 +110,9 @@ INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
ROLLBACK;
--let $wait_condition = SELECT COUNT(*)=35 FROM t1
--source include/wait_condition.inc
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
SELECT COUNT(*) = 35 FROM t1;
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
@ -117,6 +120,8 @@ COMMIT;
SET AUTOCOMMIT=ON;
--connection node_1
--let $wait_condition = SELECT COUNT(*)=35 FROM t1
--source include/wait_condition.inc
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
SELECT COUNT(*) = 35 FROM t1;
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;

View File

@ -97,12 +97,18 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
ROLLBACK;
--let $wait_condition = SELECT COUNT(*)=35 FROM t1
--source include/wait_condition.inc
SELECT COUNT(*) = 35 FROM t1;
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
COMMIT;
SET AUTOCOMMIT=ON;
--connection node_1
--let $wait_condition = SELECT COUNT(*)=35 FROM t1
--source include/wait_condition.inc
SELECT COUNT(*) = 35 FROM t1;
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
DROP TABLE t1;

View File

@ -1,25 +1,28 @@
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1a;
SET SESSION wsrep_sync_wait = 0;
connection node_1;
CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
CREATE TABLE t1 (f1 INTEGER, f2 varchar(1024)) Engine=InnoDB;
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
SET GLOBAL innodb_disallow_writes=ON;
INSERT INTO t1 VALUES (1);;
INSERT INTO t1 (f2) SELECT 'abcde ' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
connection node_2;
INSERT INTO t1 (f2) SELECT 'fghij ' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_1a;
SELECT COUNT(*) AS EXPECT_0 FROM t1;
EXPECT_0
0
SELECT COUNT(*) AS EXPECT_0 FROM t1;
EXPECT_0
0
SET GLOBAL innodb_disallow_writes=OFF;
connection node_1;
SELECT COUNT(*) AS EXPECT_1 FROM t1;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_20000 FROM t1;
EXPECT_20000
20000
connection node_2;
SELECT COUNT(*) AS EXPECT_20000 FROM t1;
EXPECT_20000
20000
connection node_1;
connection node_2;
SELECT COUNT(*) AS EXPECT_1 FROM t1;
EXPECT_1
1
DROP TABLE t1;
DROP TABLE ten;
disconnect node_1a;

View File

@ -1,41 +1,71 @@
#
# This test checks that innodb_disallow_writes works as expected
#
# Note that we need to enable binlog for this test: If the commit
# to InnoDB is done in one phase, the transaction is committed in
# memory before it is persisted to disk. This means that the
# innodb_disallow_writes=ON may not prevent transaction to
# become visible to other readers. On the other hand, if the
# commit is two phase (as it is with binlog), the transaction
# will be blocked in prepare phase.
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--let $datadir= `SELECT @@datadir`
# Open a separate connection to be used to run SHOW PROCESSLIST
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
--let $galera_connection_name = node_1a
--let $galera_server_number = 1
--source include/galera_connect.inc
--connection node_1a
SET SESSION wsrep_sync_wait = 0;
--connection node_1
CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
CREATE TABLE t1 (f1 INTEGER, f2 varchar(1024)) Engine=InnoDB;
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
SET GLOBAL innodb_disallow_writes=ON;
--send INSERT INTO t1 VALUES (1);
--exec find $datadir -type f-exec md5sum {} \; | md5sum >$MYSQLTEST_VARDIR/tmp/innodb_before
#
# This insert has no effect before innodb_disallow_writes is OFF
#
--send INSERT INTO t1 (f2) SELECT 'abcde ' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
--connection node_2
INSERT INTO t1 (f2) SELECT 'fghij ' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
--connection node_1a
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_0 FROM t1;
let $wait_condition = SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO = 'INSERT INTO t1 VALUES (1)';
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_0 FROM t1;
--sleep 5
--exec find $datadir -type f-exec md5sum {} \; | md5sum >$MYSQLTEST_VARDIR/tmp/innodb_after
SET GLOBAL innodb_disallow_writes=OFF;
--connection node_1
--reap
SELECT COUNT(*) AS EXPECT_1 FROM t1;
--let $wait_condition = SELECT COUNT(*) = 20000 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_20000 FROM t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--let $wait_condition = SELECT COUNT(*) = 20000 FROM t1;
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_1 FROM t1;
SELECT COUNT(*) AS EXPECT_20000 FROM t1;
--connection node_1
--diff_files $MYSQLTEST_VARDIR/tmp/innodb_before $MYSQLTEST_VARDIR/tmp/innodb_after
--connection node_2
DROP TABLE t1;
DROP TABLE ten;
--disconnect node_1a

View File

@ -603,3 +603,69 @@ test gcol_t1 sidea NEVER NULL
test gcol_t1 sideb NEVER NULL
test gcol_t1 sidec VIRTUAL GENERATED ALWAYS sqrt(`sidea` * `sidea` + `sideb` * `sideb`)
DROP TABLE gcol_t1;
#
# MDEV-16039 Crash when selecting virtual columns
# generated using functions with DAYNAME()
#
CREATE TABLE t1 (
suppliersenttoday INT NOT NULL,
suppliercaptoday CHAR(10) AS (CONCAT('',DAYNAME('2020-02-05')))
) COLLATE utf8_bin;
INSERT INTO t1 (suppliersenttoday) VALUES (0);
INSERT INTO t1 (suppliersenttoday) VALUES (0);
SELECT * FROM t1;
suppliersenttoday suppliercaptoday
0 Wednesday
0 Wednesday
PREPARE STMT FROM 'INSERT INTO t1 (suppliersenttoday) VALUES (1)';
CREATE OR REPLACE TABLE t1 (
suppliersenttoday INT NOT NULL,
suppliercaptoday CHAR(10) AS (CONCAT('',DAYNAME('2020-02-05')))
) COLLATE utf8_bin;
EXECUTE STMT;
EXECUTE STMT;
SELECT * FROM t1;
suppliersenttoday suppliercaptoday
1 Wednesday
1 Wednesday
DROP TABLE t1;
# (duplicate) MDEV-20380 Server crash during update
CREATE TABLE gafld (
nuigafld INTEGER NOT NULL,
ucrgafld VARCHAR(30) COLLATE UTF8_BIN NOT NULL
DEFAULT SUBSTRING_INDEX(USER(),'@',1)
);
EXPLAIN UPDATE gafld SET nuigafld = 0 WHERE nuigafld = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE gafld ALL NULL NULL NULL NULL 1 Using where
EXPLAIN UPDATE gafld SET nuigafld = 0 WHERE nuigafld = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE gafld ALL NULL NULL NULL NULL 1 Using where
DROP TABLE gafld;
# (duplicate) MDEV-17653 replace into generated columns is unstable
# Some columns are snipped from the MDEV test
CREATE TABLE t (
c0 TIMESTAMP NOT NULL DEFAULT current_timestamp()
ON UPDATE current_timestamp(),
c1 DECIMAL(27,25) GENERATED ALWAYS AS (DAYOFMONTH('2020-02-05')),
c4 TIME NOT NULL,
c8 SMALLINT(6) GENERATED ALWAYS AS
(CONCAT_WS(CONVERT(C1 USING CP932),
'900') <> (c4 = 1)),
PRIMARY KEY (c4)
) DEFAULT CHARSET=latin1;
REPLACE INTO t SET c0 = '2018-06-03 10:31:43', c4 = '02:58:55';
REPLACE INTO t SET c0 = '2018-06-03 10:31:44', c4 = '02:58:55';
REPLACE INTO t SET c0 = '2018-06-03 10:31:45', c4 = '02:58:55';
DROP TABLE t;
# (duplicate) MDEV-17986 crash when I insert on a table
CREATE OR REPLACE TABLE t2 (
number BIGINT(20) NOT NULL,
lrn BIGINT(20) NOT NULL DEFAULT 0,
source VARCHAR(15) NOT NULL
DEFAULT (REVERSE(SUBSTRING_INDEX(REVERSE(user()), '@', 1))),
PRIMARY KEY (number)
);
REPLACE t2(number) VALUES('1');
REPLACE t2(number) VALUES('1');
DROP TABLE t2;

View File

@ -564,3 +564,73 @@ SELECT table_schema,table_name,column_name,extra,is_generated,generation_express
FROM information_schema.columns WHERE table_name='gcol_t1';
DROP TABLE gcol_t1;
--echo #
--echo # MDEV-16039 Crash when selecting virtual columns
--echo # generated using functions with DAYNAME()
--echo #
CREATE TABLE t1 (
suppliersenttoday INT NOT NULL,
suppliercaptoday CHAR(10) AS (CONCAT('',DAYNAME('2020-02-05')))
) COLLATE utf8_bin;
INSERT INTO t1 (suppliersenttoday) VALUES (0);
INSERT INTO t1 (suppliersenttoday) VALUES (0);
SELECT * FROM t1;
PREPARE STMT FROM 'INSERT INTO t1 (suppliersenttoday) VALUES (1)';
CREATE OR REPLACE TABLE t1 (
suppliersenttoday INT NOT NULL,
suppliercaptoday CHAR(10) AS (CONCAT('',DAYNAME('2020-02-05')))
) COLLATE utf8_bin;
EXECUTE STMT;
EXECUTE STMT;
SELECT * FROM t1;
DROP TABLE t1;
--echo # (duplicate) MDEV-20380 Server crash during update
CREATE TABLE gafld (
nuigafld INTEGER NOT NULL,
ucrgafld VARCHAR(30) COLLATE UTF8_BIN NOT NULL
DEFAULT SUBSTRING_INDEX(USER(),'@',1)
);
EXPLAIN UPDATE gafld SET nuigafld = 0 WHERE nuigafld = 10;
EXPLAIN UPDATE gafld SET nuigafld = 0 WHERE nuigafld = 10;
DROP TABLE gafld;
--echo # (duplicate) MDEV-17653 replace into generated columns is unstable
--echo # Some columns are snipped from the MDEV test
CREATE TABLE t (
c0 TIMESTAMP NOT NULL DEFAULT current_timestamp()
ON UPDATE current_timestamp(),
c1 DECIMAL(27,25) GENERATED ALWAYS AS (DAYOFMONTH('2020-02-05')),
c4 TIME NOT NULL,
c8 SMALLINT(6) GENERATED ALWAYS AS
(CONCAT_WS(CONVERT(C1 USING CP932),
'900') <> (c4 = 1)),
PRIMARY KEY (c4)
) DEFAULT CHARSET=latin1;
REPLACE INTO t SET c0 = '2018-06-03 10:31:43', c4 = '02:58:55';
REPLACE INTO t SET c0 = '2018-06-03 10:31:44', c4 = '02:58:55';
REPLACE INTO t SET c0 = '2018-06-03 10:31:45', c4 = '02:58:55';
DROP TABLE t;
--echo # (duplicate) MDEV-17986 crash when I insert on a table
CREATE OR REPLACE TABLE t2 (
number BIGINT(20) NOT NULL,
lrn BIGINT(20) NOT NULL DEFAULT 0,
source VARCHAR(15) NOT NULL
DEFAULT (REVERSE(SUBSTRING_INDEX(REVERSE(user()), '@', 1))),
PRIMARY KEY (number)
);
REPLACE t2(number) VALUES('1');
REPLACE t2(number) VALUES('1');
DROP TABLE t2;

View File

@ -11,4 +11,3 @@
##############################################################################
create-index-debug : MDEV-13680 InnoDB may crash when btr_page_alloc() fails
innodb_force_recovery_rollback : MDEV-22889 InnoDB occasionally breaks ACID

View File

@ -1066,3 +1066,20 @@ SELECT * FROM t1;
a b
10 10:20:30
DROP TABLE t1;
#
# MDEV-18042 Server crashes in mysql_alter_table upon adding a non-null
# date column under NO_ZERO_DATE with ALGORITHM=INPLACE
#
SET @OLD_SQL_MODE= @@SQL_MODE;
SET @@SQL_MODE= 'NO_ZERO_DATE';
CREATE OR REPLACE TABLE t1 (i INT) ENGINE=MyISAM;
ALTER TABLE t1 ADD COLUMN d DATE NOT NULL, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
CREATE OR REPLACE TABLE t1 (i INT) ENGINE=InnoDB;
ALTER TABLE t1 ADD d DATETIME NOT NULL CHECK (f <= 0), ALGORITHM=COPY;
ERROR 42S22: Unknown column 'f' in 'CHECK'
CREATE OR REPLACE TABLE t1 (a int) ENGINE=InnoDB;
ALTER TABLE t1 ADD COLUMN b DATETIME NOT NULL, LOCK=NONE;
# Cleanup
SET @@SQL_MODE= @OLD_SQL_MODE;
DROP TABLE t1;

View File

@ -12,6 +12,6 @@ SET GLOBAL innodb_flush_log_at_trx_commit=1;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
disconnect con0;
connection default;
SELECT * FROM t0 LOCK IN SHARE MODE;
SELECT * FROM t0 LIMIT 0 LOCK IN SHARE MODE;
a
DROP TABLE t0,t1;

View File

@ -29,4 +29,18 @@ SELECT * FROM t1;
a
0
DROP TABLE t1;
#
# MDEV-23198 Crash in REPLACE
#
BEGIN NOT ATOMIC
DECLARE c TEXT DEFAULT(SELECT CONCAT('CREATE TABLE t1(id INT PRIMARY KEY, c',
GROUP_CONCAT(seq SEPARATOR ' INT, c'),
' INT NOT NULL UNIQUE) ENGINE=InnoDB')
FROM seq_1_to_294);
EXECUTE IMMEDIATE c;
END;
$$
INSERT INTO t1 SET id=1,c294=1;
REPLACE t1 SET id=1,c294=1;
DROP TABLE t1;
SET GLOBAL innodb_file_per_table= @save_per_table;

View File

@ -668,6 +668,28 @@ ALTER TABLE t1 ADD b TIME NOT NULL DEFAULT if(unix_timestamp()>1,TIMESTAMP'2001-
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # MDEV-18042 Server crashes in mysql_alter_table upon adding a non-null
--echo # date column under NO_ZERO_DATE with ALGORITHM=INPLACE
--echo #
SET @OLD_SQL_MODE= @@SQL_MODE;
SET @@SQL_MODE= 'NO_ZERO_DATE';
CREATE OR REPLACE TABLE t1 (i INT) ENGINE=MyISAM;
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 ADD COLUMN d DATE NOT NULL, ALGORITHM=INPLACE;
CREATE OR REPLACE TABLE t1 (i INT) ENGINE=InnoDB;
--error ER_BAD_FIELD_ERROR
ALTER TABLE t1 ADD d DATETIME NOT NULL CHECK (f <= 0), ALGORITHM=COPY;
CREATE OR REPLACE TABLE t1 (a int) ENGINE=InnoDB;
ALTER TABLE t1 ADD COLUMN b DATETIME NOT NULL, LOCK=NONE;
--echo # Cleanup
SET @@SQL_MODE= @OLD_SQL_MODE;
DROP TABLE t1;
#
# End of 10.2 tests
#

View File

@ -30,5 +30,6 @@ CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
disconnect con0;
connection default;
# If the rollback was aborted, we would end up in a lock wait here.
SELECT * FROM t0 LOCK IN SHARE MODE;
# The LIMIT 0 works around MDEV-22889 InnoDB occasionally breaks ACID
SELECT * FROM t0 LIMIT 0 LOCK IN SHARE MODE;
DROP TABLE t0,t1;

View File

@ -1,4 +1,5 @@
--source include/have_innodb.inc
--source include/have_sequence.inc
SET @save_per_table= @@GLOBAL.innodb_file_per_table;
SET GLOBAL innodb_file_per_table= 1;
@ -49,4 +50,23 @@ SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # MDEV-23198 Crash in REPLACE
--echo #
DELIMITER $$;
BEGIN NOT ATOMIC
DECLARE c TEXT DEFAULT(SELECT CONCAT('CREATE TABLE t1(id INT PRIMARY KEY, c',
GROUP_CONCAT(seq SEPARATOR ' INT, c'),
' INT NOT NULL UNIQUE) ENGINE=InnoDB')
FROM seq_1_to_294);
EXECUTE IMMEDIATE c;
END;
$$
DELIMITER ;$$
INSERT INTO t1 SET id=1,c294=1;
REPLACE t1 SET id=1,c294=1;
DROP TABLE t1;
SET GLOBAL innodb_file_per_table= @save_per_table;

View File

@ -11,5 +11,6 @@ uninstall plugin audit_null;
ERROR HY000: Index for table './mysql/plugin.MYI' is corrupt; try to repair it
SET debug_dbug=@old_dbug;
uninstall plugin audit_null;
uninstall plugin audit_null;
ERROR 42000: PLUGIN audit_null does not exist
delete from mysql.plugin where name='audit_null';

View File

@ -26,7 +26,8 @@ SET debug_dbug='+d,myisam_pretend_crashed_table_on_usage';
uninstall plugin audit_null;
SET debug_dbug=@old_dbug;
--error 1305
uninstall plugin audit_null;
--error ER_SP_DOES_NOT_EXIST
uninstall plugin audit_null;
delete from mysql.plugin where name='audit_null';

View File

@ -0,0 +1,22 @@
include/master-slave.inc
[connection master]
CREATE TABLE t1(a int);
INSERT INTO t1 VALUES(1);
connection slave;
SET @saved_dbug = @@GLOBAL.debug_dbug;
SET @@global.debug_dbug= 'd,simulate_error_on_packet_write';
START SLAVE;
SET DEBUG_SYNC= 'now WAIT_FOR parked';
SET @@GLOBAL.debug_dbug = @saved_dbug;
SET DEBUG_SYNC= 'now SIGNAL continue';
SET DEBUG_SYNC= 'RESET';
include/wait_for_slave_io_to_start.inc
include/wait_for_slave_sql_to_start.inc
connection master;
include/sync_slave_sql_with_master.inc
SELECT * FROM t1;
a
1
connection master;
DROP TABLE t1;
include/rpl_end.inc

View File

@ -0,0 +1,20 @@
include/master-slave.inc
[connection master]
connection master;
create table t1 (
id int auto_increment,
data varchar(32),
virt tinyint as (1),
primary key (id),
key virt (virt)
) engine=innodb default charset=utf8mb4;
insert into t1 (data) values ('broken');
update t1 set data='more broken';
connection slave;
select * from t1;
id data virt
1 more broken 1
connection master;
drop table t1;
connection slave;
include/rpl_end.inc

View File

@ -0,0 +1,60 @@
# ==== Purpose ====
#
# Test verifies that, due to a temporary network error, if request dump
# command specific packet write operation fails then the write error gets
# handled appropriately. Further retry will be initiated with appropriate
# slave registration on master. This will ensure that master has all the
# details of slave and no warnings are reported on the master side.
#
# ==== Implementation ====
#
# Steps:
# 0 - Skip the slave start.
# 1 - Enable debug simulation which will simulate packet write error during
# dump request command execution.
# 2 - Start the slave. Observe that slave is able to reconnect post
# temporary network write error.
#
# ==== References ====
#
# MDEV-14203: rpl.rpl_extra_col_master_myisam,
# rpl.rpl_slave_load_tmpdir_not_exist failed in buildbot with a
# warning
#
# MDEV-13258: rpl.rpl_skip_replication, rpl.rpl_set_statement_default_master
# failed in buildbot
#
--source include/have_debug.inc
--source include/have_debug_sync.inc
--let $rpl_skip_start_slave=1
--source include/master-slave.inc
# Do an insert on master
CREATE TABLE t1(a int);
INSERT INTO t1 VALUES(1);
# Add a debug point and start the slave so that dump request fails.
connection slave;
SET @saved_dbug = @@GLOBAL.debug_dbug;
SET @@global.debug_dbug= 'd,simulate_error_on_packet_write';
START SLAVE;
SET DEBUG_SYNC= 'now WAIT_FOR parked';
SET @@GLOBAL.debug_dbug = @saved_dbug;
SET DEBUG_SYNC= 'now SIGNAL continue';
SET DEBUG_SYNC= 'RESET';
--source include/wait_for_slave_io_to_start.inc
--source include/wait_for_slave_sql_to_start.inc
# Sync the slave and verify that slave has caught up with the master.
connection master;
--source include/sync_slave_sql_with_master.inc
SELECT * FROM t1;
# Cleanup
connection master;
DROP TABLE t1;
--source include/rpl_end.inc

View File

@ -0,0 +1,27 @@
--source include/have_binlog_format_row.inc
--source include/master-slave.inc
--source include/have_innodb.inc
connection master;
create table t1 (
id int auto_increment,
data varchar(32),
virt tinyint as (1),
primary key (id),
key virt (virt)
) engine=innodb default charset=utf8mb4;
insert into t1 (data) values ('broken');
update t1 set data='more broken';
--sync_slave_with_master
select * from t1;
--connection master
drop table t1;
--sync_slave_with_master
--source include/rpl_end.inc

View File

@ -812,7 +812,11 @@ void my_timer_init(MY_TIMER_INFO *mti)
time1= my_timer_cycles();
time2= my_timer_ticks();
time3= time2; /* Avoids a Microsoft/IBM compiler warning */
#if defined(HAVE_SYS_TIMES_H) && defined(HAVE_TIMES)
for (i= 0; i < 1000; ++i)
#else
for (i= 0; i < MY_TIMER_ITERATIONS * 1000; ++i)
#endif
{
time3= my_timer_ticks();
if (time3 - time2 > 10) break;

View File

@ -721,6 +721,8 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
set_mysql_error(mysql, CR_NET_PACKET_TOO_LARGE, unknown_sqlstate);
goto end;
}
if (net->last_errno == ER_NET_ERROR_ON_WRITE && command == COM_BINLOG_DUMP)
goto end;
end_server(mysql);
if (mysql_reconnect(mysql) || stmt_skip)
goto end;

View File

@ -11388,7 +11388,8 @@ void Field::set_datetime_warning(Sql_condition::enum_warning_level level,
THD *thd= get_thd();
if (thd->really_abort_on_warning() && level >= Sql_condition::WARN_LEVEL_WARN)
make_truncated_value_warning(thd, level, str, ts_type,
table->s, field_name.str);
table->s->db.str, table->s->table_name.str,
field_name.str);
else
set_warning(level, code, cuted_increment);
}

View File

@ -2736,14 +2736,7 @@ bool Type_std_attributes::agg_item_set_converter(const DTCollation &coll,
bool res= FALSE;
uint i;
/*
In case we're in statement prepare, create conversion item
in its memory: it will be reused on each execute.
*/
Query_arena backup;
Query_arena *arena= thd->stmt_arena->is_stmt_prepare() ?
thd->activate_stmt_arena_if_needed(&backup) :
NULL;
DBUG_ASSERT(!thd->stmt_arena->is_stmt_prepare());
for (i= 0, arg= args; i < nargs; i++, arg+= item_sep)
{
@ -2765,19 +2758,7 @@ bool Type_std_attributes::agg_item_set_converter(const DTCollation &coll,
res= TRUE;
break; // we cannot return here, we need to restore "arena".
}
/*
If in statement prepare, then we create a converter for two
constant items, do it once and then reuse it.
If we're in execution of a prepared statement, arena is NULL,
and the conv was created in runtime memory. This can be
the case only if the argument is a parameter marker ('?'),
because for all true constants the charset converter has already
been created in prepare. In this case register the change for
rollback.
*/
if (thd->stmt_arena->is_stmt_prepare())
*arg= conv;
else
thd->change_item_tree(arg, conv);
if (conv->fix_fields(thd, arg))
@ -2786,8 +2767,6 @@ bool Type_std_attributes::agg_item_set_converter(const DTCollation &coll,
break; // we cannot return here, we need to restore "arena".
}
}
if (arena)
thd->restore_active_arena(arena, &backup);
return res;
}
@ -4330,7 +4309,7 @@ void Item_param::set_time(MYSQL_TIME *tm, timestamp_type time_type,
{
ErrConvTime str(&value.time);
make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN,
&str, time_type, 0, 0);
&str, time_type, NULL, NULL, NULL);
set_zero_time(&value.time, time_type);
}
maybe_null= 0;

View File

@ -7533,7 +7533,7 @@ Item *create_temporal_literal(THD *thd,
ErrConvString err(str, length, cs);
make_truncated_value_warning(thd,
Sql_condition::time_warn_level(status.warnings),
&err, ltime.time_type, 0, 0);
&err, ltime.time_type, NULL, NULL, NULL);
}
return item;
}

View File

@ -431,7 +431,7 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
make_truncated_value_warning(current_thd,
Sql_condition::WARN_LEVEL_WARN,
val_begin, length,
cached_timestamp_type, 0, NullS);
cached_timestamp_type, NULL, NULL, NULL);
break;
}
} while (++val != val_end);
@ -1830,13 +1830,13 @@ overflow:
{
ErrConvInteger err2(sec, unsigned_flag);
make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN,
&err2, MYSQL_TIMESTAMP_TIME, 0, NullS);
&err2, MYSQL_TIMESTAMP_TIME, NULL, NULL, NULL);
}
else
{
ErrConvString err2(err);
make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN,
&err2, MYSQL_TIMESTAMP_TIME, 0, NullS);
&err2, MYSQL_TIMESTAMP_TIME, NULL, NULL, NULL);
}
return 0;
}
@ -2885,7 +2885,7 @@ bool Item_func_maketime::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
int len = (int)(ptr - buf) + sprintf(ptr, ":%02u:%02u", (uint)minute, (uint)second);
make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN,
buf, len, MYSQL_TIMESTAMP_TIME,
0, NullS);
NULL, NULL, NULL);
}
return (null_value= 0);

View File

@ -557,11 +557,9 @@ void Item_window_func::print(String *str, enum_query_type query_type)
}
window_func()->print(str, query_type);
str->append(" over ");
#ifndef DBUG_OFF
if (!window_spec) // one can call dbug_print_item() anytime in gdb
if (!window_spec)
str->append(window_name);
else
#endif
window_spec->print(str, query_type);
}
void Item_window_func::print_for_percentile_functions(String *str, enum_query_type query_type)

View File

@ -640,7 +640,7 @@ class Item_sum_ntile : public Item_sum_int,
{
public:
Item_sum_ntile(THD* thd, Item* num_quantiles_expr) :
Item_sum_int(thd, num_quantiles_expr)
Item_sum_int(thd, num_quantiles_expr), n_old_val_(0)
{ }
longlong val_int()
@ -653,11 +653,13 @@ class Item_sum_ntile : public Item_sum_int,
longlong num_quantiles= get_num_quantiles();
if (num_quantiles <= 0) {
if (num_quantiles <= 0 ||
(static_cast<ulonglong>(num_quantiles) != n_old_val_ && n_old_val_ > 0))
{
my_error(ER_INVALID_NTILE_ARGUMENT, MYF(0));
return true;
}
n_old_val_= static_cast<ulonglong>(num_quantiles);
null_value= false;
ulonglong quantile_size = get_row_count() / num_quantiles;
ulonglong extra_rows = get_row_count() - quantile_size * num_quantiles;
@ -683,6 +685,7 @@ class Item_sum_ntile : public Item_sum_int,
{
current_row_count_= 0;
partition_row_count_= 0;
n_old_val_= 0;
}
const char*func_name() const
@ -702,6 +705,7 @@ class Item_sum_ntile : public Item_sum_int,
private:
longlong get_num_quantiles() { return args[0]->val_int(); }
ulonglong n_old_val_;
};
class Item_sum_percentile_disc : public Item_sum_num,

View File

@ -14302,7 +14302,6 @@ end:
if (is_table_scan || is_index_scan)
issue_long_find_row_warning(get_general_type_code(), m_table->alias.c_ptr(),
is_index_scan, rgi);
table->default_column_bitmaps();
DBUG_RETURN(error);
}
@ -14633,6 +14632,12 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi)
#endif /* WSREP_PROC_INFO */
thd_proc_info(thd, message);
// Temporary fix to find out why it fails [/Matz]
memcpy(m_table->read_set->bitmap, m_cols.bitmap, (m_table->read_set->n_bits + 7) / 8);
memcpy(m_table->write_set->bitmap, m_cols_ai.bitmap, (m_table->write_set->n_bits + 7) / 8);
m_table->mark_columns_per_binlog_row_image();
int error= find_row(rgi);
if (unlikely(error))
{
@ -14703,11 +14708,6 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi)
goto err;
}
// Temporary fix to find out why it fails [/Matz]
memcpy(m_table->read_set->bitmap, m_cols.bitmap, (m_table->read_set->n_bits + 7) / 8);
memcpy(m_table->write_set->bitmap, m_cols_ai.bitmap, (m_table->write_set->n_bits + 7) / 8);
m_table->mark_columns_per_binlog_row_image();
if (m_vers_from_plain && m_table->versioned(VERS_TIMESTAMP))
m_table->vers_update_fields();
error= m_table->file->ha_update_row(m_table->record[1], m_table->record[0]);

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2012, 2018, MariaDB Corporation.
Copyright (c) 2012, 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
@ -45,6 +45,7 @@
#include <violite.h>
#include <signal.h>
#include "probes_mysql.h"
#include <debug_sync.h>
#include "proxy_protocol.h"
#ifdef EMBEDDED_LIBRARY
@ -489,6 +490,17 @@ net_write_command(NET *net,uchar command,
DBUG_ENTER("net_write_command");
DBUG_PRINT("enter",("length: %lu", (ulong) len));
DBUG_EXECUTE_IF("simulate_error_on_packet_write",
{
if (command == COM_BINLOG_DUMP)
{
net->last_errno = ER_NET_ERROR_ON_WRITE;
DBUG_ASSERT(!debug_sync_set_action(
(THD *)net->thd,
STRING_WITH_LEN("now SIGNAL parked WAIT_FOR continue")));
DBUG_RETURN(true);
}
};);
MYSQL_NET_WRITE_START(length);
buff[4]=command; /* For first packet */

View File

@ -3639,7 +3639,8 @@ static int request_dump(THD *thd, MYSQL* mysql, Master_info* mi,
in the future, we should do a better error analysis, but for
now we just fill up the error log :-)
*/
if (mysql_errno(mysql) == ER_NET_READ_INTERRUPTED)
if (mysql_errno(mysql) == ER_NET_READ_INTERRUPTED ||
mysql_errno(mysql) == ER_NET_ERROR_ON_WRITE)
*suppress_warnings= TRUE; // Suppress reconnect warning
else
sql_print_error("Error on COM_BINLOG_DUMP: %d %s, will retry in %d secs",

View File

@ -5245,6 +5245,24 @@ static void mark_real_tables_as_free_for_reuse(TABLE_LIST *table_list)
}
}
int TABLE::fix_vcol_exprs(THD *thd)
{
for (Field **vf= vfield; vf && *vf; vf++)
if (fix_session_vcol_expr(thd, (*vf)->vcol_info))
return 1;
for (Field **df= default_field; df && *df; df++)
if ((*df)->default_value &&
fix_session_vcol_expr(thd, (*df)->default_value))
return 1;
for (Virtual_column_info **cc= check_constraints; cc && *cc; cc++)
if (fix_session_vcol_expr(thd, (*cc)))
return 1;
return 0;
}
static bool fix_all_session_vcol_exprs(THD *thd, TABLE_LIST *tables)
{
@ -5252,36 +5270,27 @@ static bool fix_all_session_vcol_exprs(THD *thd, TABLE_LIST *tables)
TABLE_LIST *first_not_own= thd->lex->first_not_own_table();
DBUG_ENTER("fix_session_vcol_expr");
for (TABLE_LIST *table= tables; table && table != first_not_own;
int error= 0;
for (TABLE_LIST *table= tables; table && table != first_not_own && !error;
table= table->next_global)
{
TABLE *t= table->table;
if (!table->placeholder() && t->s->vcols_need_refixing &&
table->lock_type >= TL_WRITE_ALLOW_WRITE)
{
Query_arena *stmt_backup= thd->stmt_arena;
if (thd->stmt_arena->is_conventional())
thd->stmt_arena= t->expr_arena;
if (table->security_ctx)
thd->security_ctx= table->security_ctx;
for (Field **vf= t->vfield; vf && *vf; vf++)
if (fix_session_vcol_expr(thd, (*vf)->vcol_info))
goto err;
for (Field **df= t->default_field; df && *df; df++)
if ((*df)->default_value &&
fix_session_vcol_expr(thd, (*df)->default_value))
goto err;
for (Virtual_column_info **cc= t->check_constraints; cc && *cc; cc++)
if (fix_session_vcol_expr(thd, (*cc)))
goto err;
error= t->fix_vcol_exprs(thd);
thd->security_ctx= save_security_ctx;
thd->stmt_arena= stmt_backup;
}
}
DBUG_RETURN(0);
err:
thd->security_ctx= save_security_ctx;
DBUG_RETURN(1);
DBUG_RETURN(error);
}

View File

@ -3709,7 +3709,6 @@ void select_dumpvar::cleanup()
Query_arena::Type Query_arena::type() const
{
DBUG_ASSERT(0); /* Should never be called */
return STATEMENT;
}

View File

@ -990,7 +990,7 @@ public:
/* We build without RTTI, so dynamic_cast can't be used. */
enum Type
{
STATEMENT, PREPARED_STATEMENT, STORED_PROCEDURE
STATEMENT, PREPARED_STATEMENT, STORED_PROCEDURE, TABLE_ARENA
};
Query_arena(MEM_ROOT *mem_root_arg, enum enum_state state_arg) :
@ -3928,13 +3928,20 @@ public:
return 0;
}
bool is_item_tree_change_register_required()
{
return !stmt_arena->is_conventional()
|| stmt_arena->type() == Query_arena::TABLE_ARENA;
}
void change_item_tree(Item **place, Item *new_value)
{
DBUG_ENTER("THD::change_item_tree");
DBUG_PRINT("enter", ("Register: %p (%p) <- %p",
*place, place, new_value));
/* TODO: check for OOM condition here */
if (!stmt_arena->is_conventional())
if (is_item_tree_change_register_required())
nocheck_register_item_tree_change(place, *place, mem_root);
*place= new_value;
DBUG_VOID_RETURN;

View File

@ -7830,8 +7830,8 @@ void mysql_parse(THD *thd, char *rawbuf, uint length,
sp_cache_enforce_limit(thd->sp_package_spec_cache, stored_program_cache_size);
sp_cache_enforce_limit(thd->sp_package_body_cache, stored_program_cache_size);
thd->end_statement();
thd->Item_change_list::rollback_item_tree_changes();
thd->cleanup_after_query();
DBUG_ASSERT(thd->Item_change_list::is_empty());
}
else
{

View File

@ -2240,9 +2240,12 @@ static bool do_uninstall(THD *thd, TABLE *table, const LEX_CSTRING *name)
if (!(plugin= plugin_find_internal(name, MYSQL_ANY_PLUGIN)) ||
plugin->state & (PLUGIN_IS_UNINITIALIZED | PLUGIN_IS_DYING))
{
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "PLUGIN", name->str);
return 1;
// maybe plugin is in mysql.plugin present so postpond the error
plugin= NULL;
}
if (plugin)
{
if (!plugin->plugin_dl)
{
my_error(ER_PLUGIN_DELETE_BUILTIN, MYF(0));
@ -2260,6 +2263,7 @@ static bool do_uninstall(THD *thd, TABLE *table, const LEX_CSTRING *name)
WARN_PLUGIN_BUSY, ER_THD(thd, WARN_PLUGIN_BUSY));
else
reap_needed= true;
}
uchar user_key[MAX_KEY_LENGTH];
table->use_all_columns();
@ -2284,6 +2288,11 @@ static bool do_uninstall(THD *thd, TABLE *table, const LEX_CSTRING *name)
return 1;
}
}
else if (!plugin)
{
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "PLUGIN", name->str);
return 1;
}
return 0;
}

View File

@ -10286,7 +10286,8 @@ err_new_table_cleanup:
thd->abort_on_warning= true;
make_truncated_value_warning(thd, Sql_condition::WARN_LEVEL_WARN,
f_val, strlength(f_val), t_type,
new_table ? new_table->s : table->s,
alter_ctx.new_db.str,
alter_ctx.new_name.str,
alter_ctx.datetime_field->field_name.str);
thd->abort_on_warning= save_abort_on_warning;
}

View File

@ -18,7 +18,6 @@
/* Functions to handle date and time */
#include "mariadb.h"
#include "sql_priv.h"
#include "sql_time.h"
#include "tztime.h" // struct Time_zone
#include "sql_class.h" // THD
@ -297,7 +296,7 @@ check_date_with_warn(const MYSQL_TIME *ltime, ulonglong fuzzy_date,
{
ErrConvTime str(ltime);
make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN,
&str, ts_type, 0, 0);
&str, ts_type, NULL, NULL, NULL);
return true;
}
return false;
@ -314,7 +313,7 @@ adjust_time_range_with_warn(MYSQL_TIME *ltime, uint dec)
return true;
if (warnings)
make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN,
&str, MYSQL_TIMESTAMP_TIME, 0, NullS);
&str, MYSQL_TIMESTAMP_TIME, NULL, NULL, NULL);
return false;
}
@ -403,7 +402,8 @@ str_to_datetime_with_warn(CHARSET_INFO *cs,
ret_val ? Sql_condition::WARN_LEVEL_WARN :
Sql_condition::time_warn_level(status.warnings),
str, length, flags & TIME_TIME_ONLY ?
MYSQL_TIMESTAMP_TIME : l_time->time_type, 0, NullS);
MYSQL_TIMESTAMP_TIME : l_time->time_type,
NULL, NULL, NULL);
DBUG_EXECUTE_IF("str_to_datetime_warn",
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_YES, str););
@ -460,7 +460,8 @@ static bool number_to_time_with_warn(bool neg, ulonglong nr, ulong sec_part,
make_truncated_value_warning(current_thd,
Sql_condition::WARN_LEVEL_WARN, str,
res < 0 ? MYSQL_TIMESTAMP_ERROR : ts_type,
s, field_name);
s ? s->db.str : NULL,
s ? s->table_name.str : NULL, field_name);
}
return res < 0;
}
@ -933,7 +934,8 @@ void make_truncated_value_warning(THD *thd,
Sql_condition::enum_warning_level level,
const ErrConv *sval,
timestamp_type time_type,
const TABLE_SHARE *s, const char *field_name)
const char *db_name, const char *table_name,
const char *field_name)
{
char warn_buff[MYSQL_ERRMSG_SIZE];
const char *type_str;
@ -953,9 +955,6 @@ void make_truncated_value_warning(THD *thd,
}
if (field_name)
{
const char *db_name= s->db.str;
const char *table_name= s->table_name.str;
if (!db_name)
db_name= "";
if (!table_name)
@ -1293,7 +1292,7 @@ make_date_with_warn(MYSQL_TIME *ltime, ulonglong fuzzy_date,
/* e.g. negative time */
ErrConvTime str(ltime);
make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN,
&str, ts_type, 0, 0);
&str, ts_type, NULL, NULL, NULL);
return true;
}
if ((ltime->time_type= ts_type) == MYSQL_TIMESTAMP_DATE)
@ -1457,7 +1456,7 @@ time_to_datetime_with_warn(THD *thd,
{
ErrConvTime str(from);
make_truncated_value_warning(thd, Sql_condition::WARN_LEVEL_WARN,
&str, MYSQL_TIMESTAMP_DATETIME, 0, 0);
&str, MYSQL_TIMESTAMP_DATETIME, NULL, NULL, NULL);
return true;
}
return false;

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2006, 2010, Oracle and/or its affiliates.
Copyright (c) 2011, 2016, MariaDB
Copyright (c) 2011, 2020, MariaDB
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
@ -118,15 +118,18 @@ void make_truncated_value_warning(THD *thd,
Sql_condition::enum_warning_level level,
const ErrConv *str_val,
timestamp_type time_type,
const TABLE_SHARE *s, const char *field_name);
const char *db_name, const char *table_name,
const char *field_name);
static inline void make_truncated_value_warning(THD *thd,
Sql_condition::enum_warning_level level, const char *str_val,
size_t str_length, timestamp_type time_type,
const TABLE_SHARE *s, const char *field_name)
const char *db_name, const char *table_name,
const char *field_name)
{
const ErrConvString str(str_val, str_length, &my_charset_bin);
make_truncated_value_warning(thd, level, &str, time_type, s, field_name);
make_truncated_value_warning(thd, level, &str, time_type, db_name, table_name,
field_name);
}
extern DATE_TIME_FORMAT *date_time_format_make(timestamp_type format_type,

View File

@ -49,6 +49,17 @@
#define MYSQL57_GENERATED_FIELD 128
#define MYSQL57_GCOL_HEADER_SIZE 4
class Table_arena: public Query_arena
{
public:
Table_arena(MEM_ROOT *mem_root, enum enum_state state_arg) :
Query_arena(mem_root, state_arg){}
virtual Type type() const
{
return TABLE_ARENA;
}
};
static Virtual_column_info * unpack_vcol_info_from_frm(THD *, MEM_ROOT *,
TABLE *, String *, Virtual_column_info **, bool *);
static bool check_vcol_forward_refs(Field *, Virtual_column_info *,
@ -1030,8 +1041,9 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
We need to use CONVENTIONAL_EXECUTION here to ensure that
any new items created by fix_fields() are not reverted.
*/
table->expr_arena= new (alloc_root(mem_root, sizeof(Query_arena)))
Query_arena(mem_root, Query_arena::STMT_CONVENTIONAL_EXECUTION);
table->expr_arena= new (alloc_root(mem_root, sizeof(Table_arena)))
Table_arena(mem_root,
Query_arena::STMT_CONVENTIONAL_EXECUTION);
if (!table->expr_arena)
DBUG_RETURN(1);

View File

@ -1,7 +1,7 @@
#ifndef TABLE_INCLUDED
#define TABLE_INCLUDED
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2019, MariaDB
Copyright (c) 2009, 2020, MariaDB
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
@ -1599,6 +1599,7 @@ public:
TABLE *tmp_table,
TMP_TABLE_PARAM *tmp_table_param,
bool with_cleanup);
int fix_vcol_exprs(THD *thd);
Field *find_field_by_name(LEX_CSTRING *str) const;
bool export_structure(THD *thd, class Row_definition_list *defs);
bool is_splittable() { return spl_opt_info != NULL; }

View File

@ -5051,11 +5051,14 @@ loop:
mtr_release_block_at_savepoint(
&mtr, savepoint, right_block);
if (parent_right_page_no != FIL_NULL) {
btr_block_get(
page_id_t(index->table->space_id,
page_id_t(index->table
->space_id,
parent_right_page_no),
table_page_size,
RW_SX_LATCH, index, &mtr);
}
right_block = btr_block_get(
page_id_t(index->table->space_id,

View File

@ -638,6 +638,7 @@ btr_cur_optimistic_latch_leaves(
{
ulint mode;
ulint left_page_no;
ulint curr_page_no;
switch (*latch_mode) {
case BTR_SEARCH_LEAF:
@ -664,17 +665,33 @@ btr_cur_optimistic_latch_leaves(
goto unpin_failed;
}
curr_page_no = block->page.id.page_no();
left_page_no = btr_page_get_prev(
buf_block_get_frame(block));
rw_lock_s_unlock(&block->lock);
if (left_page_no != FIL_NULL) {
cursor->left_block = btr_block_get(
dberr_t err = DB_SUCCESS;
cursor->left_block = buf_page_get_gen(
page_id_t(cursor->index->table->space_id,
left_page_no),
page_size_t(cursor->index->table->space
->flags),
mode, cursor->index, mtr);
mode, NULL, BUF_GET_POSSIBLY_FREED,
__FILE__, __LINE__, mtr, &err);
if (err == DB_DECRYPTION_FAILED) {
cursor->index->table->file_unreadable = true;
}
if (btr_page_get_next(cursor->left_block->frame)
!= curr_page_no) {
/* release the left block */
btr_leaf_page_release(
cursor->left_block, mode, mtr);
goto unpin_failed;
}
} else {
cursor->left_block = NULL;
}

View File

@ -1149,26 +1149,6 @@ retry:
ut_ad(block->page.id.space() == index->table->space_id);
ut_a(index_id == index->id);
ut_ad(!dict_index_is_ibuf(index));
#ifdef UNIV_DEBUG
switch (dict_index_get_online_status(index)) {
case ONLINE_INDEX_CREATION:
/* The index is being created (bulk loaded). */
case ONLINE_INDEX_COMPLETE:
/* The index has been published. */
case ONLINE_INDEX_ABORTED:
/* Either the index creation was aborted due to an
error observed by InnoDB (in which case there should
not be any adaptive hash index entries), or it was
completed and then flagged aborted in
rollback_inplace_alter_table(). */
break;
case ONLINE_INDEX_ABORTED_DROPPED:
/* The index should have been dropped from the tablespace
already, and the adaptive hash index entries should have
been dropped as well. */
ut_error;
}
#endif /* UNIV_DEBUG */
n_fields = block->curr_n_fields;
n_bytes = block->curr_n_bytes;

View File

@ -5646,15 +5646,30 @@ buf_page_create(
&& !buf_pool_watch_is_sentinel(buf_pool, &block->page)) {
ut_d(block->page.file_page_was_freed = FALSE);
#ifdef BTR_CUR_HASH_ADAPT
bool drop_hash_entry =
(block->page.state == BUF_BLOCK_FILE_PAGE
&& block->index);
if (drop_hash_entry) {
mutex_enter(&block->mutex);
buf_page_set_sticky(&block->page);
mutex_exit(&block->mutex);
}
#endif
/* Page can be found in buf_pool */
buf_pool_mutex_exit(buf_pool);
rw_lock_x_unlock(hash_lock);
buf_block_free(free_block);
#ifdef BTR_CUR_HASH_ADAPT
if (block->page.state == BUF_BLOCK_FILE_PAGE
&& UNIV_LIKELY_NULL(block->index)) {
if (drop_hash_entry) {
btr_search_drop_page_hash_index(block);
buf_pool_mutex_enter(buf_pool);
mutex_enter(&block->mutex);
buf_page_unset_sticky(&block->page);
mutex_exit(&block->mutex);
buf_pool_mutex_exit(buf_pool);
}
#endif /* BTR_CUR_HASH_ADAPT */

View File

@ -3116,7 +3116,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(void*)
/* The page_cleaner skips sleep if the server is
idle and there are no pending IOs in the buffer pool
and there is work to do. */
if (srv_check_activity(last_activity)
if (srv_check_activity(&last_activity)
|| buf_get_n_pending_read_ios()
|| n_flushed == 0) {
@ -3208,7 +3208,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(void*)
n_flushed = n_flushed_lru + n_flushed_list;
} else if (srv_check_activity(last_activity)) {
} else if (srv_check_activity(&last_activity)) {
ulint n_to_flush;
lsn_t lsn_limit = 0;

View File

@ -5705,6 +5705,7 @@ dict_set_corrupted_index_cache_only(
is corrupted */
if (dict_index_is_clust(index)) {
index->table->corrupted = TRUE;
index->table->file_unreadable = true;
}
index->type |= DICT_CORRUPT;

View File

@ -447,14 +447,6 @@ TYPELIB innodb_flush_method_typelib = {
NULL
};
/* The following counter is used to convey information to InnoDB
about server activity: in case of normal DML ops it is not
sensible to call srv_active_wake_master_thread after each
operation, we only do it every INNOBASE_WAKE_INTERVAL'th step. */
#define INNOBASE_WAKE_INTERVAL 32
static ulong innobase_active_counter = 0;
/** Allowed values of innodb_change_buffering */
static const char* innodb_change_buffering_names[] = {
"none", /* IBUF_USE_NONE */
@ -1851,23 +1843,6 @@ thd_to_trx_id(
}
#endif /* WITH_WSREP */
/********************************************************************//**
Increments innobase_active_counter and every INNOBASE_WAKE_INTERVALth
time calls srv_active_wake_master_thread. This function should be used
when a single database operation may introduce a small need for
server utility activity, like checkpointing. */
inline
void
innobase_active_small(void)
/*=======================*/
{
innobase_active_counter++;
if ((innobase_active_counter % INNOBASE_WAKE_INTERVAL) == 0) {
srv_active_wake_master_thread();
}
}
/********************************************************************//**
Converts an InnoDB error code to a MySQL error code and also tells to MySQL
about a possible transaction rollback inside InnoDB caused by a lock wait
@ -6490,11 +6465,6 @@ ha_innobase::close()
MONITOR_INC(MONITOR_TABLE_CLOSE);
/* Tell InnoDB server that there might be work for
utility threads: */
srv_active_wake_master_thread();
DBUG_RETURN(0);
}
@ -8205,8 +8175,6 @@ report_error:
}
func_exit:
innobase_active_small();
DBUG_RETURN(error_result);
}
@ -8893,11 +8861,6 @@ func_exit:
error, m_prebuilt->table->flags, m_user_thd);
}
/* Tell InnoDB server that there might be work for
utility threads: */
innobase_active_small();
#ifdef WITH_WSREP
if (error == DB_SUCCESS && trx->is_wsrep() &&
wsrep_thd_exec_mode(m_user_thd) == LOCAL_STATE &&
@ -8956,11 +8919,6 @@ ha_innobase::delete_row(
innobase_srv_conc_exit_innodb(m_prebuilt);
/* Tell the InnoDB server that there might be work for
utility threads: */
innobase_active_small();
#ifdef WITH_WSREP
if (error == DB_SUCCESS && trx->is_wsrep()
&& wsrep_thd_exec_mode(m_user_thd) == LOCAL_STATE
@ -12748,7 +12706,6 @@ create_table_info_t::create_table_update_dict()
if (m_flags2 & DICT_TF2_FTS) {
if (!innobase_fts_load_stopword(innobase_table, NULL, m_thd)) {
dict_table_close(innobase_table, FALSE, FALSE);
srv_active_wake_master_thread();
trx_free(m_trx);
DBUG_RETURN(-1);
}
@ -12898,11 +12855,6 @@ ha_innobase::create(
error = info.create_table_update_dict();
/* Tell the InnoDB server that there might be work for
utility threads: */
srv_active_wake_master_thread();
DBUG_RETURN(error);
}

View File

@ -9791,11 +9791,6 @@ foreign_fail:
log_append_on_checkpoint(NULL);
/* Tell the InnoDB server that there might be work for
utility threads: */
srv_active_wake_master_thread();
if (fail) {
for (inplace_alter_handler_ctx** pctx = ctx_array;
*pctx; pctx++) {

View File

@ -788,19 +788,6 @@ srv_reset_io_thread_op_info();
/** Wake up the purge threads if there is work to do. */
void
srv_wake_purge_thread_if_not_active();
/** Wake up the InnoDB master thread if it was suspended (not sleeping). */
void
srv_active_wake_master_thread_low();
#define srv_active_wake_master_thread() \
do { \
if (!srv_read_only_mode) { \
srv_active_wake_master_thread_low(); \
} \
} while (0)
/** Wake up the master thread if it is suspended or being suspended. */
void
srv_wake_master_thread();
/******************************************************************//**
Outputs to a file the output of the InnoDB Monitor.
@ -829,13 +816,13 @@ reading this value as it is only used in heuristics.
ulint
srv_get_activity_count(void);
/*========================*/
/*******************************************************************//**
Check if there has been any activity.
/** Check if there has been any activity.
@param[in,out] activity_count recent activity count to be returned
if there is a change
@return FALSE if no change in activity counter. */
ibool
srv_check_activity(
/*===============*/
ulint old_activity_count); /*!< old activity count */
bool srv_check_activity(ulint *activity_count);
/******************************************************************//**
Increment the server activity counter. */
void

View File

@ -1719,6 +1719,9 @@ wait_suspend_loop:
"Waiting for page cleaner");
ib::info() << "Waiting for page_cleaner to "
"finish flushing of buffer pool";
/* This is a workaround to avoid the InnoDB hang
when OS datetime changed backwards */
os_event_set(buf_flush_event);
count = 0;
}
}

View File

@ -2876,8 +2876,9 @@ loop:
if (lsn == checkpoint_lsn) {
if (recv_sys->mlog_checkpoint_lsn) {
ut_ad(recv_sys->mlog_checkpoint_lsn
<= recv_sys->recovered_lsn);
/* There can be multiple
MLOG_CHECKPOINT lsn for the
same checkpoint. */
break;
}
recv_sys->mlog_checkpoint_lsn

View File

@ -3817,7 +3817,7 @@ funct_exit_all_freed:
trx->op_info = "";
srv_wake_master_thread();
srv_inc_activity_count();
DBUG_RETURN(err);
}

View File

@ -93,7 +93,7 @@ row_vers_impl_x_locked_low(
trx_id_t trx_id;
rec_t* prev_version = NULL;
rec_offs clust_offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* clust_offsets = clust_offsets_;
rec_offs* clust_offsets;
mem_heap_t* heap;
dtuple_t* ientry = NULL;
mem_heap_t* v_heap = NULL;
@ -115,7 +115,7 @@ row_vers_impl_x_locked_low(
heap = mem_heap_create(1024);
clust_offsets = rec_get_offsets(clust_rec, clust_index, clust_offsets,
clust_offsets = rec_get_offsets(clust_rec, clust_index, clust_offsets_,
true, ULINT_UNDEFINED, &heap);
trx_id = row_get_rec_trx_id(clust_rec, clust_index, clust_offsets);
@ -204,7 +204,7 @@ row_vers_impl_x_locked_low(
ut_ad(committed || prev_version
|| !rec_get_deleted_flag(version, comp));
/* Free version. */
/* Free version and clust_offsets. */
mem_heap_free(old_heap);
if (committed) {
@ -239,7 +239,7 @@ not_locked:
}
clust_offsets = rec_get_offsets(
prev_version, clust_index, clust_offsets, true,
prev_version, clust_index, clust_offsets_, true,
ULINT_UNDEFINED, &heap);
vers_del = rec_get_deleted_flag(prev_version, comp);

View File

@ -1923,33 +1923,6 @@ srv_get_active_thread_type(void)
return(ret);
}
/** Wake up the InnoDB master thread if it was suspended (not sleeping). */
void
srv_active_wake_master_thread_low()
{
ut_ad(!srv_read_only_mode);
ut_ad(!srv_sys_mutex_own());
srv_inc_activity_count();
if (my_atomic_loadlint(&srv_sys.n_threads_active[SRV_MASTER]) == 0) {
srv_slot_t* slot;
srv_sys_mutex_enter();
slot = &srv_sys.sys_threads[SRV_MASTER_SLOT];
/* Only if the master thread has been started. */
if (slot->in_use) {
ut_a(srv_slot_get_type(slot) == SRV_MASTER);
os_event_set(slot->event);
}
srv_sys_mutex_exit();
}
}
/** Wake up the purge threads if there is work to do. */
void
srv_wake_purge_thread_if_not_active()
@ -1964,14 +1937,6 @@ srv_wake_purge_thread_if_not_active()
}
}
/** Wake up the master thread if it is suspended or being suspended. */
void
srv_wake_master_thread()
{
srv_inc_activity_count();
srv_release_threads(SRV_MASTER, 1);
}
/*******************************************************************//**
Get current server activity count. We don't hold srv_sys::mutex while
reading this value as it is only used in heuristics.
@ -1983,15 +1948,20 @@ srv_get_activity_count(void)
return(srv_sys.activity_count);
}
/*******************************************************************//**
Check if there has been any activity.
/** Check if there has been any activity.
@param[in,out] activity_count recent activity count to be returned
if there is a change
@return FALSE if no change in activity counter. */
ibool
srv_check_activity(
/*===============*/
ulint old_activity_count) /*!< in: old activity count */
bool srv_check_activity(ulint *activity_count)
{
return(srv_sys.activity_count != old_activity_count);
ulint new_activity_count= srv_sys.activity_count;
if (new_activity_count != *activity_count)
{
*activity_count= new_activity_count;
return true;
}
return false;
}
/********************************************************************//**
@ -2300,6 +2270,10 @@ srv_master_do_idle_tasks(void)
log_checkpoint(true);
MONITOR_INC_TIME_IN_MICRO_SECS(MONITOR_SRV_CHECKPOINT_MICROSECOND,
counter_time);
/* This is a workaround to avoid the InnoDB hang when OS datetime
changed backwards.*/
os_event_set(buf_flush_event);
}
/** Perform shutdown tasks.
@ -2388,48 +2362,30 @@ DECLARE_THREAD(srv_master_thread)(
slot = srv_reserve_slot(SRV_MASTER);
ut_a(slot == srv_sys.sys_threads);
loop:
while (srv_shutdown_state <= SRV_SHUTDOWN_INITIATED) {
srv_master_sleep();
MONITOR_INC(MONITOR_MASTER_THREAD_SLEEP);
if (srv_check_activity(old_activity_count)) {
old_activity_count = srv_get_activity_count();
if (srv_check_activity(&old_activity_count)) {
srv_master_do_active_tasks();
} else {
srv_master_do_idle_tasks();
}
}
switch (srv_shutdown_state) {
case SRV_SHUTDOWN_NONE:
case SRV_SHUTDOWN_INITIATED:
break;
case SRV_SHUTDOWN_FLUSH_PHASE:
case SRV_SHUTDOWN_LAST_PHASE:
ut_ad(0);
/* fall through */
case SRV_SHUTDOWN_EXIT_THREADS:
/* srv_init_abort() must have been invoked */
case SRV_SHUTDOWN_CLEANUP:
ut_ad(srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS
|| srv_shutdown_state == SRV_SHUTDOWN_CLEANUP);
if (srv_shutdown_state == SRV_SHUTDOWN_CLEANUP
&& srv_fast_shutdown < 2) {
srv_shutdown(srv_fast_shutdown == 0);
}
srv_suspend_thread(slot);
my_thread_end();
os_thread_exit();
}
srv_main_thread_op_info = "suspending";
srv_suspend_thread(slot);
srv_main_thread_op_info = "waiting for server activity";
srv_resume_thread(slot);
goto loop;
OS_THREAD_DUMMY_RETURN;
}
/** @return whether purge should exit due to shutdown */
@ -2597,15 +2553,13 @@ static ulint srv_do_purge(ulint* n_total_purged
++n_use_threads;
}
} else if (srv_check_activity(old_activity_count)
} else if (srv_check_activity(&old_activity_count)
&& n_use_threads > 1) {
/* History length same or smaller since last snapshot,
use fewer threads. */
--n_use_threads;
old_activity_count = srv_get_activity_count();
}
/* Ensure that the purge threads are less than what

View File

@ -1178,7 +1178,7 @@ srv_shutdown_all_bg_threads()
if (srv_start_state_is_set(SRV_START_STATE_MASTER)) {
/* c. We wake the master thread so that
it exits */
srv_wake_master_thread();
srv_inc_activity_count();
}
if (srv_start_state_is_set(SRV_START_STATE_PURGE)) {
@ -2526,7 +2526,7 @@ void srv_shutdown_bg_undo_sources()
fts_optimize_shutdown();
dict_stats_shutdown();
while (row_get_background_drop_list_len_low()) {
srv_wake_master_thread();
srv_inc_activity_count();
os_thread_yield();
}
srv_undo_sources = false;

View File

@ -66,7 +66,7 @@ static bool trx_rollback_finish(trx_t* trx)
trx_commit(trx);
} else {
ut_a(trx->error_state == DB_INTERRUPTED);
ut_ad(!srv_is_being_started);
ut_ad(srv_shutdown_state != SRV_SHUTDOWN_NONE);
ut_a(!srv_undo_sources);
ut_ad(srv_fast_shutdown);
ut_d(trx->in_rollback = false);
@ -164,9 +164,6 @@ trx_rollback_to_savepoint_low(
mem_heap_free(heap);
/* There might be work for utility threads.*/
srv_active_wake_master_thread();
MONITOR_DEC(MONITOR_TRX_ACTIVE);
}
@ -801,7 +798,8 @@ void trx_rollback_recovered(bool all)
ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE));
ut_d(trx_mutex_exit(trx));
if (!srv_is_being_started && !srv_undo_sources && srv_fast_shutdown)
if (srv_shutdown_state != SRV_SHUTDOWN_NONE && !srv_undo_sources &&
srv_fast_shutdown)
goto discard;
if (all || trx_get_dict_operation(trx) != TRX_DICT_OP_NONE)

View File

@ -1470,12 +1470,6 @@ trx_commit_in_memory(
}
trx->commit_lsn = lsn;
/* Tell server some activity has happened, since the trx
does changes something. Background utility threads like
master thread, purge thread or page_cleaner thread might
have some work to do. */
srv_active_wake_master_thread();
}
ut_ad(!trx->rsegs.m_noredo.undo);

View File

@ -112,9 +112,15 @@ SET(ROCKSDB_SE_SOURCES
# This is a strong requirement coming from RocksDB. No conditional checks here.
#ADD_DEFINITIONS(-DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX
#)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
SET(ATOMIC_EXTRA_LIBS -latomic)
else()
SET(ATOMIC_EXTRA_LIBS)
endif()
MYSQL_ADD_PLUGIN(rocksdb ${ROCKSDB_SE_SOURCES} MODULE_ONLY STORAGE_ENGINE
MODULE_OUTPUT_NAME ha_rocksdb
LINK_LIBRARIES ${ATOMIC_EXTRA_LIBS}
COMPONENT rocksdb-engine)
IF(NOT TARGET rocksdb)
@ -165,6 +171,7 @@ TARGET_LINK_LIBRARIES(rocksdb_aux_lib rocksdblib ${ZLIB_LIBRARY})
if (UNIX AND NOT APPLE)
TARGET_LINK_LIBRARIES(rocksdb_aux_lib -lrt)
endif()
TARGET_LINK_LIBRARIES(rocksdb_aux_lib ${ATOMIC_EXTRA_LIBS})
# IF (WITH_JEMALLOC)
# FIND_LIBRARY(JEMALLOC_LIBRARY

View File

@ -18,17 +18,16 @@ if(WIN32)
# include(${ROCKSDB_SOURCE_DIR}/thirdparty.inc)
else()
option(WITH_ROCKSDB_JEMALLOC "build RocksDB with JeMalloc" OFF)
if(WITH_ROCKSDB_JEMALLOC)
find_package(JeMalloc REQUIRED)
add_definitions(-DROCKSDB_JEMALLOC)
ADD_DEFINITIONS(-DROCKSDB_MALLOC_USABLE_SIZE)
include_directories(${JEMALLOC_INCLUDE_DIR})
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
# FreeBSD has jemaloc as default malloc
add_definitions(-DROCKSDB_JEMALLOC)
ADD_DEFINITIONS(-DROCKSDB_MALLOC_USABLE_SIZE)
set(WITH_JEMALLOC ON)
elseif(WITH_ROCKSDB_JEMALLOC)
find_package(JeMalloc REQUIRED)
add_definitions(-DROCKSDB_JEMALLOC)
ADD_DEFINITIONS(-DROCKSDB_MALLOC_USABLE_SIZE)
include_directories(${JEMALLOC_INCLUDE_DIR})
endif()
endif()
@ -127,6 +126,10 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
ADD_DEFINITIONS(-DHAVE_POWER8 -DHAS_ALTIVEC)
endif(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
set(SYSTEM_LIBS ${SYSTEM_LIBS} -latomic)
endif()
option(WITH_FALLOCATE "build with fallocate" ON)
if(WITH_FALLOCATE AND UNIX)
@ -437,6 +440,17 @@ else()
util/crc32c_ppc.c
util/crc32c_ppc_asm.S)
endif(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
# aarch
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
INCLUDE(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-march=armv8-a+crc+crypto" HAS_ARMV8_CRC)
if(HAS_ARMV8_CRC)
message(STATUS " HAS_ARMV8_CRC yes")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv8-a+crc+crypto -Wno-unused-function")
list(APPEND ROCKSDB_SOURCES
util/crc32c_arm64.cc)
endif(HAS_ARMV8_CRC)
endif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
endif()
SET(SOURCES)
FOREACH(s ${ROCKSDB_SOURCES})

View File

@ -30,7 +30,7 @@ $MYSQL_SLAP --silent --delimiter=";" --query="select * from a1 where b=1" --conc
wait
EOF
--exec bash $MYSQL_TMP_DIR/concurrent_alter.sh
--exec sh $MYSQL_TMP_DIR/concurrent_alter.sh
let $server_charset=`select @@character_set_server`;
--replace_result $server_charset DEFAULT_CHARSET