1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge 10.6 into 10.7

This commit is contained in:
Marko Mäkelä
2021-07-22 11:22:09 +03:00
67 changed files with 442 additions and 378 deletions

4
debian/salsa-ci.yml vendored
View File

@@ -733,8 +733,8 @@ mariadb.org-10.2 to mariadb-10.7 upgrade:
# prepending with --defaults-file=/etc/mysql/debian.cnf is needed in upstream 5.510.3 # prepending with --defaults-file=/etc/mysql/debian.cnf is needed in upstream 5.510.3
- mysql --defaults-file=/etc/mysql/debian.cnf --skip-column-names -e "SELECT @@version, @@version_comment" - mysql --defaults-file=/etc/mysql/debian.cnf --skip-column-names -e "SELECT @@version, @@version_comment"
- echo 'SHOW DATABASES;' | mysql --defaults-file=/etc/mysql/debian.cnf - echo 'SHOW DATABASES;' | mysql --defaults-file=/etc/mysql/debian.cnf
- mysql --defaults-file=/etc/mysql/debian.cnf -e "SELECT Host,User,plugin,authentication_string FROM user;" mysql - mysql --defaults-file=/etc/mysql/debian.cnf -e "SELECT * FROM mysql.global_priv; SHOW CREATE USER root@localhost; SHOW CREATE USER 'mariadb.sys'@localhost"
- mysql --defaults-file=/etc/mysql/debian.cnf -e "SELECT * FROM plugin;" mysql - mysql --defaults-file=/etc/mysql/debian.cnf -e "SELECT * FROM mysql.plugin; SHOW PLUGINS"
- *test-install - *test-install
- service mysql status - service mysql status
- sleep 5 # Give the mysql_upgrade a bit of time to complete before querying the server - sleep 5 # Give the mysql_upgrade a bit of time to complete before querying the server

View File

@@ -94,6 +94,9 @@ FILE* log_file = NULL;
/* Enabled for log write option. */ /* Enabled for log write option. */
static bool is_log_enabled = false; static bool is_log_enabled = false;
static byte field_ref_zero_buf[UNIV_PAGE_SIZE_MAX];
const byte *field_ref_zero = field_ref_zero_buf;
#ifndef _WIN32 #ifndef _WIN32
/* advisory lock for non-window system. */ /* advisory lock for non-window system. */
struct flock lk; struct flock lk;

View File

@@ -4479,6 +4479,14 @@ fail:
goto fail; goto fail;
} }
if (auto b = aligned_malloc(UNIV_PAGE_SIZE_MAX, 4096)) {
field_ref_zero = static_cast<byte*>(
memset_aligned<4096>(b, 0, UNIV_PAGE_SIZE_MAX));
} else {
goto fail;
}
{ {
/* definition from recv_recovery_from_checkpoint_start() */ /* definition from recv_recovery_from_checkpoint_start() */
ulint max_cp_field; ulint max_cp_field;
@@ -4493,14 +4501,17 @@ reread_log_header:
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
msg("Error: cannot read redo log header"); msg("Error: cannot read redo log header");
unlock_and_fail:
mysql_mutex_unlock(&log_sys.mutex); mysql_mutex_unlock(&log_sys.mutex);
free_and_fail:
aligned_free(const_cast<byte*>(field_ref_zero));
field_ref_zero = nullptr;
goto fail; goto fail;
} }
if (log_sys.log.format == 0) { if (log_sys.log.format == 0) {
msg("Error: cannot process redo log before MariaDB 10.2.2"); msg("Error: cannot process redo log before MariaDB 10.2.2");
mysql_mutex_unlock(&log_sys.mutex); goto unlock_and_fail;
goto fail;
} }
byte* buf = log_sys.checkpoint_buf; byte* buf = log_sys.checkpoint_buf;
@@ -4521,7 +4532,7 @@ reread_log_header:
xtrabackup_init_datasinks(); xtrabackup_init_datasinks();
if (!select_history()) { if (!select_history()) {
goto fail; goto free_and_fail;
} }
/* open the log file */ /* open the log file */
@@ -4530,12 +4541,13 @@ reread_log_header:
if (dst_log_file == NULL) { if (dst_log_file == NULL) {
msg("Error: failed to open the target stream for '%s'.", msg("Error: failed to open the target stream for '%s'.",
LOG_FILE_NAME); LOG_FILE_NAME);
goto fail; goto free_and_fail;
} }
/* label it */ /* label it */
byte MY_ALIGNED(OS_FILE_LOG_BLOCK_SIZE) log_hdr_buf[LOG_FILE_HDR_SIZE]; byte* log_hdr_buf = static_cast<byte*>(
memset(log_hdr_buf, 0, sizeof log_hdr_buf); aligned_malloc(LOG_FILE_HDR_SIZE, OS_FILE_LOG_BLOCK_SIZE));
memset(log_hdr_buf, 0, LOG_FILE_HDR_SIZE);
byte *log_hdr_field = log_hdr_buf; byte *log_hdr_field = log_hdr_buf;
mach_write_to_4(LOG_HEADER_FORMAT + log_hdr_field, log_sys.log.format); mach_write_to_4(LOG_HEADER_FORMAT + log_hdr_field, log_sys.log.format);
@@ -4564,11 +4576,13 @@ reread_log_header:
log_block_calc_checksum_crc32(log_hdr_field)); log_block_calc_checksum_crc32(log_hdr_field));
/* Write log header*/ /* Write log header*/
if (ds_write(dst_log_file, log_hdr_buf, sizeof(log_hdr_buf))) { if (ds_write(dst_log_file, log_hdr_buf, LOG_FILE_HDR_SIZE)) {
msg("error: write to logfile failed"); msg("error: write to logfile failed");
goto fail; aligned_free(log_hdr_buf);
goto free_and_fail;
} }
aligned_free(log_hdr_buf);
log_copying_running = true; log_copying_running = true;
/* start io throttle */ /* start io throttle */
if(xtrabackup_throttle) { if(xtrabackup_throttle) {
@@ -4586,7 +4600,7 @@ reread_log_header:
" error %s.", ut_strerr(err)); " error %s.", ut_strerr(err));
fail_before_log_copying_thread_start: fail_before_log_copying_thread_start:
log_copying_running = false; log_copying_running = false;
goto fail; goto free_and_fail;
} }
/* copy log file by current position */ /* copy log file by current position */
@@ -4609,7 +4623,7 @@ fail_before_log_copying_thread_start:
/* FLUSH CHANGED_PAGE_BITMAPS call */ /* FLUSH CHANGED_PAGE_BITMAPS call */
if (!flush_changed_page_bitmaps()) { if (!flush_changed_page_bitmaps()) {
goto fail; goto free_and_fail;
} }
ut_a(xtrabackup_parallel > 0); ut_a(xtrabackup_parallel > 0);
@@ -4677,6 +4691,9 @@ fail_before_log_copying_thread_start:
if (opt_log_innodb_page_corruption) if (opt_log_innodb_page_corruption)
ok = corrupted_pages.print_to_file(MB_CORRUPTED_PAGES_FILE); ok = corrupted_pages.print_to_file(MB_CORRUPTED_PAGES_FILE);
aligned_free(const_cast<byte*>(field_ref_zero));
field_ref_zero = nullptr;
if (!ok) { if (!ok) {
goto fail; goto fail;
} }
@@ -4909,53 +4926,6 @@ xb_space_create_file(
return ret; return ret;
} }
/* Align the memory for file i/o if we might have O_DIRECT set */
byte* page = static_cast<byte*>(aligned_malloc(2 * srv_page_size,
srv_page_size));
memset(page, '\0', srv_page_size);
fsp_header_init_fields(page, space_id, flags);
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, space_id);
const ulint zip_size = fil_space_t::zip_size(flags);
if (!zip_size) {
buf_flush_init_for_writing(
NULL, page, NULL,
fil_space_t::full_crc32(flags));
ret = os_file_write(IORequestWrite, path, *file, page, 0,
srv_page_size);
} else {
page_zip_des_t page_zip;
page_zip_set_size(&page_zip, zip_size);
page_zip.data = page + srv_page_size;
fprintf(stderr, "zip_size = " ULINTPF "\n", zip_size);
#ifdef UNIV_DEBUG
page_zip.m_start = 0;
#endif /* UNIV_DEBUG */
page_zip.m_end = 0;
page_zip.m_nonempty = 0;
page_zip.n_blobs = 0;
buf_flush_init_for_writing(NULL, page, &page_zip, false);
ret = os_file_write(IORequestWrite, path, *file,
page_zip.data, 0, zip_size);
}
aligned_free(page);
if (ret != DB_SUCCESS) {
msg("mariabackup: could not write the first page to %s",
path);
os_file_close(*file);
os_file_delete(0, path);
return ret;
}
return TRUE; return TRUE;
} }

View File

@@ -1,3 +1,3 @@
--skip-stack-trace --skip-core-file --loose-skip-stack-trace --skip-core-file
--default-storage-engine=MyISAM --default-storage-engine=MyISAM
--loose-skip-innodb-file-per-table --loose-skip-innodb-file-per-table

View File

