Skip to content

Commit

Permalink
Merge pull request #3 from VarunNagaraju/post-EOL-3
Browse files Browse the repository at this point in the history
PS-9301 Backport bug fixes from MySQL 8.0.38
  • Loading branch information
VarunNagaraju authored Aug 5, 2024
2 parents 2aaaef6 + 4ae1afa commit 110e85c
Show file tree
Hide file tree
Showing 29 changed files with 8,606 additions and 108 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MYSQL_VERSION_MAJOR=5
MYSQL_VERSION_MINOR=7
MYSQL_VERSION_PATCH=44
MYSQL_VERSION_EXTRA=-post-eol-2
MYSQL_VERSION_EXTRA=-post-eol-3
9 changes: 9 additions & 0 deletions include/mysql/psi/mysql_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -1329,6 +1329,15 @@ static inline void mysql_thread_set_peer_port(uint port MY_ATTRIBUTE ((unused)))

#endif

static inline void mysql_thread_set_info(
const char *str MY_ATTRIBUTE ((unused)),
int len MY_ATTRIBUTE ((unused)))
{
#ifdef HAVE_PSI_THREAD_INTERFACE
PSI_THREAD_CALL(set_thread_info)(str, len);
#endif
}

#endif /* DISABLE_MYSQL_THREAD_H */

/** @} (end of group Thread_instrumentation) */
Expand Down
7,161 changes: 7,161 additions & 0 deletions mysql-test/std_data/lob/frankenstein.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
# Install connection_control plugin
INSTALL PLUGIN connection_control SONAME 'CONNECTION_CONTROL_LIB';
INSTALL PLUGIN connection_control_failed_login_attempts SONAME 'CONNECTION_CONTROL_LIB';
# Performance schema
# Verify the instrumentation provided
SELECT * FROM performance_schema.setup_instruments
WHERE NAME LIKE "%/conn_delay/%"
ORDER BY NAME;
NAME ENABLED TIMED
stage/conn_delay/Waiting in connection_control plugin YES YES
wait/synch/cond/conn_delay/connection_delay_wait_condition YES YES
wait/synch/mutex/conn_delay/connection_delay_mutex YES YES
wait/synch/rwlock/conn_delay/connection_event_delay_lock YES YES
# Create user accounts for testing
CREATE USER u1@localhost IDENTIFIED BY 'abcd';
CREATE USER u2@localhost IDENTIFIED BY 'abcd';
Expand Down
22 changes: 22 additions & 0 deletions mysql-test/suite/connection_control/r/performance_schema.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Setup
INSTALL PLUGIN connection_control SONAME 'CONNECTION_CONTROL_LIB';
INSTALL PLUGIN connection_control_failed_login_attempts SONAME 'CONNECTION_CONTROL_LIB';
SET @@global.connection_control_failed_connections_threshold = 1;
SET @@global.connection_control_min_connection_delay = 1230;
SET @@global.connection_control_max_connection_delay = 1230;
# Not delayed connection
connect(localhost,u,,test,SOURCE_PORT,SOURCE_SOCKET);
ERROR 28000: Access denied for user 'u'@'localhost' (using password: NO)
# Delayed connection
connect(localhost,u,,test,SOURCE_PORT,SOURCE_SOCKET);
ERROR 28000: Access denied for user 'u'@'localhost' (using password: NO)
# The stage event should be in the history, the timer wait must be slightly bigger
# than configured connection delay, assume not more than 1/10 sec is good approximation,
# so the below must be 0
SELECT FLOOR((TIMER_WAIT/100000000000 - @@connection_control_min_connection_delay/100)) from performance_schema.events_stages_history_long WHERE EVENT_NAME LIKE 'stage/conn_delay/Waiting in connection_control plugin';
FLOOR((TIMER_WAIT/100000000000 - @@connection_control_min_connection_delay/100))
0
# Cleanup
# Uninstall connection_control plugin
UNINSTALL PLUGIN connection_control;
UNINSTALL PLUGIN connection_control_failed_login_attempts;
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
--echo # Install connection_control plugin
--source ../inc/install_connection_control_plugin.inc

--echo # Performance schema
--echo # Verify the instrumentation provided

SELECT * FROM performance_schema.setup_instruments
WHERE NAME LIKE "%/conn_delay/%"
ORDER BY NAME;

