Skip to content

Commit

Permalink
Merge branch 10.6 into 10.7
Browse files Browse the repository at this point in the history
  • Loading branch information
grooverdan committed Oct 25, 2022
2 parents c160a11 + 0f93d80 commit e80acbb
Show file tree
Hide file tree
Showing 40 changed files with 2,646 additions and 2,022 deletions.
2 changes: 1 addition & 1 deletion libmariadb
29 changes: 4 additions & 25 deletions mysql-test/main/ps_missed_cmds_bin_prot.result
Expand Up @@ -104,32 +104,11 @@ HANDLER t1 CLOSE;
DROP TABLE t1;
# Test case 10: Check that the statements 'HELP'
# is supported by prepared statements
HELP `ALTER SERVER`;
INSERT INTO mysql.help_topic VALUES (0, 'Tamagotchi', 0, 'This digital pet is not a KB article', 'no example', 'https://tamagotchi.com/');
HELP `Tamagotchi`;
name description example
ALTER SERVER Syntax
------

ALTER SERVER server_name
OPTIONS (option [, option] ...)

Description
-----------

Alters the server information for server_name, adjusting the specified options
as per the CREATE SERVER command. The corresponding fields in the
mysql.servers table are updated accordingly. This statement requires the SUPER
privilege or, from MariaDB 10.5.2, the FEDERATED ADMIN privilege.

ALTER SERVER is not written to the binary log, irrespective of the binary log
format being used. From MariaDB 10.1.13, Galera replicates the CREATE SERVER,
ALTER SERVER and DROP SERVER statements.

Examples
--------

ALTER SERVER s OPTIONS (USER 'sally');

URL: mariadb.com/kb/en/alter-server/
Tamagotchi This digital pet is not a KB article no example
DELETE FROM mysql.help_topic WHERE help_topic_id = 0;
# Test case 11: Check that the statements CREATE/ALTER/DROP PROCEDURE
# are supported by prepared statements
CREATE PROCEDURE p1() SET @a=1;
Expand Down
5 changes: 4 additions & 1 deletion mysql-test/main/ps_missed_cmds_bin_prot.test
Expand Up @@ -128,7 +128,10 @@ DROP TABLE t1;

--echo # Test case 10: Check that the statements 'HELP'
--echo # is supported by prepared statements
HELP `ALTER SERVER`;
# avoid existing articles that may get updated.
INSERT INTO mysql.help_topic VALUES (0, 'Tamagotchi', 0, 'This digital pet is not a KB article', 'no example', 'https://tamagotchi.com/');
HELP `Tamagotchi`;
DELETE FROM mysql.help_topic WHERE help_topic_id = 0;

--echo # Test case 11: Check that the statements CREATE/ALTER/DROP PROCEDURE
--echo # are supported by prepared statements
Expand Down
6 changes: 3 additions & 3 deletions mysql-test/suite/gcol/r/innodb_virtual_purge.result
Expand Up @@ -24,7 +24,7 @@ COMMIT;
UPDATE t1 SET a=1;
connection default;
InnoDB 0 transactions not purged
CHECK TABLE t1;
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
SELECT b1 FROM t1;
Expand Down Expand Up @@ -123,7 +123,7 @@ COMMIT;
disconnect con1;
connection default;
InnoDB 0 transactions not purged
CHECK TABLE t1;
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
SELECT b1 FROM t1;
Expand All @@ -134,7 +134,7 @@ SELECT * FROM t1;
a b b1 a1 a4 b3
100 10 10 100 90 100
100 10 10 100 90 100
CHECK TABLE t2;
CHECK TABLE t2 EXTENDED;
Table Op Msg_type Msg_text
test.t2 check status OK
DROP TABLE t2, t1, t0;
Expand Down
6 changes: 3 additions & 3 deletions mysql-test/suite/gcol/t/innodb_virtual_purge.test
Expand Up @@ -38,7 +38,7 @@ UPDATE t1 SET a=1;
connection default;
--source ../../innodb/include/wait_all_purged.inc

CHECK TABLE t1;
CHECK TABLE t1 EXTENDED;
SELECT b1 FROM t1;


Expand Down Expand Up @@ -123,11 +123,11 @@ disconnect con1;
connection default;
--source ../../innodb/include/wait_all_purged.inc