@@ -1126,7 +1126,7 @@ NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL NULL
NULL UNION RESULT <union11,12> ALL NULL NULL NULL NULL NULL NULL NULL UNION RESULT <union11,12> ALL NULL NULL NULL NULL NULL NULL
NULL UNION RESULT <union1,6> ALL NULL NULL NULL NULL NULL NULL NULL UNION RESULT <union1,6> ALL NULL NULL NULL NULL NULL NULL
Warnings: Warnings:
Note 1003 with cte_e as (with cte_o as (with cte_i as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1 union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1)select `cte_e1`.`a` AS `a` from `cte_e` `cte_e1` where `cte_e1`.`a` > 1 union select `cte_e2`.`a` AS `a` from `cte_e` `cte_e2` Note 1003 with cte_e as (with cte_o as (with cte_i as (/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)/* select#3 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)/* select#4 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1 union /* select#5 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1)/* select#1 */ select `cte_e1`.`a` AS `a` from `cte_e` `cte_e1` where `cte_e1`.`a` > 1 union /* select#6 */ select `cte_e2`.`a` AS `a` from `cte_e` `cte_e2`
drop table t1; drop table t1;
# #
# MDEV-13753: embedded CTE in a VIEW created in prepared statement # MDEV-13753: embedded CTE in a VIEW created in prepared statement

View File

@@ -4790,3 +4790,22 @@ a
NULL NULL
DROP TABLE t1; DROP TABLE t1;
# End of 10.3 tests # End of 10.3 tests
#
# MDEV-26108: Recursive CTE embedded into another CTE which is used twice
#
create table t1 (a int);
insert into t1 values (5), (7);
with cte_e as (
with recursive cte_r as (
select a from t1 union select a+1 as a from cte_r r where a < 10
) select * from cte_r
) select * from cte_e s1, cte_e s2 where s1.a=s2.a;
a a
5 5
7 7
6 6
8 8
9 9
10 10
drop table t1;
# End of 10.4 tests

View File

@@ -3091,3 +3091,20 @@ SELECT * FROM cte;
DROP TABLE t1; DROP TABLE t1;
--echo # End of 10.3 tests --echo # End of 10.3 tests
--echo #
--echo # MDEV-26108: Recursive CTE embedded into another CTE which is used twice
--echo #
create table t1 (a int);
insert into t1 values (5), (7);
with cte_e as (
with recursive cte_r as (
select a from t1 union select a+1 as a from cte_r r where a < 10
) select * from cte_r
) select * from cte_e s1, cte_e s2 where s1.a=s2.a;
drop table t1;
--echo # End of 10.4 tests

View File

@@ -1,7 +1,3 @@
if (`SELECT $PS_PROTOCOL != 0`)
{
--skip Test temporarily disabled for ps-protocol
}
--echo # --echo #
--echo # The following entries are meant for testing the parser, ensuring --echo # The following entries are meant for testing the parser, ensuring
--echo # the right values are passed down to the executor, for all possible --echo # the right values are passed down to the executor, for all possible

View File

@@ -1 +1 @@
--skip-stack-trace --skip-core-file --loose-skip-stack-trace --skip-core-file

View File

@@ -0,0 +1,92 @@
--- /Users/shulga/projects/mariadb/server-10.6/mysql-test/main/opt_trace.result 2021-07-21 19:17:11.000000000 +0700
+++ /Users/shulga/projects/mariadb/server-10.6/mysql-test/main/opt_trace.reject 2021-07-21 19:17:48.000000000 +0700
@@ -2829,14 +2829,6 @@
}
},
{
- "transformation": {
- "select_id": 2,
- "from": "IN (SELECT)",
- "to": "semijoin",
- "chosen": true
- }
- },
- {
"expanded_query": "/* select#2 */ select t10.pk from t10"
}
]
@@ -4402,14 +4394,6 @@
}
},
{
- "transformation": {
- "select_id": 2,
- "from": "IN (SELECT)",
- "to": "semijoin",
- "chosen": true
- }
- },
- {
"expanded_query": "/* select#2 */ select t_inner_1.a from t1 t_inner_1 join t1 t_inner_2"
}
]
@@ -4852,14 +4836,6 @@
}
},
{
- "transformation": {
- "select_id": 2,
- "from": "IN (SELECT)",
- "to": "semijoin",
- "chosen": true
- }
- },
- {
"expanded_query": "/* select#2 */ select t_inner_1.a from t2 t_inner_2 join t1 t_inner_1"
}
]
@@ -4879,14 +4855,6 @@
}
},
{
- "transformation": {
- "select_id": 3,
- "from": "IN (SELECT)",
- "to": "semijoin",
- "chosen": true
- }
- },
- {
"expanded_query": "/* select#3 */ select t_inner_3.a from t2 t_inner_3 join t1 t_inner_4"
}
]
@@ -6432,14 +6400,6 @@
}
},
{
- "transformation": {
- "select_id": 2,
- "from": "IN (SELECT)",
- "to": "semijoin",
- "chosen": true
- }
- },
- {
"expanded_query": "/* select#2 */ select t_inner_1.a from t2 t_inner_2 join t1 t_inner_1"
}
]
@@ -6459,14 +6419,6 @@
}
},
{
- "transformation": {
- "select_id": 3,
- "from": "IN (SELECT)",
- "to": "semijoin",
- "chosen": true
- }
- },
- {
"expanded_query": "/* select#3 */ select t_inner_3.a from t2 t_inner_3 join t1 t_inner_4"
}
]

View File

@@ -0,0 +1,3 @@
SELECT @@ssl_cipher;
@@ssl_cipher
ECDHE-RSA-AES256-GCM-SHA384

View File

@@ -1 +1 @@
--skip-stack-trace --log-warnings=0 --log-bin=master-bin --log-bin-index=master-bin --loose-skip-stack-trace --log-warnings=0 --log-bin=master-bin --log-bin-index=master-bin

View File

@@ -1 +1 @@
--skip-stack-trace --skip-core-file --loose-skip-stack-trace --skip-core-file

View File

@@ -1 +1 @@
--skip-stack-trace --skip-core-file --loose-debug-dbug=+d,xa_recover_expect_master_bin_000004 --loose-skip-stack-trace --skip-core-file --loose-debug-dbug=+d,xa_recover_expect_master_bin_000004

View File

@@ -252,6 +252,7 @@ AS
BEGIN BEGIN
RETURN a; RETURN a;
END; END;
$$
CREATE PROCEDURE p1() CREATE PROCEDURE p1()
AS AS
a ROW (a INT,b INT); a ROW (a INT,b INT);
@@ -268,6 +269,7 @@ AS
BEGIN BEGIN
RETURN a; RETURN a;
END; END;
$$
CREATE PROCEDURE p1() CREATE PROCEDURE p1()
AS AS
a ROW (a INT); a ROW (a INT);

View File

@@ -1,7 +1,3 @@
if (`SELECT $PS_PROTOCOL != 0`)
{
--skip Test temporarily disabled for ps-protocol
}
SET sql_mode=ORACLE; SET sql_mode=ORACLE;
@@ -329,6 +325,7 @@ AS
BEGIN BEGIN
RETURN a; RETURN a;
END; END;
$$
CREATE PROCEDURE p1() CREATE PROCEDURE p1()
AS AS
a ROW (a INT,b INT); a ROW (a INT,b INT);
@@ -349,6 +346,7 @@ AS
BEGIN BEGIN
RETURN a; RETURN a;
END; END;
$$
CREATE PROCEDURE p1() CREATE PROCEDURE p1()
AS AS
a ROW (a INT); a ROW (a INT);
@@ -866,6 +864,8 @@ DROP PROCEDURE p2;
--echo # ROW fields as SELECT..INTO targets --echo # ROW fields as SELECT..INTO targets
--echo # --echo #
--enable_prepare_warnings
DELIMITER $$; DELIMITER $$;
CREATE PROCEDURE p1 CREATE PROCEDURE p1
AS AS
@@ -879,6 +879,7 @@ DELIMITER ;$$
CALL p1; CALL p1;
DROP PROCEDURE p1; DROP PROCEDURE p1;
--disable_prepare_warnings
--echo # --echo #
--echo # Implicit default NULL handling --echo # Implicit default NULL handling
@@ -2088,6 +2089,7 @@ DROP PROCEDURE p1;
--echo # --echo #
--enable_prepare_warnings
--echo # ROW variable with a wrong column count --echo # ROW variable with a wrong column count
CREATE TABLE t1 (a INT, b VARCHAR(32)); CREATE TABLE t1 (a INT, b VARCHAR(32));
INSERT INTO t1 VALUES (10,'b10'); INSERT INTO t1 VALUES (10,'b10');
@@ -2248,7 +2250,7 @@ DELIMITER ;$$
CALL p1(); CALL p1();
DROP TABLE t1; DROP TABLE t1;
DROP PROCEDURE p1; DROP PROCEDURE p1;
--disable_prepare_warnings
--echo # --echo #
--echo # MDEV-12347 Valgrind reports invalid read errors in Item_field_row::element_index_by_name --echo # MDEV-12347 Valgrind reports invalid read errors in Item_field_row::element_index_by_name

View File

@@ -0,0 +1,6 @@
@@ -470,4 +470,4 @@
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
-33
+32

View File

@@ -1 +1 @@
--skip-stack-trace --skip-core-file --loose-skip-stack-trace --skip-core-file

View File

@@ -1 +1 @@
--binlog-optimize-thread-scheduling=0 --skip-stack-trace --skip-core-file --binlog-optimize-thread-scheduling=0 --loose-skip-stack-trace --skip-core-file

View File

@@ -1 +1 @@
--skip-stack-trace --skip-core-file --loose-skip-stack-trace --skip-core-file