--echo # Create user accounts for testing
CREATE USER u1@localhost IDENTIFIED BY 'abcd';
CREATE USER u2@localhost IDENTIFIED BY 'abcd';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
$CONNECTION_CONTROL_PLUGIN_OPT

--performance-schema-instrument='stage/conn_delay/%=ON'
--performance-schema-consumer-events-stages-current=ON
--performance-schema-consumer-events-stages-history=ON
--performance-schema-consumer-events-stages-history-long=ON
--loose-debug='+d,delay_after_connection_delay'
40 changes: 40 additions & 0 deletions mysql-test/suite/connection_control/t/performance_schema.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This test checks if when connection delay occurs the stage event
# 'stage/conn_delay/Waiting in connection_control plugin'
# lasts around @@global.connection_control_min_connection_delay,
# so the user may get proper monitoring data.

# The test will work only in debug mode
--source include/have_debug.inc

# Make sure that connection_control plugin can be loaded
--source ../inc/have_connection_control_plugin.inc

--echo # Setup
--source ../inc/install_connection_control_plugin.inc

# set connection_control variables
SET @@global.connection_control_failed_connections_threshold = 1;
SET @@global.connection_control_min_connection_delay = 1230;
SET @@global.connection_control_max_connection_delay = 1230;

# We don't need to use client side authentication plugin for this test.
let $USE_AUTH_PLUGIN= 0;

--echo # Not delayed connection
--replace_result $MASTER_MYSOCK SOURCE_SOCKET $MASTER_MYPORT SOURCE_PORT
--error ER_ACCESS_DENIED_ERROR
connect(fail_con, localhost, u,,,,,);

--echo # Delayed connection
--replace_result $MASTER_MYSOCK SOURCE_SOCKET $MASTER_MYPORT SOURCE_PORT
--error ER_ACCESS_DENIED_ERROR
connect(fail_con, localhost, u,,,,,);

--echo # The stage event should be in the history, the timer wait must be slightly bigger
--echo # than configured connection delay, assume not more than 1/10 sec is good approximation,
--echo # so the below must be 0
SELECT FLOOR((TIMER_WAIT/100000000000 - @@connection_control_min_connection_delay/100)) from performance_schema.events_stages_history_long WHERE EVENT_NAME LIKE 'stage/conn_delay/Waiting in connection_control plugin';

--echo # Cleanup
--echo # Uninstall connection_control plugin
--source ../inc/uninstall_connection_control_plugin.inc
14 changes: 14 additions & 0 deletions mysql-test/suite/gis/r/spatial_index_data.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CREATE TABLE `tab` (
`id` INT AUTO_INCREMENT NOT NULL,
`shape` GEOMETRY NOT NULL /*!80003 SRID 0 */,
PRIMARY KEY (`id`),
SPATIAL KEY (`shape`)
) ENGINE=InnoDB;
INSERT INTO tab VALUES (2, POINT(1,100));
SELECT id FROM tab FORCE INDEX (primary) WHERE id > 0;
id
2
SELECT id FROM tab FORCE INDEX (shape) WHERE id > 0;
id
2
DROP TABLE tab;
13 changes: 13 additions & 0 deletions mysql-test/suite/gis/r/spatial_index_explain.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CREATE TABLE `tab` (
`id` INT AUTO_INCREMENT NOT NULL,
`shape` GEOMETRY NOT NULL /*!80003 SRID 0 */,
PRIMARY KEY (`id`),
SPATIAL KEY (`shape`)
) ENGINE=InnoDB;
INSERT INTO tab VALUES (2, POINT(1,100));
EXPLAIN SELECT id FROM tab FORCE INDEX (shape);
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE tab NULL ALL NULL NULL NULL NULL 1 100.00 NULL
Warnings:
Note 1003 /* select#1 */ select `test`.`tab`.`id` AS `id` from `test`.`tab` FORCE INDEX (`shape`)
DROP TABLE tab;
18 changes: 18 additions & 0 deletions mysql-test/suite/gis/t/spatial_index_data.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#################################################################
# TEST IF USING SPATIAL INDEX ON COLUMN RETURNS CORRECT RESULTS #
#################################################################

CREATE TABLE `tab` (
`id` INT AUTO_INCREMENT NOT NULL,
`shape` GEOMETRY NOT NULL /*!80003 SRID 0 */,
PRIMARY KEY (`id`),
SPATIAL KEY (`shape`)
) ENGINE=InnoDB;