CHECK TABLE t1;
CHECK TABLE t1 EXTENDED;
SELECT b1 FROM t1;

SELECT * FROM t1;
CHECK TABLE t2;
CHECK TABLE t2 EXTENDED;
DROP TABLE t2, t1, t0;

CREATE TABLE t1 (a VARCHAR(30), b INT, a2 VARCHAR(30) GENERATED ALWAYS AS (a) VIRTUAL);
Expand Down
31 changes: 31 additions & 0 deletions mysql-test/suite/innodb/r/deadlock_wait_lock_race.result
@@ -0,0 +1,31 @@
connect suspend_purge,localhost,root,,;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
CREATE TABLE t (a int PRIMARY KEY, b int) engine = InnoDB;
CREATE TABLE t2 (a int PRIMARY KEY) engine = InnoDB;
INSERT INTO t VALUES (10, 10), (20, 20), (30, 30);
INSERT INTO t2 VALUES (10), (20), (30);
BEGIN;
UPDATE t2 SET a = a + 100;
SELECT * FROM t WHERE a = 20 FOR UPDATE;
a b
20 20
connect con_2,localhost,root,,;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
SET DEBUG_SYNC = 'lock_trx_handle_wait_before_unlocked_wait_lock_check SIGNAL upd_locked WAIT_FOR upd_cont';
UPDATE t SET b = 100;
connection default;
SET DEBUG_SYNC="now WAIT_FOR upd_locked";
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL upd_cont";
SELECT * FROM t WHERE a = 10 FOR UPDATE;
connection con_2;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
disconnect con_2;
connection default;
a b
10 10
SET DEBUG_SYNC = 'RESET';
DROP TABLE t;
DROP TABLE t2;
disconnect suspend_purge;
37 changes: 37 additions & 0 deletions mysql-test/suite/innodb/r/deadlock_wait_thr_race.result
@@ -0,0 +1,37 @@
connect suspend_purge,localhost,root,,;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
CREATE TABLE t (a int PRIMARY KEY, b int) engine = InnoDB;
CREATE TABLE t2 (a int PRIMARY KEY) engine = InnoDB;
INSERT INTO t VALUES (10, 10), (20, 20), (30, 30);
INSERT INTO t2 VALUES (10), (20), (30);
BEGIN;
UPDATE t2 SET a = a + 100;
SELECT * FROM t WHERE a = 20 FOR UPDATE;
a b
20 20
connect con_2,localhost,root,,;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET DEBUG_SYNC = 'lock_trx_handle_wait_enter SIGNAL upd_locked WAIT_FOR upd_cont';
SET DEBUG_SYNC = 'trx_t_release_locks_enter SIGNAL sel_cont WAIT_FOR upd_cont_2';
BEGIN;
UPDATE t SET b = 100;
connection default;
SET DEBUG_SYNC="now WAIT_FOR upd_locked";
SET DEBUG_SYNC="deadlock_report_before_lock_releasing SIGNAL upd_cont WAIT_FOR sel_cont";
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL sel_before_suspend";
SELECT * FROM t WHERE a = 10 FOR UPDATE;;
connect con_3,localhost,root,,;
SET DEBUG_SYNC="now WAIT_FOR sel_before_suspend";
SET DEBUG_SYNC="now SIGNAL upd_cont_2";
disconnect con_3;
connection con_2;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
disconnect con_2;
connection default;
a b
10 10
SET DEBUG_SYNC = 'RESET';
DROP TABLE t;
DROP TABLE t2;
disconnect suspend_purge;
10 changes: 3 additions & 7 deletions mysql-test/suite/innodb/r/trx_id_future.result
Expand Up @@ -6,13 +6,9 @@ SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
CREATE TABLE t1(a INT) row_format=redundant engine=innoDB;
INSERT INTO t1 VALUES(1);
InnoDB 0 transactions not purged
NOT FOUND /\[Warning\] InnoDB: A transaction id in a record of table `test`\.`t1` is newer than the system-wide maximum/ in mysqld.1.err
call mtr.add_suppression("\\[Warning\\] InnoDB: A transaction id in a record of table `test`\\.`t1` is newer than the system-wide maximum");
SET @save_count = @@max_error_count;
SET max_error_count = 1;
call mtr.add_suppression("\\[ERROR\\] InnoDB: We detected index corruption");
call mtr.add_suppression("Index for table 't1' is corrupt; try to repair it");
SELECT * FROM t1;
a
Warnings:
Warning 1642 InnoDB: Transaction id in a record of table `test`.`t1` is newer than system-wide maximum.
SET max_error_count = @save_count;
ERROR HY000: Index for table 't1' is corrupt; try to repair it
DROP TABLE t1;
62 changes: 62 additions & 0 deletions mysql-test/suite/innodb/t/deadlock_wait_lock_race.test
@@ -0,0 +1,62 @@
--source include/have_innodb.inc
--source include/have_debug_sync.inc
--source include/count_sessions.inc