View File

@@ -1 +1 @@
--binlog-optimize-thread-scheduling=0 --skip-stack-trace --skip-core-file --binlog-optimize-thread-scheduling=0 --loose-skip-stack-trace --skip-core-file

View File

@@ -1,4 +1,4 @@
--innodb_file_per_table=1 --innodb_file_per_table=1
--skip-stack-trace --loose-skip-stack-trace
--skip-core-file --skip-core-file
--loose-innodb_buffer_pool_load_at_startup=OFF --loose-innodb_buffer_pool_load_at_startup=OFF

View File

@@ -1,2 +1,2 @@
--skip-stack-trace --skip-core-file --loose-skip-stack-trace --skip-core-file
--default-storage-engine=Aria --default-storage-engine=Aria

View File

@@ -1 +1 @@
--skip-stack-trace --skip-core-file --loose-aria-log-dir-path=$MYSQLTEST_VARDIR/tmp --loose-skip-stack-trace --skip-core-file --loose-aria-log-dir-path=$MYSQLTEST_VARDIR/tmp

View File

@@ -1 +1 @@
--skip-stack-trace --skip-core-file --max_allowed_packet=32000000 --loose-skip-stack-trace --skip-core-file --max_allowed_packet=32000000

View File

@@ -1 +1 @@
--skip-stack-trace --skip-core-file --loose-skip-stack-trace --skip-core-file

View File

@@ -1 +1 @@
--skip-stack-trace --skip-core-file --loose-aria-log-dir-path=$MYSQLTEST_VARDIR/tmp --loose-skip-stack-trace --skip-core-file --loose-aria-log-dir-path=$MYSQLTEST_VARDIR/tmp

View File

@@ -1 +1 @@
--skip-stack-trace --skip-core-file --loose-skip-stack-trace --skip-core-file

View File

@@ -1 +1 @@
--skip-stack-trace --skip-core-file --loose-aria-log-dir-path=$MYSQLTEST_VARDIR/tmp --myisam-recover-options= --loose-skip-stack-trace --skip-core-file --loose-aria-log-dir-path=$MYSQLTEST_VARDIR/tmp --myisam-recover-options=

View File

@@ -1 +1 @@
--skip-stack-trace --skip-core-file --loose-aria-log-dir-path=$MYSQLTEST_VARDIR/tmp --loose-skip-stack-trace --skip-core-file --loose-aria-log-dir-path=$MYSQLTEST_VARDIR/tmp

View File

@@ -0,0 +1 @@
log_page_corruption : MDEV-26210

View File

@@ -1 +1 @@
--loose-innodb-file-per-table=1 --skip-stack-trace --skip-core-file --loose-innodb-buffer-pool-size=32M --loose-innodb-file-per-table=1 --loose-skip-stack-trace --skip-core-file --loose-innodb-buffer-pool-size=32M

View File

@@ -1 +1 @@
--skip-stack-trace --skip-core-file --myisam-recover-options=off --loose-skip-stack-trace --skip-core-file --myisam-recover-options=off

View File

@@ -1 +1 @@
--loose-innodb-file-per-table=1 --skip-stack-trace --skip-core-file --loose-innodb-buffer-pool-size=32M --loose-innodb-file-per-table=1 --loose-skip-stack-trace --skip-core-file --loose-innodb-buffer-pool-size=32M

View File

@@ -0,0 +1,53 @@
# Default values that applies to all MySQL Servers
[mysqld]
local-infile
character-set-server= latin1
default-storage-engine=myisam
# Increase default connect_timeout to avoid intermittent
# disconnects when test servers are put under load see BUG#28359
connect-timeout= 60
log-bin-trust-function-creators=1
key_buffer_size= 1M
sort_buffer_size= 256K
max_heap_table_size= 1M
loose-innodb_data_file_path= ibdata1:10M:autoextend
loose-innodb_buffer_pool_size= 8M
loose-innodb_lru_scan_depth= 100
loose-innodb_write_io_threads= 2
loose-innodb_read_io_threads= 2
loose-innodb_log_buffer_size= 1M
loose-innodb_log_file_size= 5M
loose-innodb_log_files_in_group= 2
slave-net-timeout=120
log-bin=mysqld-bin
# No performance schema sizing provided
# Disable everything, we only need the sizing data,
# and also need a stable output for show engine performance_schema status
loose-performance-schema-consumer-global-instrumentation=OFF
loose-performance-schema-instrument='%=ON'
loose-performance-schema-consumer-events-stages-current=ON
loose-performance-schema-consumer-events-stages-history=ON
loose-performance-schema-consumer-events-stages-history-long=ON
loose-performance-schema-consumer-events-statements-current=ON
loose-performance-schema-consumer-events-statements-history=ON
loose-performance-schema-consumer-events-statements-history-long=ON
loose-performance-schema-consumer-events-transactions-current=ON
loose-performance-schema-consumer-events-transactions-history=ON
loose-performance-schema-consumer-events-transactions-history-long=ON
loose-performance-schema-consumer-events-waits-current=ON
loose-performance-schema-consumer-events-waits-history=ON
loose-performance-schema-consumer-events-waits-history-long=ON
loose-performance-schema-consumer-thread-instrumentation=ON
binlog-direct-non-transactional-updates

View File

@@ -4,10 +4,7 @@
# For tests sensitive to the internal sizes (show engine performance_schema # For tests sensitive to the internal sizes (show engine performance_schema
# status), make sure we use a platform with aligned memory. # status), make sure we use a platform with aligned memory.
--disable_query_log if (`SELECT count(*)=0 from performance_schema.session_connect_attrs where PROCESSLIST_ID = connection_id() and ATTR_NAME = '_os' and ATTR_VALUE in ('Linux', 'Windows')`)
let $aligned = `SELECT count(*) from performance_schema.session_connect_attrs where PROCESSLIST_ID = connection_id() and ATTR_NAME = '_os' and ATTR_VALUE in ('Linux', 'Windows')`;
if (!$aligned)
{ {
skip Need a platform with aligned memory; skip Need a platform with aligned memory;
} }
--enable_query_log

View File

@@ -1 +1 @@
--skip-stack-trace --skip-core-file --loose-skip-stack-trace --skip-core-file

View File

@@ -1 +1 @@
--skip-stack-trace --skip-core-file --skip-innodb --loose-skip-stack-trace --skip-core-file --skip-innodb

View File

@@ -1 +1 @@
--skip-stack-trace --skip-core-file --loose-skip-stack-trace --skip-core-file

View File