INSERT INTO tab VALUES (2, POINT(1,100));

SELECT id FROM tab FORCE INDEX (primary) WHERE id > 0;

SELECT id FROM tab FORCE INDEX (shape) WHERE id > 0;

DROP TABLE tab;
16 changes: 16 additions & 0 deletions mysql-test/suite/gis/t/spatial_index_explain.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
###############################################################################
# TEST IF MYSQL CRASHES WHEN EXPLAINING WITH A FORCE INDEX ON A SPATIAL INDEX #
###############################################################################

CREATE TABLE `tab` (
`id` INT AUTO_INCREMENT NOT NULL,
`shape` GEOMETRY NOT NULL /*!80003 SRID 0 */,
PRIMARY KEY (`id`),
SPATIAL KEY (`shape`)
) ENGINE=InnoDB;

INSERT INTO tab VALUES (2, POINT(1,100));

EXPLAIN SELECT id FROM tab FORCE INDEX (shape);

DROP TABLE tab;
168 changes: 168 additions & 0 deletions mysql-test/suite/innodb_fts/r/optimize_big.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
SET GLOBAL innodb_optimize_fulltext_only=ON;
CREATE TABLE book (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
heading VARCHAR(20),
content TEXT,
FULLTEXT idx (content)
) ENGINE= InnoDB DEFAULT CHARSET=utf8mb4;
CREATE PROCEDURE find (word CHAR(20))
SELECT heading FROM book WHERE MATCH(content)
AGAINST (word IN NATURAL LANGUAGE MODE)
ORDER BY id;
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data/lob/frankenstein.txt' INTO TABLE book CHARACTER SET utf8mb4
FIELDS TERMINATED BY '#' LINES TERMINATED BY '@' (heading, content);
CALL find('they');
heading
?Letter 1
Letter 2
Letter 4
Chapter 1
Chapter 2
Chapter 3
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Chapter 13
Chapter 14
Chapter 15
Chapter 16
Chapter 17
Chapter 18
Chapter 19
Chapter 20
Chapter 21
Chapter 22
Chapter 23
Chapter 24
CALL find('wretched');
heading
Letter 4
Chapter 5
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Chapter 15
Chapter 20
Chapter 21
Chapter 24
CALL find('mariner');
heading
Letter 2
Chapter 5
SET GLOBAL innodb_ft_aux_table="test/book";
OPTIMIZE TABLE book;
Table Op Msg_type Msg_text
test.book optimize status OK
CALL find('they');
heading
?Letter 1
Letter 2
Letter 4
Chapter 1
Chapter 2
Chapter 3
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Chapter 13
Chapter 14
Chapter 15
Chapter 16
Chapter 17
Chapter 18
Chapter 19
Chapter 20
Chapter 21
Chapter 22
Chapter 23
Chapter 24
CALL find('wretched');
heading
Letter 4
Chapter 5
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Chapter 15
Chapter 20
Chapter 21
Chapter 24
CALL find('mariner');
heading
Letter 2
Chapter 5
SET GLOBAL innodb_ft_aux_table="test/book";
SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
count(*)
47753
SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
count(*)
0
SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_FT_DELETED;
count(*)
0
DELETE FROM book;
CALL find('they');
heading
SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_FT_DELETED;
count(*)
28
SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
count(*)
47753
SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
count(*)
0
OPTIMIZE TABLE book;
Table Op Msg_type Msg_text
test.book optimize status OK
CALL find('they');
heading
SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_FT_DELETED;
count(*)
28
SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
count(*)
33742
SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
count(*)
0
SET GLOBAL innodb_ft_num_word_optimize=10000;
OPTIMIZE TABLE book;
Table Op Msg_type Msg_text
test.book optimize status OK
OPTIMIZE TABLE book;
Table Op Msg_type Msg_text
test.book optimize status OK
CALL find('they');
heading
SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_FT_DELETED;
count(*)
0
SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
count(*)
0
SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
count(*)
0
DROP TABLE book;
DROP PROCEDURE find;
SET GLOBAL innodb_optimize_fulltext_only=OFF;
SET GLOBAL innodb_ft_aux_table=default;
SET GLOBAL innodb_ft_num_word_optimize=default;
Loading

0 comments on commit 110e85c

Please sign in to comment.