--connect(suspend_purge,localhost,root,,)
# Purge can cause deadlock in the test, requesting page's RW_X_LATCH for trx
# ids reseting, after trx 2 acqured RW_S_LATCH and suspended in debug sync point
# lock_trx_handle_wait_enter, waiting for upd_cont signal, which must be
# emitted after the last SELECT in this test. The last SELECT will hang waiting
# for purge RW_X_LATCH releasing, and trx 2 will be rolled back by timeout.
START TRANSACTION WITH CONSISTENT SNAPSHOT;

--connection default
CREATE TABLE t (a int PRIMARY KEY, b int) engine = InnoDB;
CREATE TABLE t2 (a int PRIMARY KEY) engine = InnoDB;

INSERT INTO t VALUES (10, 10), (20, 20), (30, 30);
INSERT INTO t2 VALUES (10), (20), (30);

BEGIN; # trx 1
# The following update is necessary to increase the transaction weight, which is
# calculated as the number of locks + the number of undo records during deadlock
# report. Victim's transaction should have minimum weight. We need trx 2 to be
# choosen as victim, that's why we need to increase the current transaction
# weight.
UPDATE t2 SET a = a + 100;
SELECT * FROM t WHERE a = 20 FOR UPDATE;

--connect(con_2,localhost,root,,)
# RC is necessary to do semi-consistent read
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN; # trx 2
# The first time it will be hit on trying to lock (20,20), the second hit
# will be on (30,30).
SET DEBUG_SYNC = 'lock_trx_handle_wait_before_unlocked_wait_lock_check SIGNAL upd_locked WAIT_FOR upd_cont';
# We must not modify primary key fields to cause rr_sequential() read record
# function choosing in mysql_update(), i.e. both query_plan.using_filesort and
# query_plan.using_io_buffer must be false during init_read_record() call.
--send UPDATE t SET b = 100

--connection default
SET DEBUG_SYNC="now WAIT_FOR upd_locked";
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL upd_cont";
--send SELECT * FROM t WHERE a = 10 FOR UPDATE

--connection con_2
# If the bug is not fixed, lock_trx_handle_wait() wrongly returns DB_SUCCESS
# instead of DB_DEADLOCK, row_search_mvcc() of trx 2 behaves so as if (20,20)
# was locked. Some debug assertion must crash the server. If the bug is fixed,
# trx 2 must just be rolled back by deadlock detector.
--error ER_LOCK_DEADLOCK
--reap

--disconnect con_2

--connection default
--reap
SET DEBUG_SYNC = 'RESET';
DROP TABLE t;
DROP TABLE t2;
--disconnect suspend_purge
--source include/wait_until_count_sessions.inc
66 changes: 66 additions & 0 deletions mysql-test/suite/innodb/t/deadlock_wait_thr_race.test
@@ -0,0 +1,66 @@
--source include/have_innodb.inc
--source include/have_debug_sync.inc
--source include/count_sessions.inc

--connect(suspend_purge,localhost,root,,)
# Purge can cause deadlock in the test, requesting page's RW_X_LATCH for trx
# ids reseting, after trx 2 acqured RW_S_LATCH and suspended in debug sync point
# lock_trx_handle_wait_enter, waiting for upd_cont signal, which must be
# emitted after the last SELECT in this test. The last SELECT will hang waiting
# for purge RW_X_LATCH releasing, and trx 2 will be rolled back by timeout.
START TRANSACTION WITH CONSISTENT SNAPSHOT;