@@ -2,13 +2,13 @@
#include <string.h> #include <string.h>
#include <stdint.h> #include <stdint.h>
static int pmull_supported;
#if defined(HAVE_ARMV8_CRC) #if defined(HAVE_ARMV8_CRC)
#if defined(__APPLE__) #if defined(__APPLE__)
#include <sys/sysctl.h> #include <sys/sysctl.h>
static int pmull_supported;
int crc32_aarch64_available(void) int crc32_aarch64_available(void)
{ {
int ret; int ret;
@@ -48,8 +48,6 @@ static unsigned long getauxval(unsigned int key)
# define HWCAP_PMULL (1 << 4) # define HWCAP_PMULL (1 << 4)
#endif #endif
static int pmull_supported;
/* ARM made crc32 default from ARMv8.1 but optional in ARMv8A /* ARM made crc32 default from ARMv8.1 but optional in ARMv8A
* Runtime check API. * Runtime check API.
*/ */

View File

@@ -1837,6 +1837,14 @@ public:
their method implementations typically have DBUG_ASSERT(0). their method implementations typically have DBUG_ASSERT(0).
*/ */
virtual bool is_evaluable_expression() const { return true; } virtual bool is_evaluable_expression() const { return true; }
/**
* Check whether the item is a parameter ('?') of stored routine.
* Default implementation returns false. Method is overridden in the class
* Item_param where it returns true.
*/
virtual bool is_stored_routine_parameter() const { return false; }
bool check_is_evaluable_expression_or_error() bool check_is_evaluable_expression_or_error()
{ {
if (is_evaluable_expression()) if (is_evaluable_expression())
@@ -4281,6 +4289,7 @@ public:
return state == SHORT_DATA_VALUE && return state == SHORT_DATA_VALUE &&
value.type_handler()->cmp_type() == INT_RESULT; value.type_handler()->cmp_type() == INT_RESULT;
} }
bool is_stored_routine_parameter() const override { return true; }
/* /*
This method is used to make a copy of a basic constant item when This method is used to make a copy of a basic constant item when
propagating constants in the optimizer. The reason to create a new propagating constants in the optimizer. The reason to create a new

View File

@@ -1273,10 +1273,10 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
Query_arena *arena, backup; Query_arena *arena, backup;
arena= thd->activate_stmt_arena_if_needed(&backup); arena= thd->activate_stmt_arena_if_needed(&backup);
if (!select_lex->master_unit()->is_unit_op() && auto need_to_pull_out_item = [](enum_parsing_place context_analysis_place,
!select_lex->table_list.elements && Item *item) {
select_lex->item_list.elements == 1 && return
!select_lex->item_list.head()->with_sum_func() && !item->with_sum_func() &&
/* /*
We can't change name of Item_field or Item_ref, because it will We can't change name of Item_field or Item_ref, because it will
prevent its correct resolving, but we should save name of prevent its correct resolving, but we should save name of
@@ -1284,11 +1284,26 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
list is field or reference. list is field or reference.
TODO: solve above problem TODO: solve above problem
*/ */
!(select_lex->item_list.head()->type() == FIELD_ITEM || item->type() != FIELD_ITEM && item->type() != REF_ITEM &&
select_lex->item_list.head()->type() == REF_ITEM) && /*
The item can be pulled out to upper level in case it doesn't represent
the constant in the clause 'ORDER/GROUP BY (constant)'.
*/
!((item->is_order_clause_position() ||
item->is_stored_routine_parameter()) &&
(context_analysis_place == IN_ORDER_BY ||
context_analysis_place == IN_GROUP_BY)
);
};
if (!select_lex->master_unit()->is_unit_op() &&
!select_lex->table_list.elements &&
select_lex->item_list.elements == 1 &&
!join->conds && !join->having && !join->conds && !join->having &&
thd->stmt_arena->state != Query_arena::STMT_INITIALIZED_FOR_SP need_to_pull_out_item(
) join->select_lex->outer_select()->context_analysis_place,
select_lex->item_list.head()) &&
thd->stmt_arena->state != Query_arena::STMT_INITIALIZED_FOR_SP)
{ {
have_to_be_excluded= 1; have_to_be_excluded= 1;
if (thd->lex->describe) if (thd->lex->describe)

View File

@@ -1039,6 +1039,7 @@ st_select_lex_unit *With_element::clone_parsed_spec(LEX *old_lex,
bool parse_status= false; bool parse_status= false;
st_select_lex *with_select; st_select_lex *with_select;
st_select_lex *last_clone_select;
char save_end= unparsed_spec.str[unparsed_spec.length]; char save_end= unparsed_spec.str[unparsed_spec.length];
((char*) &unparsed_spec.str[unparsed_spec.length])[0]= '\0'; ((char*) &unparsed_spec.str[unparsed_spec.length])[0]= '\0';
@@ -1125,11 +1126,14 @@ st_select_lex_unit *With_element::clone_parsed_spec(LEX *old_lex,
lex->unit.include_down(with_table->select_lex); lex->unit.include_down(with_table->select_lex);
lex->unit.set_slave(with_select); lex->unit.set_slave(with_select);
lex->unit.cloned_from= spec; lex->unit.cloned_from= spec;
last_clone_select= lex->all_selects_list;
while (last_clone_select->next_select_in_list())
last_clone_select= last_clone_select->next_select_in_list();
old_lex->all_selects_list= old_lex->all_selects_list=
(st_select_lex*) (lex->all_selects_list-> (st_select_lex*) (lex->all_selects_list->
insert_chain_before( insert_chain_before(
(st_select_lex_node **) &(old_lex->all_selects_list), (st_select_lex_node **) &(old_lex->all_selects_list),
with_select)); last_clone_select));
/* /*
Now all references to the CTE defined outside of the cloned specification Now all references to the CTE defined outside of the cloned specification

View File

@@ -1235,7 +1235,6 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables,
bool wrong_drop_sequence= 0; bool wrong_drop_sequence= 0;
bool table_dropped= 0, res; bool table_dropped= 0, res;
bool is_temporary= 0; bool is_temporary= 0;
bool was_view= 0, was_table= 0;
const LEX_CSTRING db= table->db; const LEX_CSTRING db= table->db;
const LEX_CSTRING table_name= table->table_name; const LEX_CSTRING table_name= table->table_name;
LEX_CSTRING cpath= {0,0}; LEX_CSTRING cpath= {0,0};
@@ -1392,7 +1391,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables,
} }
thd->replication_flags= 0; thd->replication_flags= 0;
was_view= table_type == TABLE_TYPE_VIEW; const bool was_view= table_type == TABLE_TYPE_VIEW;
if (!table_count++) if (!table_count++)
{ {
@@ -1414,7 +1413,6 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables,
. "DROP SEQUENCE", but it's not a sequence . "DROP SEQUENCE", but it's not a sequence
*/ */
wrong_drop_sequence= drop_sequence && hton; wrong_drop_sequence= drop_sequence && hton;
was_table|= wrong_drop_sequence;
error= table_type == TABLE_TYPE_UNKNOWN ? ENOENT : -1; error= table_type == TABLE_TYPE_UNKNOWN ? ENOENT : -1;
tdc_remove_table(thd, db.str, table_name.str); tdc_remove_table(thd, db.str, table_name.str);
if (wrong_drop_sequence) if (wrong_drop_sequence)

View File

@@ -1590,6 +1590,9 @@ int TP_pool_generic::init()
sql_print_error("Allocation failed"); sql_print_error("Allocation failed");
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
PSI_register(mutex);
PSI_register(cond);
PSI_register(thread);
scheduler_init(); scheduler_init();
threadpool_started= true; threadpool_started= true;
for (uint i= 0; i < threadpool_max_size; i++) for (uint i= 0; i < threadpool_max_size; i++)
@@ -1603,10 +1606,6 @@ int TP_pool_generic::init()
sql_print_error("Can't set threadpool size to %d",threadpool_size); sql_print_error("Can't set threadpool size to %d",threadpool_size);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
PSI_register(mutex);
PSI_register(cond);
PSI_register(thread);
pool_timer.tick_interval= threadpool_stall_limit; pool_timer.tick_interval= threadpool_stall_limit;
start_timer(&pool_timer); start_timer(&pool_timer);
DBUG_RETURN(0); DBUG_RETURN(0);

View File

@@ -318,6 +318,12 @@ constexpr ulint BUF_PAGE_READ_MAX_RETRIES= 100;
read-ahead buffer. (Divide buf_pool size by this amount) */ read-ahead buffer. (Divide buf_pool size by this amount) */
constexpr uint32_t BUF_READ_AHEAD_PORTION= 32; constexpr uint32_t BUF_READ_AHEAD_PORTION= 32;
/** A 64KiB buffer of NUL bytes, for use in assertions and checks,
and dummy default values of instantly dropped columns.
Initially, BLOB field references are set to NUL bytes, in
dtuple_convert_big_rec(). */
const byte *field_ref_zero;
/** The InnoDB buffer pool */ /** The InnoDB buffer pool */
buf_pool_t buf_pool; buf_pool_t buf_pool;
buf_pool_t::chunk_t::map *buf_pool_t::chunk_t::map_reg; buf_pool_t::chunk_t::map *buf_pool_t::chunk_t::map_reg;
@@ -571,7 +577,7 @@ static void buf_page_check_lsn(bool check_lsn, const byte* read_buf)
@return whether the buffer is all zeroes */ @return whether the buffer is all zeroes */
bool buf_is_zeroes(span<const byte> buf) bool buf_is_zeroes(span<const byte> buf)
{ {
ut_ad(buf.size() <= sizeof field_ref_zero); ut_ad(buf.size() <= UNIV_PAGE_SIZE_MAX);
return memcmp(buf.data(), field_ref_zero, buf.size()) == 0; return memcmp(buf.data(), field_ref_zero, buf.size()) == 0;
} }
@@ -1151,11 +1157,17 @@ bool buf_pool_t::create()
ut_ad(srv_buf_pool_size % srv_buf_pool_chunk_unit == 0); ut_ad(srv_buf_pool_size % srv_buf_pool_chunk_unit == 0);
ut_ad(!is_initialised()); ut_ad(!is_initialised());
ut_ad(srv_buf_pool_size > 0); ut_ad(srv_buf_pool_size > 0);
ut_ad(!resizing);
ut_ad(!chunks_old);
ut_ad(!field_ref_zero);
NUMA_MEMPOLICY_INTERLEAVE_IN_SCOPE; NUMA_MEMPOLICY_INTERLEAVE_IN_SCOPE;
ut_ad(!resizing); if (auto b= aligned_malloc(UNIV_PAGE_SIZE_MAX, 4096))
ut_ad(!chunks_old); field_ref_zero= static_cast<const byte*>
(memset_aligned<4096>(b, 0, UNIV_PAGE_SIZE_MAX));
else
return true;
chunk_t::map_reg= UT_NEW_NOKEY(chunk_t::map()); chunk_t::map_reg= UT_NEW_NOKEY(chunk_t::map());
@@ -1186,6 +1198,8 @@ bool buf_pool_t::create()
chunks= nullptr; chunks= nullptr;
UT_DELETE(chunk_t::map_reg); UT_DELETE(chunk_t::map_reg);
chunk_t::map_reg= nullptr; chunk_t::map_reg= nullptr;
aligned_free(const_cast<byte*>(field_ref_zero));
field_ref_zero= nullptr;
ut_ad(!is_initialised()); ut_ad(!is_initialised());
return true; return true;
} }
@@ -1301,6 +1315,8 @@ void buf_pool_t::close()
io_buf.close(); io_buf.close();
UT_DELETE(chunk_t::map_reg); UT_DELETE(chunk_t::map_reg);
chunk_t::map_reg= chunk_t::map_ref= nullptr; chunk_t::map_reg= chunk_t::map_ref= nullptr;
aligned_free(const_cast<byte*>(field_ref_zero));
field_ref_zero= nullptr;
} }
/** Try to reallocate a control block. /** Try to reallocate a control block.
@@ -1326,6 +1342,7 @@ inline bool buf_pool_t::realloc(buf_block_t *block)
if (block->page.can_relocate()) { if (block->page.can_relocate()) {
memcpy_aligned<OS_FILE_LOG_BLOCK_SIZE>( memcpy_aligned<OS_FILE_LOG_BLOCK_SIZE>(
new_block->frame, block->frame, srv_page_size); new_block->frame, block->frame, srv_page_size);
mysql_mutex_lock(&buf_pool.flush_list_mutex);
new (&new_block->page) buf_page_t(block->page); new (&new_block->page) buf_page_t(block->page);
/* relocate LRU list */ /* relocate LRU list */
@@ -1385,6 +1402,7 @@ inline bool buf_pool_t::realloc(buf_block_t *block)
buf_flush_relocate_on_flush_list(&block->page, buf_flush_relocate_on_flush_list(&block->page,
&new_block->page); &new_block->page);
} }
mysql_mutex_unlock(&buf_pool.flush_list_mutex);
block->page.set_corrupt_id(); block->page.set_corrupt_id();
/* set other flags of buf_block_t */ /* set other flags of buf_block_t */
@@ -2780,12 +2798,14 @@ evict_from_pool:
/* Note: this is the uncompressed block and it is not /* Note: this is the uncompressed block and it is not
accessible by other threads yet because it is not in accessible by other threads yet because it is not in
any list or hash table */ any list or hash table */
mysql_mutex_lock(&buf_pool.flush_list_mutex);
buf_relocate(bpage, &block->page); buf_relocate(bpage, &block->page);
/* Set after buf_relocate(). */ /* Set after buf_relocate(). */
block->page.set_buf_fix_count(1); block->page.set_buf_fix_count(1);
buf_flush_relocate_on_flush_list(bpage, &block->page); buf_flush_relocate_on_flush_list(bpage, &block->page);
mysql_mutex_unlock(&buf_pool.flush_list_mutex);
/* Buffer-fix, I/O-fix, and X-latch the block /* Buffer-fix, I/O-fix, and X-latch the block
for the duration of the decompression. for the duration of the decompression.
@@ -3243,8 +3263,10 @@ loop:
} }
free_block->lock.x_lock(); free_block->lock.x_lock();
mysql_mutex_lock(&buf_pool.flush_list_mutex);
buf_relocate(&block->page, &free_block->page); buf_relocate(&block->page, &free_block->page);
buf_flush_relocate_on_flush_list(&block->page, &free_block->page); buf_flush_relocate_on_flush_list(&block->page, &free_block->page);
mysql_mutex_unlock(&buf_pool.flush_list_mutex);
free_block->page.set_state(BUF_BLOCK_FILE_PAGE); free_block->page.set_state(BUF_BLOCK_FILE_PAGE);
buf_unzip_LRU_add_block(free_block, FALSE); buf_unzip_LRU_add_block(free_block, FALSE);

View File

@@ -289,25 +289,18 @@ buf_flush_relocate_on_flush_list(
{ {
buf_page_t* prev; buf_page_t* prev;
mysql_mutex_assert_owner(&buf_pool.mutex); mysql_mutex_assert_owner(&buf_pool.flush_list_mutex);
ut_ad(!fsp_is_system_temporary(bpage->id().space())); ut_ad(!fsp_is_system_temporary(bpage->id().space()));
const lsn_t lsn = bpage->oldest_modification_acquire(); const lsn_t lsn = bpage->oldest_modification();
if (!lsn) { if (!lsn) {
return; return;
} }
ut_ad(lsn == 1 || lsn > 2); ut_ad(lsn == 1 || lsn > 2);
mysql_mutex_lock(&buf_pool.flush_list_mutex);
/* FIXME: Can we avoid holding buf_pool.mutex here? */
ut_ad(dpage->oldest_modification() == lsn); ut_ad(dpage->oldest_modification() == lsn);
if (ut_d(const lsn_t o_lsn =) bpage->oldest_modification()) {
ut_ad(o_lsn == lsn);
/* Important that we adjust the hazard pointer before removing /* Important that we adjust the hazard pointer before removing
the bpage from the flush list. */ the bpage from the flush list. */
buf_pool.flush_hp.adjust(bpage); buf_pool.flush_hp.adjust(bpage);
@@ -316,16 +309,9 @@ buf_flush_relocate_on_flush_list(
UT_LIST_REMOVE(buf_pool.flush_list, bpage); UT_LIST_REMOVE(buf_pool.flush_list, bpage);
bpage->clear_oldest_modification(); bpage->clear_oldest_modification();
} else {
/* bpage was removed from buf_pool.flush_list
since we last checked, and before we acquired
buf_pool.flush_list_mutex. */
goto was_clean;
}
if (lsn == 1) { if (lsn == 1) {
buf_pool.stat.flush_list_bytes -= dpage->physical_size(); buf_pool.stat.flush_list_bytes -= dpage->physical_size();
was_clean:
dpage->list.prev = nullptr; dpage->list.prev = nullptr;
dpage->list.next = nullptr; dpage->list.next = nullptr;
dpage->clear_oldest_modification(); dpage->clear_oldest_modification();
@@ -337,7 +323,6 @@ was_clean:
} }
ut_d(buf_flush_validate_low()); ut_d(buf_flush_validate_low());
mysql_mutex_unlock(&buf_pool.flush_list_mutex);
} }
/** Complete write of a file page from buf_pool. /** Complete write of a file page from buf_pool.
@@ -1670,7 +1655,7 @@ ulint buf_flush_LRU(ulint max_n)
if (buf_pool.n_flush_LRU()) if (buf_pool.n_flush_LRU())
return 0; return 0;
log_buffer_flush_to_disk(true); log_buffer_flush_to_disk();
mysql_mutex_lock(&buf_pool.mutex); mysql_mutex_lock(&buf_pool.mutex);
if (buf_pool.n_flush_LRU_) if (buf_pool.n_flush_LRU_)

View File

@@ -845,6 +845,7 @@ func_exit:
} else if (bpage->state() == BUF_BLOCK_FILE_PAGE) { } else if (bpage->state() == BUF_BLOCK_FILE_PAGE) {
b = buf_page_alloc_descriptor(); b = buf_page_alloc_descriptor();
ut_a(b); ut_a(b);
mysql_mutex_lock(&buf_pool.flush_list_mutex);
new (b) buf_page_t(*bpage); new (b) buf_page_t(*bpage);
b->set_state(BUF_BLOCK_ZIP_PAGE); b->set_state(BUF_BLOCK_ZIP_PAGE);
} }
@@ -859,6 +860,8 @@ func_exit:
ut_ad(bpage->can_relocate()); ut_ad(bpage->can_relocate());
if (!buf_LRU_block_remove_hashed(bpage, id, hash_lock, zip)) { if (!buf_LRU_block_remove_hashed(bpage, id, hash_lock, zip)) {
ut_ad(!b);
mysql_mutex_assert_not_owner(&buf_pool.flush_list_mutex);
return(true); return(true);
} }
@@ -872,8 +875,6 @@ func_exit:
if (UNIV_LIKELY_NULL(b)) { if (UNIV_LIKELY_NULL(b)) {
buf_page_t* prev_b = UT_LIST_GET_PREV(LRU, b); buf_page_t* prev_b = UT_LIST_GET_PREV(LRU, b);
hash_lock->write_lock();
ut_ad(!buf_pool.page_hash_get_low(id, fold)); ut_ad(!buf_pool.page_hash_get_low(id, fold));
ut_ad(b->zip_size()); ut_ad(b->zip_size());
@@ -940,6 +941,7 @@ func_exit:
} }
buf_flush_relocate_on_flush_list(bpage, b); buf_flush_relocate_on_flush_list(bpage, b);
mysql_mutex_unlock(&buf_pool.flush_list_mutex);
bpage->zip.data = nullptr; bpage->zip.data = nullptr;
@@ -950,6 +952,8 @@ func_exit:
hash_lock. */ hash_lock. */
b->set_io_fix(BUF_IO_PIN); b->set_io_fix(BUF_IO_PIN);
hash_lock->write_unlock(); hash_lock->write_unlock();
} else if (!zip) {
hash_lock->write_unlock();
} }
buf_block_t* block = reinterpret_cast<buf_block_t*>(bpage); buf_block_t* block = reinterpret_cast<buf_block_t*>(bpage);
@@ -1182,6 +1186,10 @@ static bool buf_LRU_block_remove_hashed(buf_page_t *bpage, const page_id_t id,
MEM_UNDEFINED(((buf_block_t*) bpage)->frame, srv_page_size); MEM_UNDEFINED(((buf_block_t*) bpage)->frame, srv_page_size);
bpage->set_state(BUF_BLOCK_REMOVE_HASH); bpage->set_state(BUF_BLOCK_REMOVE_HASH);
if (!zip) {
return true;
}
/* Question: If we release hash_lock here /* Question: If we release hash_lock here
then what protects us against: then what protects us against:
1) Some other thread buffer fixing this page 1) Some other thread buffer fixing this page
@@ -1203,7 +1211,7 @@ static bool buf_LRU_block_remove_hashed(buf_page_t *bpage, const page_id_t id,
page_hash. */ page_hash. */
hash_lock->write_unlock(); hash_lock->write_unlock();
if (zip && bpage->zip.data) { if (bpage->zip.data) {
/* Free the compressed page. */ /* Free the compressed page. */
void* data = bpage->zip.data; void* data = bpage->zip.data;
bpage->zip.data = NULL; bpage->zip.data = NULL;

View File

@@ -372,33 +372,6 @@ void fil_crypt_parse(fil_space_t* space, const byte* data)
} }
} }
/** Fill crypt data information to the give page.
It should be called during ibd file creation.
@param[in] flags tablespace flags
@param[in,out] page first page of the tablespace */
void
fil_space_crypt_t::fill_page0(
ulint flags,
byte* page)
{
const uint len = sizeof(iv);
const ulint offset = FSP_HEADER_OFFSET
+ fsp_header_get_encryption_offset(
fil_space_t::zip_size(flags));
memcpy(page + offset, CRYPT_MAGIC, MAGIC_SZ);
mach_write_to_1(page + offset + MAGIC_SZ, type);
mach_write_to_1(page + offset + MAGIC_SZ + 1, len);
memcpy(page + offset + MAGIC_SZ + 2, &iv, len);
mach_write_to_4(page + offset + MAGIC_SZ + 2 + len,
min_key_version);
mach_write_to_4(page + offset + MAGIC_SZ + 2 + len + 4,
key_id);
mach_write_to_1(page + offset + MAGIC_SZ + 2 + len + 8,
encryption);
}
/** Write encryption metadata to the first page. /** Write encryption metadata to the first page.
@param[in,out] block first page of the tablespace @param[in,out] block first page of the tablespace
@param[in,out] mtr mini-transaction */ @param[in,out] mtr mini-transaction */