--connection default
CREATE TABLE t (a int PRIMARY KEY, b int) engine = InnoDB;
CREATE TABLE t2 (a int PRIMARY KEY) engine = InnoDB;

INSERT INTO t VALUES (10, 10), (20, 20), (30, 30);
INSERT INTO t2 VALUES (10), (20), (30);

BEGIN; # trx 1
# The following update is necessary to increase the transaction weight, which is
# calculated as the number of locks + the number of undo records during deadlock
# report. Victim's transaction should have minimum weight. We need trx 2 to be
# choosen as victim, that's why we need to increase the current transaction
# weight.
UPDATE t2 SET a = a + 100;
SELECT * FROM t WHERE a = 20 FOR UPDATE;

--connect(con_2,localhost,root,,)
# RC is necessary to do semi-consistent read
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
# It will be hit on trying to lock (20,20).
SET DEBUG_SYNC = 'lock_trx_handle_wait_enter SIGNAL upd_locked WAIT_FOR upd_cont';
SET DEBUG_SYNC = 'trx_t_release_locks_enter SIGNAL sel_cont WAIT_FOR upd_cont_2';
BEGIN; # trx 2
# We must not modify primary key fields to cause rr_sequential() read record
# function choosing in mysql_update(), i.e. both query_plan.using_filesort and
# query_plan.using_io_buffer must be false during init_read_record() call.
# The following UPDATE will be chosen as deadlock victim and rolled back.
--send UPDATE t SET b = 100

--connection default
SET DEBUG_SYNC="now WAIT_FOR upd_locked";
SET DEBUG_SYNC="deadlock_report_before_lock_releasing SIGNAL upd_cont WAIT_FOR sel_cont";
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL sel_before_suspend";
# If the bug is not fixed, the following SELECT will crash, as the above UPDATE
# will reset trx->lock.wait_thr during rollback
--send SELECT * FROM t WHERE a = 10 FOR UPDATE;

--connect(con_3,localhost,root,,)
SET DEBUG_SYNC="now WAIT_FOR sel_before_suspend";
SET DEBUG_SYNC="now SIGNAL upd_cont_2";
--disconnect con_3

--connection con_2
--error ER_LOCK_DEADLOCK
--reap
--disconnect con_2

--connection default
--reap
SET DEBUG_SYNC = 'RESET';
DROP TABLE t;
DROP TABLE t2;
--disconnect suspend_purge
--source include/wait_until_count_sessions.inc
14 changes: 3 additions & 11 deletions mysql-test/suite/innodb/t/trx_id_future.test
Expand Up @@ -57,19 +57,11 @@ syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n";
close(FILE) || die "Unable to close $file";
EOF

# Debug assertions would fail due to the injected corruption.
--let $restart_parameters= --loose-skip-debug-assert
--source include/start_mysqld.inc

let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN= \[Warning\] InnoDB: A transaction id in a record of table `test`\.`t1` is newer than the system-wide maximum;
--source include/search_pattern_in_file.inc

call mtr.add_suppression("\\[Warning\\] InnoDB: A transaction id in a record of table `test`\\.`t1` is newer than the system-wide maximum");
call mtr.add_suppression("\\[ERROR\\] InnoDB: We detected index corruption");
call mtr.add_suppression("Index for table 't1' is corrupt; try to repair it");

# A debug assertion would cause a duplicated message to be output.
SET @save_count = @@max_error_count;
SET max_error_count = 1;
--error ER_NOT_KEYFILE
SELECT * FROM t1;
SET max_error_count = @save_count;
DROP TABLE t1;
2 changes: 1 addition & 1 deletion mysys/my_addr_resolve.c
Expand Up @@ -324,7 +324,7 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc)
for the base program. This is depending on if the compilation is
done with PIE or not.
*/
addr_offset= info.dli_fbase;
addr_offset= (void*) info.dli_fbase;
#ifndef __PIE__
if (strcmp(info.dli_fname, my_progname) == 0 &&
addr_resolve((void*) my_addr_resolve, loc) == 0 &&
Expand Down

0 comments on commit e80acbb

Please sign in to comment.