View File

@@ -577,7 +577,7 @@ fil_space_extend_must_retry(
os_offset_t(FIL_IBD_FILE_INITIAL_SIZE << srv_page_size_shift)); os_offset_t(FIL_IBD_FILE_INITIAL_SIZE << srv_page_size_shift));
*success = os_file_set_size(node->name, node->handle, new_size, *success = os_file_set_size(node->name, node->handle, new_size,
space->is_compressed()); node->punch_hole == 1);
os_has_said_disk_full = *success; os_has_said_disk_full = *success;
if (*success) { if (*success) {
@@ -1962,7 +1962,6 @@ fil_ibd_create(
dberr_t* err) dberr_t* err)
{ {
pfs_os_file_t file; pfs_os_file_t file;
byte* page;
bool success; bool success;
mtr_t mtr; mtr_t mtr;
bool has_data_dir = FSP_FLAGS_HAS_DATA_DIR(flags) != 0; bool has_data_dir = FSP_FLAGS_HAS_DATA_DIR(flags) != 0;
@@ -2025,61 +2024,41 @@ fil_ibd_create(
} }
const bool is_compressed = fil_space_t::is_compressed(flags); const bool is_compressed = fil_space_t::is_compressed(flags);
fil_space_crypt_t* crypt_data = nullptr;
#ifdef _WIN32 #ifdef _WIN32
const bool is_sparse = is_compressed;
if (is_compressed) { if (is_compressed) {
os_file_set_sparse_win32(file); os_file_set_sparse_win32(file);
} }
#else
const bool is_sparse = is_compressed
&& DB_SUCCESS == os_file_punch_hole(file, 0, 4096)
&& !my_test_if_thinly_provisioned(file);
#endif #endif
if (!os_file_set_size(
path, file,
os_offset_t(size) << srv_page_size_shift, is_compressed)) {
*err = DB_OUT_OF_FILE_SPACE;
err_exit:
os_file_close(file);
os_file_delete(innodb_data_file_key, path);
free(crypt_data);
return NULL;
}
/* We have to write the space id to the file immediately and flush the
file to disk. This is because in crash recovery we must be aware what
tablespaces exist and what are their space id's, so that we can apply
the log records to the right file. It may take quite a while until
buffer pool flush algorithms write anything to the file and flush it to
disk. If we would not write here anything, the file would be filled
with zeros from the call of os_file_set_size(), until a buffer pool
flush would write to it. */
/* Align the memory for file i/o if we might have O_DIRECT set */
page = static_cast<byte*>(aligned_malloc(2 * srv_page_size,
srv_page_size));
memset(page, '\0', srv_page_size);
if (fil_space_t::full_crc32(flags)) { if (fil_space_t::full_crc32(flags)) {
flags |= FSP_FLAGS_FCRC32_PAGE_SSIZE(); flags |= FSP_FLAGS_FCRC32_PAGE_SSIZE();
} else { } else {
flags |= FSP_FLAGS_PAGE_SSIZE(); flags |= FSP_FLAGS_PAGE_SSIZE();
} }
fsp_header_init_fields(page, space_id, flags);
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, space_id);
/* Create crypt data if the tablespace is either encrypted or user has /* Create crypt data if the tablespace is either encrypted or user has
requested it to remain unencrypted. */ requested it to remain unencrypted. */
crypt_data = (mode != FIL_ENCRYPTION_DEFAULT || srv_encrypt_tables) fil_space_crypt_t* crypt_data = (mode != FIL_ENCRYPTION_DEFAULT
|| srv_encrypt_tables)
? fil_space_create_crypt_data(mode, key_id) ? fil_space_create_crypt_data(mode, key_id)
: NULL; : nullptr;
if (crypt_data) { if (!os_file_set_size(path, file,
/* Write crypt data information in page0 while creating os_offset_t(size) << srv_page_size_shift,
ibd file. */ is_sparse)) {
crypt_data->fill_page0(flags, page); *err = DB_OUT_OF_FILE_SPACE;
err_exit:
os_file_close(file);
os_file_delete(innodb_data_file_key, path);
free(crypt_data);
return nullptr;
} }
aligned_free(page);
fil_space_t::name_type space_name; fil_space_t::name_type space_name;
if (has_data_dir) { if (has_data_dir) {

View File

@@ -525,26 +525,6 @@ void fil_space_t::modify_check(const mtr_t& mtr) const
} }
#endif #endif
/**********************************************************************//**
Writes the space id and flags to a tablespace header. The flags contain
row type, physical/compressed page size, and logical/uncompressed page
size of the tablespace. */
void
fsp_header_init_fields(
/*===================*/
page_t* page, /*!< in/out: first page in the space */
ulint space_id, /*!< in: space id */
ulint flags) /*!< in: tablespace flags (FSP_SPACE_FLAGS) */
{
flags &= ~FSP_FLAGS_MEM_MASK;
ut_a(fil_space_t::is_valid_flags(flags, space_id));
mach_write_to_4(FSP_HEADER_OFFSET + FSP_SPACE_ID + page,
space_id);
mach_write_to_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + page,
flags);
}
/** Initialize a tablespace header. /** Initialize a tablespace header.
@param[in,out] space tablespace @param[in,out] space tablespace
@param[in] size current size in blocks @param[in] size current size in blocks

View File

@@ -526,7 +526,7 @@ inline bool dict_table_t::instant_column(const dict_table_t& table,
} }
DBUG_ASSERT(c.is_added()); DBUG_ASSERT(c.is_added());
if (c.def_val.len <= sizeof field_ref_zero if (c.def_val.len <= UNIV_PAGE_SIZE_MAX
&& (!c.def_val.len && (!c.def_val.len
|| !memcmp(c.def_val.data, field_ref_zero, || !memcmp(c.def_val.data, field_ref_zero,
c.def_val.len))) { c.def_val.len))) {

View File

@@ -159,11 +159,11 @@ private:
uint64_t m_id; uint64_t m_id;
}; };
/** A field reference full of zero, for use in assertions and checks, /** A 64KiB buffer of NUL bytes, for use in assertions and checks,
and dummy default values of instantly dropped columns. and dummy default values of instantly dropped columns.
Initially, BLOB field references are set to zero, in Initially, BLOB field references are set to NUL bytes, in
dtuple_convert_big_rec(). */ dtuple_convert_big_rec(). */
extern const byte field_ref_zero[UNIV_PAGE_SIZE_MAX]; extern const byte *field_ref_zero;
#ifndef UNIV_INNOCHECKSUM #ifndef UNIV_INNOCHECKSUM

View File

@@ -172,12 +172,6 @@ struct fil_space_crypt_t : st_encryption_scheme
return (encryption == FIL_ENCRYPTION_OFF); return (encryption == FIL_ENCRYPTION_OFF);
} }
/** Fill crypt data information to the give page.
It should be called during ibd file creation.
@param[in] flags tablespace flags
@param[in,out] page first page of the tablespace */
void fill_page0(ulint flags, byte* page);
/** Write encryption metadata to the first page. /** Write encryption metadata to the first page.
@param[in,out] block first page of the tablespace @param[in,out] block first page of the tablespace
@param[in,out] mtr mini-transaction */ @param[in,out] mtr mini-transaction */

View File

@@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 2020, MariaDB Corporation. Copyright (c) 2013, 2021, 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
@@ -342,17 +342,6 @@ fsp_header_check_encryption_key(
ulint fsp_flags, ulint fsp_flags,
page_t* page); page_t* page);
/**********************************************************************//**
Writes the space id and flags to a tablespace header. The flags contain
row type, physical/compressed page size, and logical/uncompressed page
size of the tablespace. */
void
fsp_header_init_fields(
/*===================*/
page_t* page, /*!< in/out: first page in the space */
ulint space_id, /*!< in: space id */
ulint flags); /*!< in: tablespace flags (FSP_SPACE_FLAGS):
0, or table->flags if newer than COMPACT */
/** Initialize a tablespace header. /** Initialize a tablespace header.
@param[in,out] space tablespace @param[in,out] space tablespace
@param[in] size current size in blocks @param[in] size current size in blocks

View File

@@ -624,8 +624,7 @@ public:
checkpoint writes */ checkpoint writes */
/** buffer for checkpoint header */ /** buffer for checkpoint header */
MY_ALIGNED(OS_FILE_LOG_BLOCK_SIZE) byte *checkpoint_buf;
byte checkpoint_buf[OS_FILE_LOG_BLOCK_SIZE];
/* @} */ /* @} */
private: private:

View File

@@ -216,6 +216,8 @@ void log_t::create()
log_block_set_first_rec_group(buf, LOG_BLOCK_HDR_SIZE); log_block_set_first_rec_group(buf, LOG_BLOCK_HDR_SIZE);
buf_free= LOG_BLOCK_HDR_SIZE; buf_free= LOG_BLOCK_HDR_SIZE;
checkpoint_buf= static_cast<byte*>
(aligned_malloc(OS_FILE_LOG_BLOCK_SIZE, OS_FILE_LOG_BLOCK_SIZE));
} }
mapped_file_t::~mapped_file_t() noexcept mapped_file_t::~mapped_file_t() noexcept
@@ -458,8 +460,8 @@ void log_t::file::write_header_durable(lsn_t lsn)
ut_ad(log_sys.log.format == log_t::FORMAT_10_5 || ut_ad(log_sys.log.format == log_t::FORMAT_10_5 ||
log_sys.log.format == log_t::FORMAT_ENC_10_5); log_sys.log.format == log_t::FORMAT_ENC_10_5);
// man 2 open suggests this buffer to be aligned by 512 for O_DIRECT byte *buf= log_sys.checkpoint_buf;
MY_ALIGNED(OS_FILE_LOG_BLOCK_SIZE) byte buf[OS_FILE_LOG_BLOCK_SIZE] = {0}; memset_aligned<OS_FILE_LOG_BLOCK_SIZE>(buf, 0, OS_FILE_LOG_BLOCK_SIZE);
mach_write_to_4(buf + LOG_HEADER_FORMAT, log_sys.log.format); mach_write_to_4(buf + LOG_HEADER_FORMAT, log_sys.log.format);
mach_write_to_4(buf + LOG_HEADER_SUBFORMAT, log_sys.log.subformat); mach_write_to_4(buf + LOG_HEADER_SUBFORMAT, log_sys.log.subformat);
@@ -472,7 +474,7 @@ void log_t::file::write_header_durable(lsn_t lsn)
DBUG_PRINT("ib_log", ("write " LSN_PF, lsn)); DBUG_PRINT("ib_log", ("write " LSN_PF, lsn));
log_sys.log.write(0, buf); log_sys.log.write(0, {buf, OS_FILE_LOG_BLOCK_SIZE});
if (!log_sys.log.writes_are_durable()) if (!log_sys.log.writes_are_durable())
log_sys.log.flush(); log_sys.log.flush();
} }
@@ -803,11 +805,9 @@ void log_write_up_to(lsn_t lsn, bool flush_to_disk, bool rotate_key,
if (flush_to_disk && if (flush_to_disk &&
flush_lock.acquire(lsn, callback) != group_commit_lock::ACQUIRED) flush_lock.acquire(lsn, callback) != group_commit_lock::ACQUIRED)
{
return; return;
}
if (write_lock.acquire(lsn, flush_to_disk?0:callback) == if (write_lock.acquire(lsn, flush_to_disk ? nullptr : callback) ==
group_commit_lock::ACQUIRED) group_commit_lock::ACQUIRED)
{ {
mysql_mutex_lock(&log_sys.mutex); mysql_mutex_lock(&log_sys.mutex);
@@ -821,9 +821,7 @@ void log_write_up_to(lsn_t lsn, bool flush_to_disk, bool rotate_key,
} }
if (!flush_to_disk) if (!flush_to_disk)
{
return; return;
}
/* Flush the highest written lsn.*/ /* Flush the highest written lsn.*/
auto flush_lsn = write_lock.value(); auto flush_lsn = write_lock.value();
@@ -882,7 +880,7 @@ ATTRIBUTE_COLD void log_write_checkpoint_info(lsn_t end_lsn)
log_sys.next_checkpoint_lsn)); log_sys.next_checkpoint_lsn));
byte* buf = log_sys.checkpoint_buf; byte* buf = log_sys.checkpoint_buf;
memset(buf, 0, OS_FILE_LOG_BLOCK_SIZE); memset_aligned<OS_FILE_LOG_BLOCK_SIZE>(buf, 0, OS_FILE_LOG_BLOCK_SIZE);
mach_write_to_8(buf + LOG_CHECKPOINT_NO, log_sys.next_checkpoint_no); mach_write_to_8(buf + LOG_CHECKPOINT_NO, log_sys.next_checkpoint_no);
mach_write_to_8(buf + LOG_CHECKPOINT_LSN, log_sys.next_checkpoint_lsn); mach_write_to_8(buf + LOG_CHECKPOINT_LSN, log_sys.next_checkpoint_lsn);
@@ -1281,18 +1279,21 @@ void log_t::close()
{ {
ut_ad(this == &log_sys); ut_ad(this == &log_sys);
if (!is_initialised()) return; if (!is_initialised()) return;
m_initialised = false; m_initialised= false;
log.close(); log.close();
ut_free_dodump(buf, srv_log_buffer_size); ut_free_dodump(buf, srv_log_buffer_size);
buf = NULL; buf= nullptr;
ut_free_dodump(flush_buf, srv_log_buffer_size); ut_free_dodump(flush_buf, srv_log_buffer_size);
flush_buf = NULL; flush_buf= nullptr;
mysql_mutex_destroy(&mutex); mysql_mutex_destroy(&mutex);
mysql_mutex_destroy(&flush_order_mutex); mysql_mutex_destroy(&flush_order_mutex);
recv_sys.close(); recv_sys.close();
aligned_free(checkpoint_buf);
checkpoint_buf= nullptr;
} }
std::string get_log_file_path(const char *filename) std::string get_log_file_path(const char *filename)

View File

@@ -839,9 +839,19 @@ bool recv_sys_t::recover_deferred(recv_sys_t::map::iterator &p,
node->deferred= true; node->deferred= true;
if (!space->acquire()) if (!space->acquire())
goto fail; goto fail;
const bool is_compressed= fil_space_t::is_compressed(flags);
#ifdef _WIN32
const bool is_sparse= is_compressed;
if (is_compressed)
os_file_set_sparse_win32(node->handle);
#else
const bool is_sparse= is_compressed &&
DB_SUCCESS == os_file_punch_hole(node->handle, 0, 4096) &&
!my_test_if_thinly_provisioned(node->handle);
#endif
if (!os_file_set_size(node->name, node->handle, if (!os_file_set_size(node->name, node->handle,
size * fil_space_t::physical_size(flags), size * fil_space_t::physical_size(flags),
space->is_compressed())) is_sparse))
{ {
space->release(); space->release();
goto fail; goto fail;

View File

@@ -35,12 +35,6 @@ Created June 2005 by Marko Makela
using st_::span; using st_::span;
/** A BLOB field reference full of zero, for use in assertions and tests.
Initially, BLOB field references are set to zero, in
dtuple_convert_big_rec(). */
alignas(UNIV_PAGE_SIZE_MIN)
const byte field_ref_zero[UNIV_PAGE_SIZE_MAX] = { 0, };
#ifndef UNIV_INNOCHECKSUM #ifndef UNIV_INNOCHECKSUM
#include "mtr0log.h" #include "mtr0log.h"
#include "dict0dict.h" #include "dict0dict.h"
@@ -92,16 +86,12 @@ static const byte supremum_extra_data alignas(4) [] = {
}; };
/** Assert that a block of memory is filled with zero bytes. /** Assert that a block of memory is filled with zero bytes.
Compare at most sizeof(field_ref_zero) bytes.
@param b in: memory block @param b in: memory block
@param s in: size of the memory block, in bytes */ @param s in: size of the memory block, in bytes */
#define ASSERT_ZERO(b, s) \ #define ASSERT_ZERO(b, s) ut_ad(!memcmp(b, field_ref_zero, s))
ut_ad(!memcmp(b, field_ref_zero, \
std::min<size_t>(s, sizeof field_ref_zero)));
/** Assert that a BLOB pointer is filled with zero bytes. /** Assert that a BLOB pointer is filled with zero bytes.
@param b in: BLOB pointer */ @param b in: BLOB pointer */
#define ASSERT_ZERO_BLOB(b) \ #define ASSERT_ZERO_BLOB(b) ASSERT_ZERO(b, FIELD_REF_SIZE)
ut_ad(!memcmp(b, field_ref_zero, FIELD_REF_SIZE))
/* Enable some extra debugging output. This code can be enabled /* Enable some extra debugging output. This code can be enabled
independently of any UNIV_ debugging conditions. */ independently of any UNIV_ debugging conditions. */

View File

@@ -3445,7 +3445,7 @@ row_ins_index_entry_set_vals(
field->len = UNIV_SQL_NULL; field->len = UNIV_SQL_NULL;
field->type.prtype = DATA_BINARY_TYPE; field->type.prtype = DATA_BINARY_TYPE;
} else { } else {
ut_ad(col->len <= sizeof field_ref_zero); ut_ad(col->len <= UNIV_PAGE_SIZE_MAX);
ut_ad(ind_field->fixed_len <= col->len); ut_ad(ind_field->fixed_len <= col->len);
dfield_set_data(field, field_ref_zero, dfield_set_data(field, field_ref_zero,
ind_field->fixed_len); ind_field->fixed_len);

View File

@@ -1552,97 +1552,34 @@ void srv_master_thread_enable()
} }
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
/*********************************************************************//** /** Perform periodic tasks whenever the server is active.
Perform the tasks that the master thread is supposed to do when the @param counter_time microsecond_interval_timer() */
server is active. There are two types of tasks. The first category is static void srv_master_do_active_tasks(ulonglong counter_time)
of such tasks which are performed at each inovcation of this function.
We assume that this function is called roughly every second when the
server is active. The second category is of such tasks which are
performed at some interval e.g.: purge, dict_LRU cleanup etc. */
static
void
srv_master_do_active_tasks(void)
/*============================*/
{ {
time_t cur_time = time(NULL);
ulonglong counter_time = microsecond_interval_timer();
/* First do the tasks that we are suppose to do at each
invocation of this function. */
++srv_main_active_loops; ++srv_main_active_loops;
MONITOR_INC(MONITOR_MASTER_ACTIVE_LOOPS); MONITOR_INC(MONITOR_MASTER_ACTIVE_LOOPS);
ut_d(srv_master_do_disabled_loop()); if (!(counter_time % (SRV_MASTER_DICT_LRU_INTERVAL * 1000000ULL))) {
if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) {
return;
}
/* make sure that there is enough reusable space in the redo
log files */
srv_main_thread_op_info = "checking free log space";
log_free_check();
/* Flush logs if needed */
srv_main_thread_op_info = "flushing log";
srv_sync_log_buffer_in_background();
MONITOR_INC_TIME_IN_MICRO_SECS(
MONITOR_SRV_LOG_FLUSH_MICROSECOND, counter_time);
/* Now see if various tasks that are performed at defined
intervals need to be performed. */
if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) {
return;
}
if (cur_time % SRV_MASTER_DICT_LRU_INTERVAL == 0) {
srv_main_thread_op_info = "enforcing dict cache limit"; srv_main_thread_op_info = "enforcing dict cache limit";
ulint n_evicted = dict_sys.evict_table_LRU(true); if (ulint n_evicted = dict_sys.evict_table_LRU(true)) {
if (n_evicted != 0) {
MONITOR_INC_VALUE( MONITOR_INC_VALUE(
MONITOR_SRV_DICT_LRU_EVICT_COUNT_ACTIVE, n_evicted); MONITOR_SRV_DICT_LRU_EVICT_COUNT_ACTIVE,
n_evicted);
} }
MONITOR_INC_TIME_IN_MICRO_SECS( MONITOR_INC_TIME_IN_MICRO_SECS(
MONITOR_SRV_DICT_LRU_MICROSECOND, counter_time); MONITOR_SRV_DICT_LRU_MICROSECOND, counter_time);
} }
} }
/*********************************************************************//** /** Perform periodic tasks whenever the server is idle.
Perform the tasks that the master thread is supposed to do whenever the @param counter_time microsecond_interval_timer() */
server is idle. We do check for the server state during this function static void srv_master_do_idle_tasks(ulonglong counter_time)
and if the server has entered the shutdown phase we may return from
the function without completing the required tasks.
Note that the server can move to active state when we are executing this
function but we don't check for that as we are suppose to perform more
or less same tasks when server is active. */
static
void
srv_master_do_idle_tasks(void)
/*==========================*/
{ {
++srv_main_idle_loops; ++srv_main_idle_loops;
MONITOR_INC(MONITOR_MASTER_IDLE_LOOPS); MONITOR_INC(MONITOR_MASTER_IDLE_LOOPS);
ut_d(srv_master_do_disabled_loop());
if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) {
return;
}
/* make sure that there is enough reusable space in the redo
log files */
srv_main_thread_op_info = "checking free log space";
log_free_check();
if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) {
return;
}
ulonglong counter_time = microsecond_interval_timer();
srv_main_thread_op_info = "enforcing dict cache limit"; srv_main_thread_op_info = "enforcing dict cache limit";
if (ulint n_evicted = dict_sys.evict_table_LRU(false)) { if (ulint n_evicted = dict_sys.evict_table_LRU(false)) {
MONITOR_INC_VALUE( MONITOR_INC_VALUE(
@@ -1650,11 +1587,6 @@ srv_master_do_idle_tasks(void)
} }
MONITOR_INC_TIME_IN_MICRO_SECS( MONITOR_INC_TIME_IN_MICRO_SECS(
MONITOR_SRV_DICT_LRU_MICROSECOND, counter_time); MONITOR_SRV_DICT_LRU_MICROSECOND, counter_time);
/* Flush logs if needed */
srv_sync_log_buffer_in_background();
MONITOR_INC_TIME_IN_MICRO_SECS(
MONITOR_SRV_LOG_FLUSH_MICROSECOND, counter_time);
} }
/** /**
@@ -1695,12 +1627,18 @@ void srv_master_callback(void*)
ut_a(srv_shutdown_state <= SRV_SHUTDOWN_INITIATED); ut_a(srv_shutdown_state <= SRV_SHUTDOWN_INITIATED);
srv_main_thread_op_info = "";
MONITOR_INC(MONITOR_MASTER_THREAD_SLEEP); MONITOR_INC(MONITOR_MASTER_THREAD_SLEEP);
ut_d(srv_master_do_disabled_loop());
purge_coordinator_timer_callback(nullptr);
ulonglong counter_time = microsecond_interval_timer();
srv_sync_log_buffer_in_background();
MONITOR_INC_TIME_IN_MICRO_SECS(
MONITOR_SRV_LOG_FLUSH_MICROSECOND, counter_time);
if (srv_check_activity(&old_activity_count)) { if (srv_check_activity(&old_activity_count)) {
srv_master_do_active_tasks(); srv_master_do_active_tasks(counter_time);
} else { } else {
srv_master_do_idle_tasks(); srv_master_do_idle_tasks(counter_time);
} }
srv_main_thread_op_info = "sleeping"; srv_main_thread_op_info = "sleeping";
} }

View File

@@ -812,9 +812,9 @@ srv_open_tmp_tablespace(bool create_new_db)
static void srv_shutdown_threads() static void srv_shutdown_threads()
{ {
ut_ad(!srv_undo_sources); ut_ad(!srv_undo_sources);
srv_shutdown_state = SRV_SHUTDOWN_EXIT_THREADS;
ut_d(srv_master_thread_enable()); ut_d(srv_master_thread_enable());
srv_master_timer.reset(); srv_master_timer.reset();
srv_shutdown_state = SRV_SHUTDOWN_EXIT_THREADS;
if (purge_sys.enabled()) { if (purge_sys.enabled()) {
srv_purge_shutdown(); srv_purge_shutdown();

View File

@@ -1392,8 +1392,6 @@ void trx_t::commit_cleanup()
mutex.wr_unlock(); mutex.wr_unlock();
ut_a(error_state == DB_SUCCESS); ut_a(error_state == DB_SUCCESS);
if (!srv_read_only_mode)
srv_wake_purge_thread_if_not_active();
} }
/** Commit the transaction in a mini-transaction. /** Commit the transaction in a mini-transaction.

View File

@@ -721,6 +721,12 @@ connection master_1;
create table t2345678911234567892123456789312345678941234567895123234234(id int) ENGINE=SPIDER create table t2345678911234567892123456789312345678941234567895123234234(id int) ENGINE=SPIDER
COMMENT='host "192.168.21.1", user "spider", password "password", database "test32738123123123"'; COMMENT='host "192.168.21.1", user "spider", password "password", database "test32738123123123"';
drop table t2345678911234567892123456789312345678941234567895123234234; drop table t2345678911234567892123456789312345678941234567895123234234;
#
# MDEV-26139 Spider crashes with segmentation fault (signal 11) on CREATE TABLE when COMMENT does not contain embedded double quotes
#
create table mdev_26139 (id int) ENGINE=SPIDER
COMMENT="host '192.168.21.1', user 'spider', password 'password', database 'test'";
drop table mdev_26139;
deinit deinit
connection master_1; connection master_1;

View File

@@ -2682,6 +2682,13 @@ create table t2345678911234567892123456789312345678941234567895123234234(id int)
COMMENT='host "192.168.21.1", user "spider", password "password", database "test32738123123123"'; COMMENT='host "192.168.21.1", user "spider", password "password", database "test32738123123123"';
drop table t2345678911234567892123456789312345678941234567895123234234; drop table t2345678911234567892123456789312345678941234567895123234234;
--echo #
--echo # MDEV-26139 Spider crashes with segmentation fault (signal 11) on CREATE TABLE when COMMENT does not contain embedded double quotes
--echo #
create table mdev_26139 (id int) ENGINE=SPIDER
COMMENT="host '192.168.21.1', user 'spider', password 'password', database 'test'";
drop table mdev_26139;
--echo --echo
--echo deinit --echo deinit
--disable_warnings --disable_warnings

View File

@@ -189,7 +189,8 @@ typedef struct st_spider_param_string_parse
{ {
DBUG_RETURN(print_param_error()); DBUG_RETURN(print_param_error());
} }
else if (!sq || sq > dq)
if (dq && (!sq || sq > dq))
{ {
while (1) while (1)
{ {
@@ -227,7 +228,7 @@ typedef struct st_spider_param_string_parse
} }
} }
} }
else else /* sq && (!dq || sq <= dq) */
{ {
while (1) while (1)
{ {