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

Merge 10.5 into 10.6

This commit is contained in:
Marko Mäkelä
2021-11-09 09:11:50 +02:00
59 changed files with 1770 additions and 99 deletions

View File

@@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2018, Oracle and/or its affiliates. Copyright (c) 2000, 2018, Oracle and/or its affiliates.
Copyright (c) 2009, 2020, MariaDB Corporation. Copyright (c) 2009, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -91,10 +91,14 @@ extern "C" {
#if defined(_WIN32) #if defined(_WIN32)
#include <conio.h> #include <conio.h>
#else #else
#include <readline.h> # ifdef __APPLE__
#if !defined(USE_LIBEDIT_INTERFACE) # include <editline/readline.h>
#include <history.h> # else
#endif # include <readline.h>
# if !defined(USE_LIBEDIT_INTERFACE)
# include <history.h>
# endif
# endif
#define HAVE_READLINE #define HAVE_READLINE
#define USE_POPEN #define USE_POPEN
#endif #endif

View File

@@ -51,21 +51,82 @@ SET(CPACK_RPM_PACKAGE_RELOCATABLE FALSE)
SET(CPACK_PACKAGE_RELOCATABLE FALSE) SET(CPACK_PACKAGE_RELOCATABLE FALSE)
SET(CPACK_RPM_PACKAGE_GROUP "Applications/Databases") SET(CPACK_RPM_PACKAGE_GROUP "Applications/Databases")
SET(CPACK_RPM_PACKAGE_URL ${CPACK_PACKAGE_URL}) SET(CPACK_RPM_PACKAGE_URL ${CPACK_PACKAGE_URL})
SET(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}")
SET(CPACK_RPM_shared_PACKAGE_VENDOR "MariaDB Corporation Ab") SET(CPACK_RPM_shared_PACKAGE_VENDOR "MariaDB Corporation Ab")
SET(CPACK_RPM_shared_PACKAGE_LICENSE "LGPLv2.1") SET(CPACK_RPM_shared_PACKAGE_LICENSE "LGPLv2.1")
SET(CPACK_RPM_shared_PACKAGE_SUMMARY "LGPL MariaDB client library")
SET(CPACK_RPM_shared_PACKAGE_DESCRIPTION " # Set default description for packages
This is LGPL MariaDB client library that can be used to connect to MySQL SET(CPACK_RPM_PACKAGE_DESCRIPTION "MariaDB: a very fast and robust SQL database server
It is GPL v2 licensed, which means you can use the it free of charge under the
conditions of the GNU General Public License Version 2 (http://www.gnu.org/licenses/).
MariaDB documentation can be found at https://mariadb.com/kb
MariaDB bug reports should be submitted through https://jira.mariadb.org")
# Packages with default description
SET(CPACK_RPM_client_PACKAGE_SUMMARY "MariaDB database client binaries")
SET(CPACK_RPM_common_PACKAGE_SUMMARY "MariaDB database common files (e.g. /etc/mysql/conf.d/mariadb.cnf)")
SET(CPACK_RPM_compat_PACKAGE_SUMMARY "MariaDB database client library MySQL compat package")
SET(CPACK_RPM_devel_PACKAGE_SUMMARY "MariaDB database development files")
SET(CPACK_RPM_server_PACKAGE_SUMMARY "MariaDB database server binaries")
SET(CPACK_RPM_test_PACKAGE_SUMMARY "MariaDB database regression test suite")
# libmariadb3
SET(CPACK_RPM_shared_PACKAGE_SUMMARY "LGPL MariaDB database client library")
SET(CPACK_RPM_shared_PACKAGE_DESCRIPTION "This is LGPL MariaDB client library that can be used to connect to MySQL
or MariaDB. or MariaDB.
This code is based on the LGPL libmysql client library from MySQL 3.23 This code is based on the LGPL libmysql client library from MySQL 3.23
and PHP's mysqlnd extension. and PHP's mysqlnd extension.
This product includes PHP software, freely available from This product includes PHP software, freely available from
<http://www.php.net/software/> http://www.php.net/software/")
")
# Summary and descriptions per package
SET(CPACK_RPM_backup_PACKAGE_SUMMARY "Backup tool for MariaDB server")
SET(CPACK_RPM_backup_PACKAGE_DESCRIPTION "Mariabackup is an open source tool provided by MariaDB
for performing physical online backups of InnoDB, Aria and MyISAM tables.
For InnoDB, “hot online” backups are possible.
It was originally forked from Percona XtraBackup 2.3.8.")
SET(CPACK_RPM_cassandra-engine_PACKAGE_SUMMARY "Cassandra storage engine for MariaDB")
SET(CPACK_RPM_cassandra-engine_PACKAGE_DESCRIPTION "The Cassandra Storage Engine allows access to data in a Cassandra cluster from
MariaDB, combining the best of SQL and no-SQL worlds. Cassandra SE (storage
engine) makes Cassandra's column family appear as a table in MariaDB that you
can insert to, update, and select from. You can write joins against this table,
it is possible to join data that's stored in MariaDB with data that's stored in
Cassandra.")
SET(CPACK_RPM_connect-engine_PACKAGE_SUMMARY "Connect storage engine for MariaDB")
SET(CPACK_RPM_connect-engine_PACKAGE_DESCRIPTION "Connect engine supports a number of file formats (dbf, xml, txt, bin, etc),
connections to ODBC tables and remote MySQL tables, as well as a number of
other interesting features.")
SET(CPACK_RPM_cracklib-password-check_PACKAGE_SUMMARY "CrackLib Password Validation Plugin for MariaDB")
SET(CPACK_RPM_cracklib-password-check_PACKAGE_DESCRIPTION "This password validation plugin uses cracklib to allow only
sufficiently secure (as defined by cracklib) user passwords in MariaDB.")
SET(CPACK_RPM_gssapi-server_PACKAGE_SUMMARY "GSSAPI authentication plugin for MariaDB server")
SET(CPACK_RPM_gssapi-server_PACKAGE_DESCRIPTION "The gssapi authentication plugin allows the user to authenticate with services
that use the Generic Security Services Application Program Interface (GSSAPI).
The gssapi authentication plugin is most often used for authenticating with Microsoft Active Directory.")
SET(CPACK_RPM_oqgraph-engine_PACKAGE_SUMMARY "OQGraph storage engine for MariaDB")
SET(CPACK_RPM_oqgraph-engine_PACKAGE_DESCRIPTION "The Open Query GRAPH computation engine, or OQGRAPH as the engine itself is called,
allows you to handle hierarchies (tree structures) and complex graphs
(nodes having many connections in several directions).
It is intended to be used for retrieving hierarchical information, such as those used for graphs,
routes or social relationships, in plain SQL.")
SET(CPACK_RPM_rocksdb-engine_PACKAGE_SUMMARY "RocksDB storage engine for MariaDB")
SET(CPACK_RPM_rocksdb-engine_PACKAGE_DESCRIPTION "The RocksDB storage engine is a high performance storage engine, aimed
at maximising storage efficiency while maintaining InnoDB-like performance.")
SET(CPACK_RPM_tokudb-engine_PACKAGE_SUMMARY "TokuDB storage engine for MariaDB")
SET(CPACK_RPM_tokudb-engine_PACKAGE_DESCRIPTION "The TokuDB storage engine is for use in high-performance and write-intensive
environments, offering increased compression and better performance based
on fractal indexes.")
SET(CPACK_RPM_SPEC_MORE_DEFINE " SET(CPACK_RPM_SPEC_MORE_DEFINE "
%define mysql_vendor ${CPACK_PACKAGE_VENDOR} %define mysql_vendor ${CPACK_PACKAGE_VENDOR}

View File

@@ -367,6 +367,7 @@ create_worker_threads(uint n)
thd)) { thd)) {
msg("compress: pthread_create() failed: " msg("compress: pthread_create() failed: "
"errno = %d", errno); "errno = %d", errno);
pthread_mutex_unlock(&thd->ctrl_mutex);
goto err; goto err;
} }
} }
@@ -383,6 +384,13 @@ create_worker_threads(uint n)
return threads; return threads;
err: err:
while (i > 0) {
comp_thread_ctxt_t *thd;
i--;
thd = threads + i;
pthread_mutex_unlock(&thd->ctrl_mutex);
}
my_free(threads); my_free(threads);
return NULL; return NULL;
} }

View File

@@ -150,7 +150,8 @@ sub do_args($$$$$) {
my %vars = ( my %vars = (
vardir => $::opt_vardir, vardir => $::opt_vardir,
exe => $$exe, exe => $$exe,
args => join(' ', map { quote_from_mtr $_ } @$$args, '--loose-gdb'), args => join(' ', map { quote_from_mtr $_ } @$$args,
'--loose-debug-gdb', '--loose-skip-stack-trace'),
input => $input, input => $input,
script => "$::opt_vardir/tmp/${k}init.$type", script => "$::opt_vardir/tmp/${k}init.$type",
log => "$::opt_vardir/log/$type.$k", log => "$::opt_vardir/log/$type.$k",

View File

@@ -2588,6 +2588,22 @@ set max_statement_time= 0;
drop table t1; drop table t1;
drop view v1; drop view v1;
# #
# MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed
#
set @save_default_engine= @@default_storage_engine;
create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam;
alter table t1 change x xx int, algorithm=inplace;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x));
alter table t1 change x xx int, algorithm=inplace;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
set @@default_storage_engine= @save_default_engine;
#
# End of 10.3 tests # End of 10.3 tests
# #
# #
@@ -3373,5 +3389,31 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
# #
# MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed
#
set @save_default_engine= @@default_storage_engine;
create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam;
alter table t1 change x xx int, algorithm=inplace;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x));
alter table t1 change x xx int, algorithm=inplace;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
set @@default_storage_engine= @save_default_engine;
#
# MDEV-25555 Server crashes in tree_record_pos after INPLACE-recreating index on HEAP table
#
create table t1 (a int, key idx1(a), key idx2 using btree(a)) engine=memory;
alter table t1 rename index idx1 to idx3, algorithm=inplace;
delete from t1 where a = 10;
alter table t1 drop key idx3, add key idx1(a), algorithm=inplace;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
delete from t1 where a = 11;
drop table t1;
#
# End of 10.5 tests # End of 10.5 tests
# #

View File

@@ -2099,6 +2099,47 @@ set max_statement_time= 0;
drop table t1; drop table t1;
drop view v1; drop view v1;
--echo #
--echo # MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed
--echo #
set @save_default_engine= @@default_storage_engine;
--disable_query_log
if ($MTR_COMBINATION_INNODB)
{
set default_storage_engine= innodb;
}
if ($MTR_COMBINATION_ARIA)
{
set default_storage_engine= aria;
}
--enable_query_log
if (!$MTR_COMBINATION_INNODB)
{
--disable_query_log
--disable_result_log
# There is no inplace ADD INDEX for MyISAM/Aria:
create or replace table t1 (x int);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter table t1 add unique (x), algorithm=inplace;
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter table t1 add primary key(x), algorithm=inplace;
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter table t1 add index(x), algorithm=inplace;
--enable_query_log
--enable_result_log
}
create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam;
alter table t1 change x xx int, algorithm=inplace;
check table t1;
create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x));
alter table t1 change x xx int, algorithm=inplace;
check table t1;
# cleanup
drop table t1;
set @@default_storage_engine= @save_default_engine;
--echo # --echo #
--echo # End of 10.3 tests --echo # End of 10.3 tests
--echo # --echo #
@@ -2567,6 +2608,59 @@ alter table t1 rename column abc to ABC;
show create table t1; show create table t1;
drop table t1; drop table t1;
--echo #
--echo # MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed
--echo #
set @save_default_engine= @@default_storage_engine;
--disable_query_log
if ($MTR_COMBINATION_INNODB)
{
set default_storage_engine= innodb;
}
if ($MTR_COMBINATION_ARIA)
{
set default_storage_engine= aria;
}
--enable_query_log
if (!$MTR_COMBINATION_INNODB)
{
--disable_query_log
--disable_result_log
# There is no inplace ADD INDEX for MyISAM/Aria:
create or replace table t1 (x int);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter table t1 add unique (x), algorithm=inplace;
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter table t1 add primary key(x), algorithm=inplace;
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter table t1 add index(x), algorithm=inplace;
--enable_query_log
--enable_result_log
}
create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam;
alter table t1 change x xx int, algorithm=inplace;
check table t1;
create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x));
alter table t1 change x xx int, algorithm=inplace;
check table t1;
# cleanup
drop table t1;
set @@default_storage_engine= @save_default_engine;
--echo #
--echo # MDEV-25555 Server crashes in tree_record_pos after INPLACE-recreating index on HEAP table
--echo #
create table t1 (a int, key idx1(a), key idx2 using btree(a)) engine=memory;
alter table t1 rename index idx1 to idx3, algorithm=inplace;
delete from t1 where a = 10;
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter table t1 drop key idx3, add key idx1(a), algorithm=inplace;
delete from t1 where a = 11;
# cleanup
drop table t1;
--echo # --echo #
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #

File diff suppressed because it is too large Load Diff

View File

@@ -14,3 +14,35 @@ DROP TABLE t1;
--echo # --echo #
--echo # End of 5.5 tests --echo # End of 5.5 tests
--echo # --echo #
--echo #
--echo # Start of 10.2 tests
--echo #
--echo #
--echo # MDEV-25610 Assertion `escape != -1' failed in Item_func_like::val_int
--echo #
SET NAMES cp850;
SELECT '' LIKE '' ESCAPE _cp850 0xFF;
DELIMITER $$;
BEGIN NOT ATOMIC
DECLARE ch INT DEFAULT 0x00;
DECLARE query TEXT DEFAULT 'SELECT _cp850'''' LIKE _cp850'''' ESCAPE _cp850 0xFF';
WHILE ch <= 0xFF DO
SET @query= REPLACE(query, 'FF', CONV(ch, 10, 16));
SELECT @query;
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET ch=ch+1;
END WHILE;
END;
$$
DELIMITER ;$$
--echo #
--echo # End of 10.2 tests
--echo #

View File

@@ -0,0 +1,12 @@
#
# Start of 10.2 tests
#
#
# MDEV-25610 Assertion `escape != -1' failed in Item_func_like::val_int
#
SELECT _cp866'' LIKE _cp866'' ESCAPE _cp866 0xFF;
_cp866'' LIKE _cp866'' ESCAPE _cp866 0xFF
1
#
# End of 10.2 tests
#

View File

@@ -0,0 +1,14 @@
--echo #
--echo # Start of 10.2 tests
--echo #
--echo #
--echo # MDEV-25610 Assertion `escape != -1' failed in Item_func_like::val_int
--echo #
SELECT _cp866'' LIKE _cp866'' ESCAPE _cp866 0xFF;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@@ -4421,5 +4421,14 @@ DROP TABLE t1;
# #
SET DEFAULT_STORAGE_ENGINE=Default; SET DEFAULT_STORAGE_ENGINE=Default;
# #
# MDEV-24901 SIGSEGV in fts_get_table_name, SIGSEGV in ib_vector_size, SIGSEGV in row_merge_fts_doc_tokenize, stack smashing
#
SELECT HEX(WEIGHT_STRING(_tis620 'a\0b'));
HEX(WEIGHT_STRING(_tis620 'a\0b'))
610062
SELECT HEX(WEIGHT_STRING(_tis620 'a\0b' COLLATE tis620_thai_nopad_ci));
HEX(WEIGHT_STRING(_tis620 'a\0b' COLLATE tis620_thai_nopad_ci))
610062
#
# End of 10.2 tests # End of 10.2 tests
# #

View File

@@ -209,6 +209,13 @@ let $coll='tis620_nopad_bin';
let $coll_pad='tis620_bin'; let $coll_pad='tis620_bin';
--source include/ctype_pad_all_engines.inc --source include/ctype_pad_all_engines.inc
--echo #
--echo # MDEV-24901 SIGSEGV in fts_get_table_name, SIGSEGV in ib_vector_size, SIGSEGV in row_merge_fts_doc_tokenize, stack smashing
--echo #
SELECT HEX(WEIGHT_STRING(_tis620 'a\0b'));
SELECT HEX(WEIGHT_STRING(_tis620 'a\0b' COLLATE tis620_thai_nopad_ci));
--echo # --echo #
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo # --echo #

View File

@@ -6473,5 +6473,24 @@ CAST(_ucs2 0x0061E0030062 AS INT)
Warnings: Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'ab' Warning 1292 Truncated incorrect INTEGER value: 'ab'
# #
# MDEV-24584 Selecting INT column with COLLATE utf8mb4_general_ci throws an error
#
SET NAMES utf8, collation_connection=ucs2_general_ci;
SELECT 1 COLLATE ucs2_general_ci;
1 COLLATE ucs2_general_ci
1
SELECT 1 COLLATE ucs2_bin;
1 COLLATE ucs2_bin
1
SELECT HEX(1 COLLATE ucs2_general_ci);
HEX(1 COLLATE ucs2_general_ci)
0031
SELECT HEX(1 COLLATE ucs2_bin);
HEX(1 COLLATE ucs2_bin)
0031
SELECT 1 COLLATE latin1_swedish_ci;
ERROR 42000: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'ucs2'
SET NAMES utf8;
#
# End of 10.5 tests # End of 10.5 tests
# #

View File

@@ -1150,6 +1150,19 @@ SELECT CAST(_ucs2 0x0061DFFF0062 AS INT);
SELECT CAST(_ucs2 0x0061D7000062 AS INT); SELECT CAST(_ucs2 0x0061D7000062 AS INT);
SELECT CAST(_ucs2 0x0061E0030062 AS INT); SELECT CAST(_ucs2 0x0061E0030062 AS INT);
--echo #
--echo # MDEV-24584 Selecting INT column with COLLATE utf8mb4_general_ci throws an error
--echo #
SET NAMES utf8, collation_connection=ucs2_general_ci;
SELECT 1 COLLATE ucs2_general_ci;
SELECT 1 COLLATE ucs2_bin;
SELECT HEX(1 COLLATE ucs2_general_ci);
SELECT HEX(1 COLLATE ucs2_bin);
--error ER_COLLATION_CHARSET_MISMATCH
SELECT 1 COLLATE latin1_swedish_ci;
SET NAMES utf8;
--echo # --echo #
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #

View File

@@ -11261,6 +11261,17 @@ DROP TABLE kv;
DROP VIEW v1; DROP VIEW v1;
SET NAMES utf8; SET NAMES utf8;
# #
# MDEV-24335 Unexpected question mark in the end of a TINYTEXT column
#
CREATE TABLE t1 (a TINYTEXT character set utf8);
INSERT IGNORE INTO t1 VALUES (REPEAT(_utf8 0xD184, 250));
Warnings:
Warning 1366 Incorrect string value: '\xD1\x84\xD1\x84\xD1\x84...' for column `test`.`t1`.`a` at row 1
SELECT LENGTH(a), CHAR_LENGTH(a), RIGHT(a,3) FROM t1;
LENGTH(a) CHAR_LENGTH(a) RIGHT(a,3)
254 127 ффф
DROP TABLE t1;
#
# End of 10.2 tests # End of 10.2 tests
# #
# #

View File

@@ -2184,6 +2184,15 @@ DROP TABLE kv;
DROP VIEW v1; DROP VIEW v1;
SET NAMES utf8; SET NAMES utf8;
--echo #
--echo # MDEV-24335 Unexpected question mark in the end of a TINYTEXT column
--echo #
CREATE TABLE t1 (a TINYTEXT character set utf8);
INSERT IGNORE INTO t1 VALUES (REPEAT(_utf8 0xD184, 250));
SELECT LENGTH(a), CHAR_LENGTH(a), RIGHT(a,3) FROM t1;
DROP TABLE t1;
--echo # --echo #
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo # --echo #

View File

@@ -4149,3 +4149,21 @@ c
# #
# End of 10.2 tests # End of 10.2 tests
# #
#
# Start of 10.5 tests
#
#
# MDEV-24584 Selecting INT column with COLLATE utf8mb4_general_ci throws an error
#
SET NAMES utf8mb4;
SELECT 1 COLLATE utf8mb4_general_ci;
1 COLLATE utf8mb4_general_ci
1
SELECT 1 COLLATE utf8mb4_bin;
1 COLLATE utf8mb4_bin
1
SELECT 1 COLLATE latin1_swedish_ci;
ERROR 42000: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
#
# End of 10.5 tests
#

View File

@@ -2043,3 +2043,22 @@ EXECUTE IMMEDIATE 'SELECT ''😎'' AS c';
--echo # --echo #
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo # --echo #
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # MDEV-24584 Selecting INT column with COLLATE utf8mb4_general_ci throws an error
--echo #
SET NAMES utf8mb4;
SELECT 1 COLLATE utf8mb4_general_ci;
SELECT 1 COLLATE utf8mb4_bin;
--error ER_COLLATION_CHARSET_MISMATCH
SELECT 1 COLLATE latin1_swedish_ci;
--echo #
--echo # End of 10.5 tests
--echo #

View File

@@ -597,17 +597,17 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL, `a` int(11) DEFAULT NULL,
UNIQUE KEY `db_row_hash_1` (`db_row_hash_1`), UNIQUE KEY `db_row_hash_1` (`db_row_hash_1`),
UNIQUE KEY `db_row_hash_2` (`db_row_hash_2`), UNIQUE KEY `db_row_hash_2` (`db_row_hash_2`),
UNIQUE KEY `d` (`d`) USING HASH,
UNIQUE KEY `e` (`e`), UNIQUE KEY `e` (`e`),
UNIQUE KEY `a` (`a`), UNIQUE KEY `a` (`a`)
UNIQUE KEY `d` (`d`) USING HASH
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
show keys from t1; show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
t1 0 db_row_hash_1 1 db_row_hash_1 A NULL NULL NULL YES BTREE NO t1 0 db_row_hash_1 1 db_row_hash_1 A NULL NULL NULL YES BTREE NO
t1 0 db_row_hash_2 1 db_row_hash_2 A NULL NULL NULL YES BTREE NO t1 0 db_row_hash_2 1 db_row_hash_2 A NULL NULL NULL YES BTREE NO
t1 0 d 1 d A NULL NULL NULL YES HASH NO
t1 0 e 1 e A NULL NULL NULL YES BTREE NO t1 0 e 1 e A NULL NULL NULL YES BTREE NO
t1 0 a 1 a A NULL NULL NULL YES BTREE NO t1 0 a 1 a A NULL NULL NULL YES BTREE NO
t1 0 d 1 d A NULL NULL NULL YES HASH NO
alter table t1 add column clm1 blob unique,add column clm2 blob unique; alter table t1 add column clm1 blob unique,add column clm2 blob unique;
#try changing the name; #try changing the name;
alter table t1 change column clm1 clm_changed1 blob, change column clm2 clm_changed2 blob; alter table t1 change column clm1 clm_changed1 blob, change column clm2 clm_changed2 blob;
@@ -1494,3 +1494,4 @@ DROP TABLE t1, t2;
CREATE TABLE t1 (pk INT, a TEXT NOT NULL DEFAULT '', PRIMARY KEY (pk), b INT AUTO_INCREMENT, UNIQUE(b), UNIQUE (a,b)) ENGINE=myisam; CREATE TABLE t1 (pk INT, a TEXT NOT NULL DEFAULT '', PRIMARY KEY (pk), b INT AUTO_INCREMENT, UNIQUE(b), UNIQUE (a,b)) ENGINE=myisam;
ERROR HY000: AUTO_INCREMENT column `b` cannot be used in the UNIQUE index `a` ERROR HY000: AUTO_INCREMENT column `b` cannot be used in the UNIQUE index `a`
set @@GLOBAL.max_allowed_packet= @allowed_packet; set @@GLOBAL.max_allowed_packet= @allowed_packet;
# End of 10.4 tests

View File

@@ -575,3 +575,4 @@ CREATE TABLE t1 (pk INT, a TEXT NOT NULL DEFAULT '', PRIMARY KEY (pk), b INT AUT
# Cleanup # Cleanup
set @@GLOBAL.max_allowed_packet= @allowed_packet; set @@GLOBAL.max_allowed_packet= @allowed_packet;
--echo # End of 10.4 tests

View File

@@ -291,6 +291,21 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par
t2 0 a 1 a A NULL NULL NULL YES HASH NO t2 0 a 1 a A NULL NULL NULL YES HASH NO
t2 0 a 2 b A NULL NULL NULL YES HASH NO t2 0 a 2 b A NULL NULL NULL YES HASH NO
DROP TABLE t1,t2; DROP TABLE t1,t2;
#
# MDEV-26453 Assertion `0' failed in row_upd_sec_index_entry & corruption
#
CREATE TABLE t (c INT AUTO_INCREMENT KEY, UNIQUE USING HASH(c));
ERROR HY000: Function or expression 'AUTO_INCREMENT' cannot be used in the USING HASH clause of `c`
CREATE TABLE t (c INT AUTO_INCREMENT KEY);
CREATE UNIQUE INDEX i USING HASH ON t (c);
ERROR HY000: Function or expression 'AUTO_INCREMENT' cannot be used in the USING HASH clause of `c`
INSERT INTO t VALUES (0);
SELECT * FROM t;
c
1
DELETE FROM t;
DROP TABLE t;
# End of 10.4 tests
create temporary table tmp ( a int, b int, c blob not null, d int, e int default 0, f int, unique key (c)) engine=innodb; create temporary table tmp ( a int, b int, c blob not null, d int, e int default 0, f int, unique key (c)) engine=innodb;
create table t2 (x int); create table t2 (x int);
lock table t2 write; lock table t2 write;

View File

@@ -370,6 +370,24 @@ show index from t2;
# Cleanup # Cleanup
DROP TABLE t1,t2; DROP TABLE t1,t2;
--echo #
--echo # MDEV-26453 Assertion `0' failed in row_upd_sec_index_entry & corruption
--echo #
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t (c INT AUTO_INCREMENT KEY, UNIQUE USING HASH(c));
CREATE TABLE t (c INT AUTO_INCREMENT KEY);
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE UNIQUE INDEX i USING HASH ON t (c);
INSERT INTO t VALUES (0);
SELECT * FROM t;
DELETE FROM t;
DROP TABLE t;
--echo # End of 10.4 tests
# #
# MDEV-22113 SIGSEGV, ASAN use-after-poison, Assertion `next_insert_id == 0' in handler::ha_external_lock # MDEV-22113 SIGSEGV, ASAN use-after-poison, Assertion `next_insert_id == 0' in handler::ha_external_lock
# #

View File

@@ -4,14 +4,14 @@ OPTIMIZER_TRACE QUERY
OPTIMIZER_TRACE TRACE OPTIMIZER_TRACE TRACE
OPTIMIZER_TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE OPTIMIZER_TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE
OPTIMIZER_TRACE INSUFFICIENT_PRIVILEGES OPTIMIZER_TRACE INSUFFICIENT_PRIVILEGES
show variables like 'optimizer_trace';
Variable_name Value
optimizer_trace enabled=off
set optimizer_trace="enabled=on"; set optimizer_trace="enabled=on";
show variables like 'optimizer_trace'; show variables like 'optimizer_trace';
Variable_name Value Variable_name Value
optimizer_trace enabled=on optimizer_trace enabled=on
set optimizer_trace="enabled=off"; set optimizer_trace="enabled=off";
show variables like 'optimizer_trace';
Variable_name Value
optimizer_trace enabled=off
create table t1 (a int, b int); create table t1 (a int, b int);
insert into t1 values (1,2),(2,3); insert into t1 values (1,2),(2,3);
create table t2 (b int); create table t2 (b int);

View File

@@ -2,10 +2,10 @@
--source include/have_sequence.inc --source include/have_sequence.inc
--source include/protocol.inc --source include/protocol.inc
SELECT table_name, column_name FROM information_schema.columns where table_name="OPTIMIZER_TRACE"; SELECT table_name, column_name FROM information_schema.columns where table_name="OPTIMIZER_TRACE";
show variables like 'optimizer_trace';
set optimizer_trace="enabled=on"; set optimizer_trace="enabled=on";
show variables like 'optimizer_trace'; show variables like 'optimizer_trace';
set optimizer_trace="enabled=off"; set optimizer_trace="enabled=off";
show variables like 'optimizer_trace';
create table t1 (a int, b int); create table t1 (a int, b int);
insert into t1 values (1,2),(2,3); insert into t1 values (1,2),(2,3);

View File

@@ -0,0 +1,8 @@
# Verify that compile-time default for optimizer trace is OFF (enabled=off).
select
global_value_origin,
default_value
from
INFORMATION_SCHEMA.SYSTEM_VARIABLES where variable_name='optimizer_trace';
global_value_origin default_value
COMPILE-TIME enabled=off

View File

@@ -0,0 +1,11 @@
if (`SELECT 'COMPILE-TIME'<>GLOBAL_VALUE_ORIGIN from INFORMATION_SCHEMA.SYSTEM_VARIABLES where variable_name='optimizer_trace'`) {
--Skip Needs optimizer_trace default to be the compile-time default
}
--echo # Verify that compile-time default for optimizer trace is OFF (enabled=off).
select
global_value_origin,
default_value
from
INFORMATION_SCHEMA.SYSTEM_VARIABLES where variable_name='optimizer_trace';

View File

@@ -19,6 +19,7 @@ mysql/innodb_table_stats
mysql/transaction_registry mysql/transaction_registry
test/t1 test/t1
test/t2 test/t2
FLUSH TABLES t1,t2,t3 FOR EXPORT;
# t1 yes on expecting NOT FOUND # t1 yes on expecting NOT FOUND
NOT FOUND /foobarsecret/ in t1.ibd NOT FOUND /foobarsecret/ in t1.ibd
# t2 ... on expecting NOT FOUND # t2 ... on expecting NOT FOUND
@@ -27,7 +28,7 @@ NOT FOUND /tempsecret/ in t2.ibd
FOUND 12 /dummysecret/ in t3.ibd FOUND 12 /dummysecret/ in t3.ibd
# ibdata1 expecting NOT FOUND # ibdata1 expecting NOT FOUND
NOT FOUND /foobarsecret/ in ibdata1 NOT FOUND /foobarsecret/ in ibdata1
# restart UNLOCK TABLES;
# Now turn off encryption and wait for threads to decrypt everything # Now turn off encryption and wait for threads to decrypt everything
SET GLOBAL innodb_encrypt_tables = off; SET GLOBAL innodb_encrypt_tables = off;
# Wait max 10 min for key encryption threads to decrypt all spaces # Wait max 10 min for key encryption threads to decrypt all spaces
@@ -42,6 +43,7 @@ test/t3
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
NAME NAME
test/t1 test/t1
FLUSH TABLES t1,t2,t3 FOR EXPORT;
# t1 yes on expecting NOT FOUND # t1 yes on expecting NOT FOUND
NOT FOUND /foobarsecret/ in t1.ibd NOT FOUND /foobarsecret/ in t1.ibd
# t2 ... default expecting FOUND # t2 ... default expecting FOUND
@@ -50,7 +52,7 @@ FOUND 12 /tempsecret/ in t2.ibd
FOUND 12 /dummysecret/ in t3.ibd FOUND 12 /dummysecret/ in t3.ibd
# ibdata1 expecting NOT FOUND # ibdata1 expecting NOT FOUND
NOT FOUND /foobarsecret/ in ibdata1 NOT FOUND /foobarsecret/ in ibdata1
# restart UNLOCK TABLES;
# Now turn on encryption and wait for threads to encrypt all spaces # Now turn on encryption and wait for threads to encrypt all spaces
SET GLOBAL innodb_encrypt_tables = on; SET GLOBAL innodb_encrypt_tables = on;
# Wait max 10 min for key encryption threads to encrypt all spaces # Wait max 10 min for key encryption threads to encrypt all spaces
@@ -65,6 +67,7 @@ mysql/innodb_table_stats
mysql/transaction_registry mysql/transaction_registry
test/t1 test/t1
test/t2 test/t2
FLUSH TABLES t1,t2,t3 FOR EXPORT;
# t1 yes on expecting NOT FOUND # t1 yes on expecting NOT FOUND
NOT FOUND /foobarsecret/ in t1.ibd NOT FOUND /foobarsecret/ in t1.ibd
# t2 ... on expecting NOT FOUND # t2 ... on expecting NOT FOUND
@@ -73,5 +76,5 @@ NOT FOUND /tempsecret/ in t2.ibd
FOUND 12 /dummysecret/ in t3.ibd FOUND 12 /dummysecret/ in t3.ibd
# ibdata1 expecting NOT FOUND # ibdata1 expecting NOT FOUND
NOT FOUND /foobarsecret/ in ibdata1 NOT FOUND /foobarsecret/ in ibdata1
# restart UNLOCK TABLES;
drop table t1, t2, t3; drop table t1, t2, t3;

View File

@@ -1,9 +1,6 @@
-- source include/have_innodb.inc -- source include/have_innodb.inc
-- source include/have_file_key_management_plugin.inc -- source include/have_file_key_management_plugin.inc
# embedded does not support restart
-- source include/not_embedded.inc
# #
# MDEV-8138: strange results from encrypt-and-grep test # MDEV-8138: strange results from encrypt-and-grep test
# #
@@ -35,7 +32,7 @@ SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_
--sorted_result --sorted_result
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
--source include/shutdown_mysqld.inc FLUSH TABLES t1,t2,t3 FOR EXPORT;
--let SEARCH_PATTERN=foobarsecret --let SEARCH_PATTERN=foobarsecret
--echo # t1 yes on expecting NOT FOUND --echo # t1 yes on expecting NOT FOUND
@@ -54,7 +51,7 @@ SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_
-- let SEARCH_FILE=$ib1_IBD -- let SEARCH_FILE=$ib1_IBD
-- source include/search_pattern_in_file.inc -- source include/search_pattern_in_file.inc
-- source include/start_mysqld.inc UNLOCK TABLES;
--echo # Now turn off encryption and wait for threads to decrypt everything --echo # Now turn off encryption and wait for threads to decrypt everything
@@ -71,7 +68,7 @@ SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_
--sorted_result --sorted_result
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
--source include/shutdown_mysqld.inc FLUSH TABLES t1,t2,t3 FOR EXPORT;
--let SEARCH_PATTERN=foobarsecret --let SEARCH_PATTERN=foobarsecret
--echo # t1 yes on expecting NOT FOUND --echo # t1 yes on expecting NOT FOUND
@@ -90,8 +87,7 @@ SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_
-- let SEARCH_FILE=$ib1_IBD -- let SEARCH_FILE=$ib1_IBD
-- source include/search_pattern_in_file.inc -- source include/search_pattern_in_file.inc
UNLOCK TABLES;
-- source include/start_mysqld.inc
--echo # Now turn on encryption and wait for threads to encrypt all spaces --echo # Now turn on encryption and wait for threads to encrypt all spaces
SET GLOBAL innodb_encrypt_tables = on; SET GLOBAL innodb_encrypt_tables = on;
@@ -106,7 +102,7 @@ SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_
--sorted_result --sorted_result
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
--source include/shutdown_mysqld.inc FLUSH TABLES t1,t2,t3 FOR EXPORT;
--let SEARCH_PATTERN=foobarsecret --let SEARCH_PATTERN=foobarsecret
--echo # t1 yes on expecting NOT FOUND --echo # t1 yes on expecting NOT FOUND
@@ -125,6 +121,6 @@ SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_
-- let SEARCH_FILE=$ib1_IBD -- let SEARCH_FILE=$ib1_IBD
-- source include/search_pattern_in_file.inc -- source include/search_pattern_in_file.inc
-- source include/start_mysqld.inc UNLOCK TABLES;
drop table t1, t2, t3; drop table t1, t2, t3;

View File

@@ -0,0 +1,28 @@
SET DEFAULT_STORAGE_ENGINE=InnoDB;
#
# Start of 10.2 tests
#
#
# MDEV-24901 SIGSEGV in fts_get_table_name, SIGSEGV in ib_vector_size, SIGSEGV in row_merge_fts_doc_tokenize, stack smashing Export
#
CREATE TABLE t1(c TEXT CHARACTER SET tis620);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` text CHARACTER SET tis620 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES('100');
ALTER TABLE t1 ADD FULLTEXT INDEX(c), ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1(c TEXT CHARACTER SET tis620 COLLATE tis620_thai_nopad_ci);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` text CHARACTER SET tis620 COLLATE tis620_thai_nopad_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES('100');
ALTER TABLE t1 ADD FULLTEXT INDEX(c), ALGORITHM=INPLACE;
DROP TABLE t1;
#
# End of 10.2 tests
#

View File

@@ -0,0 +1,29 @@
--source include/have_innodb.inc
--source include/have_tis620.inc
SET DEFAULT_STORAGE_ENGINE=InnoDB;
--echo #
--echo # Start of 10.2 tests
--echo #
--echo #
--echo # MDEV-24901 SIGSEGV in fts_get_table_name, SIGSEGV in ib_vector_size, SIGSEGV in row_merge_fts_doc_tokenize, stack smashing Export
--echo #
CREATE TABLE t1(c TEXT CHARACTER SET tis620);
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES('100');
ALTER TABLE t1 ADD FULLTEXT INDEX(c), ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1(c TEXT CHARACTER SET tis620 COLLATE tis620_thai_nopad_ci);
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES('100');
ALTER TABLE t1 ADD FULLTEXT INDEX(c), ALGORITHM=INPLACE;
DROP TABLE t1;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@@ -2882,3 +2882,14 @@ insert into t1 values (8,'0');
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
unlock tables; unlock tables;
drop table t1; drop table t1;
#
# MDEV-22284 Aria table key read crash because wrong index used
#
create table t1 (
a int auto_increment,
b int, c int,
key(c, a), unique(b)
) engine aria
partition by hash (b);
replace into t1 values (1, 0, 0), (2, 0, 0), (0, 0, 0);
drop table t1;

View File

@@ -2099,3 +2099,16 @@ aria_page_checksum=$default_checksum,
aria_log_file_size=$default_log_file_size; aria_log_file_size=$default_log_file_size;
--enable_result_log --enable_result_log
--enable_query_log --enable_query_log
--echo #
--echo # MDEV-22284 Aria table key read crash because wrong index used
--echo #
create table t1 (
a int auto_increment,
b int, c int,
key(c, a), unique(b)
) engine aria
partition by hash (b);
replace into t1 values (1, 0, 0), (2, 0, 0), (0, 0, 0);
# cleanup
drop table t1;

View File

@@ -8,6 +8,7 @@
# Finish the following tests by calling its common test script: # Finish the following tests by calling its common test script:
# include/rpl_get_master_version_and_clock.test. # include/rpl_get_master_version_and_clock.test.
source include/not_valgrind.inc;
source include/have_debug.inc; source include/have_debug.inc;
source include/have_debug_sync.inc; source include/have_debug_sync.inc;
source include/master-slave.inc; source include/master-slave.inc;

View File

@@ -9,6 +9,7 @@
# Verify row-based events applying when table map id value is about and greater # Verify row-based events applying when table map id value is about and greater
# than 1 << 32. # than 1 << 32.
################################################################## ##################################################################
--source include/not_valgrind.inc
--source include/word_size.inc --source include/word_size.inc
--source include/have_debug.inc --source include/have_debug.inc
--source include/have_binlog_format_row.inc --source include/have_binlog_format_row.inc

View File

@@ -611,3 +611,28 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING ) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
drop table t1; drop table t1;
#
# MDEV-26928 Column-inclusive WITH SYSTEM VERSIONING doesn't work with explicit system fields
#
create or replace table t1 (x int, y int with system versioning);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`x` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING,
`y` int(11) DEFAULT NULL
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
create or replace table t1 (
x int, y int with system versioning,
row_start timestamp(6) as row start,
row_end timestamp(6) as row end,
period for system_time(row_start, row_end));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`x` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING,
`y` int(11) DEFAULT NULL,
`row_start` timestamp(6) GENERATED ALWAYS AS ROW START WITHOUT SYSTEM VERSIONING,
`row_end` timestamp(6) GENERATED ALWAYS AS ROW END WITHOUT SYSTEM VERSIONING,
PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`)
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
drop table t1;

View File

@@ -998,8 +998,7 @@ delete from t1;
delete from t1; delete from t1;
check table t1; check table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check note Not supported for non-INTERVAL history partitions test.t1 check status OK
test.t1 check note The storage engine for the table doesn't support check
drop table t1; drop table t1;
# #
# MDEV-21233 Assertion `m_extra_cache' failed in ha_partition::late_extra_cache # MDEV-21233 Assertion `m_extra_cache' failed in ha_partition::late_extra_cache

View File

@@ -454,3 +454,20 @@ show index from t1;
--replace_result $default_engine DEFAULT_ENGINE --replace_result $default_engine DEFAULT_ENGINE
show create table t1; show create table t1;
drop table t1; drop table t1;
--echo #
--echo # MDEV-26928 Column-inclusive WITH SYSTEM VERSIONING doesn't work with explicit system fields
--echo #
create or replace table t1 (x int, y int with system versioning);
--replace_result $default_engine DEFAULT_ENGINE
show create table t1;
create or replace table t1 (
x int, y int with system versioning,
row_start timestamp(6) as row start,
row_end timestamp(6) as row end,
period for system_time(row_start, row_end));
--replace_result $default_engine DEFAULT_ENGINE
show create table t1;
drop table t1;

View File

@@ -517,6 +517,7 @@ enum enum_vcol_info_type
{ {
VCOL_GENERATED_VIRTUAL, VCOL_GENERATED_STORED, VCOL_GENERATED_VIRTUAL, VCOL_GENERATED_STORED,
VCOL_DEFAULT, VCOL_CHECK_FIELD, VCOL_CHECK_TABLE, VCOL_DEFAULT, VCOL_CHECK_FIELD, VCOL_CHECK_TABLE,
VCOL_USING_HASH,
/* Additional types should be added here */ /* Additional types should be added here */
/* Following is the highest value last */ /* Following is the highest value last */
VCOL_TYPE_NONE = 127 // Since the 0 value is already in use VCOL_TYPE_NONE = 127 // Since the 0 value is already in use
@@ -534,6 +535,8 @@ static inline const char *vcol_type_name(enum_vcol_info_type type)
case VCOL_CHECK_FIELD: case VCOL_CHECK_FIELD:
case VCOL_CHECK_TABLE: case VCOL_CHECK_TABLE:
return "CHECK"; return "CHECK";
case VCOL_USING_HASH:
return "USING HASH";
case VCOL_TYPE_NONE: case VCOL_TYPE_NONE:
return "UNTYPED"; return "UNTYPED";
} }

View File

@@ -1203,7 +1203,6 @@ static const LEX_CSTRING opt_op_name[]=
}; };
static const LEX_CSTRING msg_note= { STRING_WITH_LEN("note") };
static const LEX_CSTRING msg_warning= { STRING_WITH_LEN("warning") }; static const LEX_CSTRING msg_warning= { STRING_WITH_LEN("warning") };
#define msg_error error_clex_str #define msg_error error_clex_str
@@ -11068,11 +11067,8 @@ int ha_partition::check_misplaced_rows(uint read_part_id, bool do_repair)
read_part_id != m_part_info->vers_info->now_part->id && read_part_id != m_part_info->vers_info->now_part->id &&
!m_part_info->vers_info->interval.is_set()) !m_part_info->vers_info->interval.is_set())
{ {
print_admin_msg(ha_thd(), MYSQL_ERRMSG_SIZE, &msg_note, /* Skip this check as it is not supported for non-INTERVAL history partitions. */
table_share->db.str, table->alias, DBUG_RETURN(HA_ADMIN_OK);
&opt_op_name[CHECK_PARTS],
"Not supported for non-INTERVAL history partitions");
DBUG_RETURN(HA_ADMIN_NOT_IMPLEMENTED);
} }
if (do_repair) if (do_repair)

View File

@@ -8285,15 +8285,16 @@ bool Table_scope_and_contents_source_st::vers_fix_system_fields(
if (!vers_info.need_check(alter_info)) if (!vers_info.need_check(alter_info))
return false; return false;
if (!vers_info.versioned_fields && vers_info.unversioned_fields && const bool add_versioning= alter_info->flags & ALTER_ADD_SYSTEM_VERSIONING;
!(alter_info->flags & ALTER_ADD_SYSTEM_VERSIONING))
if (!vers_info.versioned_fields && vers_info.unversioned_fields && !add_versioning)
{ {
// All is correct but this table is not versioned. // All is correct but this table is not versioned.
options&= ~HA_VERSIONED_TABLE; options&= ~HA_VERSIONED_TABLE;
return false; return false;
} }
if (!(alter_info->flags & ALTER_ADD_SYSTEM_VERSIONING) && vers_info) if (!add_versioning && vers_info && !vers_info.versioned_fields)
{ {
my_error(ER_MISSING, MYF(0), create_table.table_name.str, my_error(ER_MISSING, MYF(0), create_table.table_name.str,
"WITH SYSTEM VERSIONING"); "WITH SYSTEM VERSIONING");
@@ -8303,8 +8304,7 @@ bool Table_scope_and_contents_source_st::vers_fix_system_fields(
List_iterator<Create_field> it(alter_info->create_list); List_iterator<Create_field> it(alter_info->create_list);
while (Create_field *f= it++) while (Create_field *f= it++)
{ {
if ((f->versioning == Column_definition::VERSIONING_NOT_SET && if ((f->versioning == Column_definition::VERSIONING_NOT_SET && !add_versioning) ||
!(alter_info->flags & ALTER_ADD_SYSTEM_VERSIONING)) ||
f->versioning == Column_definition::WITHOUT_VERSIONING) f->versioning == Column_definition::WITHOUT_VERSIONING)
{ {
f->flags|= VERS_UPDATE_UNVERSIONED_FLAG; f->flags|= VERS_UPDATE_UNVERSIONED_FLAG;

View File

@@ -483,6 +483,7 @@ enum chf_create_flags {
#define HA_CREATE_TMP_ALTER 8U #define HA_CREATE_TMP_ALTER 8U
#define HA_LEX_CREATE_SEQUENCE 16U #define HA_LEX_CREATE_SEQUENCE 16U
#define HA_VERSIONED_TABLE 32U #define HA_VERSIONED_TABLE 32U
#define HA_SKIP_KEY_SORT 64U
#define HA_MAX_REC_LENGTH 65535 #define HA_MAX_REC_LENGTH 65535
@@ -789,11 +790,16 @@ typedef bool Log_func(THD*, TABLE*, bool, const uchar*, const uchar*);
*/ */
#define ALTER_COLUMN_INDEX_LENGTH (1ULL << 60) #define ALTER_COLUMN_INDEX_LENGTH (1ULL << 60)
/**
Indicate that index order might have been changed. Disables inplace algorithm
by default (not for InnoDB).
*/
#define ALTER_INDEX_ORDER (1ULL << 61)
/** /**
Means that the ignorability of an index is changed. Means that the ignorability of an index is changed.
*/ */
#define ALTER_INDEX_IGNORABILITY (1ULL << 61) #define ALTER_INDEX_IGNORABILITY (1ULL << 62)
/* /*
Flags set in partition_flags when altering partitions Flags set in partition_flags when altering partitions

View File

@@ -7695,6 +7695,19 @@ public:
}; };
/*
fix_escape_item() sets the out "escape" parameter to:
- native code in case of an 8bit character set
- Unicode code point in case of a multi-byte character set
The value meaning a not-initialized ESCAPE character must not be equal to
any valid value, so must be outside of these ranges:
- -128..+127, not to conflict with a valid 8bit charcter
- 0..0x10FFFF, not to conflict with a valid Unicode code point
The exact value does not matter.
*/
#define ESCAPE_NOT_INITIALIZED -1000
/* /*
It's used in ::fix_fields() methods of LIKE and JSON_SEARCH It's used in ::fix_fields() methods of LIKE and JSON_SEARCH
functions to handle the ESCAPE parameter. functions to handle the ESCAPE parameter.

View File

@@ -5607,7 +5607,7 @@ void Item_func_like::print(String *str, enum_query_type query_type)
longlong Item_func_like::val_int() longlong Item_func_like::val_int()
{ {
DBUG_ASSERT(fixed()); DBUG_ASSERT(fixed());
DBUG_ASSERT(escape != -1); DBUG_ASSERT(escape != ESCAPE_NOT_INITIALIZED);
String* res= args[0]->val_str(&cmp_value1); String* res= args[0]->val_str(&cmp_value1);
if (args[0]->null_value) if (args[0]->null_value)
{ {
@@ -5711,7 +5711,7 @@ bool fix_escape_item(THD *thd, Item *escape_item, String *tmp_str,
return TRUE; return TRUE;
} }
IF_DBUG(*escape= -1,); IF_DBUG(*escape= ESCAPE_NOT_INITIALIZED,);
if (escape_item->const_item()) if (escape_item->const_item())
{ {

View File

@@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2017, Oracle and/or its affiliates. Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2020, MariaDB Corporation. Copyright (c) 2009, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -3579,11 +3579,13 @@ String *Item_func_set_collation::val_str(String *str)
bool Item_func_set_collation::fix_length_and_dec() bool Item_func_set_collation::fix_length_and_dec()
{ {
if (!my_charset_same(args[0]->collation.collation, m_set_collation)) if (agg_arg_charsets_for_string_result(collation, args, 1))
return true;
if (!my_charset_same(collation.collation, m_set_collation))
{ {
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0), my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
m_set_collation->coll_name.str, m_set_collation->coll_name.str,
args[0]->collation.collation->cs_name.str); collation.collation->cs_name.str);
return TRUE; return TRUE;
} }
collation.set(m_set_collation, DERIVATION_EXPLICIT, collation.set(m_set_collation, DERIVATION_EXPLICIT,

View File

@@ -8524,7 +8524,6 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
{ {
/* Allow break with SIGINT, no core or stack trace */ /* Allow break with SIGINT, no core or stack trace */
test_flags|= TEST_SIGINT; test_flags|= TEST_SIGINT;
opt_stack_trace= 1;
test_flags&= ~TEST_CORE_ON_SIGNAL; test_flags&= ~TEST_CORE_ON_SIGNAL;
} }
/* Set global MyISAM variables from delay_key_write_options */ /* Set global MyISAM variables from delay_key_write_options */

View File

@@ -254,16 +254,8 @@ Alter_info::algorithm(const THD *thd) const
Alter_table_ctx::Alter_table_ctx() Alter_table_ctx::Alter_table_ctx()
: implicit_default_value_error_field(NULL), : db(null_clex_str), table_name(null_clex_str), alias(null_clex_str),
error_if_not_empty(false), new_db(null_clex_str), new_name(null_clex_str), new_alias(null_clex_str)
tables_opened(0),
db(null_clex_str), table_name(null_clex_str), alias(null_clex_str),
new_db(null_clex_str), new_name(null_clex_str), new_alias(null_clex_str),
fk_error_if_delete_row(false), fk_error_id(NULL),
fk_error_table(NULL)
#ifdef DBUG_ASSERT_EXISTS
, tmp_table(false)
#endif
{ {
} }
@@ -276,12 +268,8 @@ Alter_table_ctx::Alter_table_ctx(THD *thd, TABLE_LIST *table_list,
uint tables_opened_arg, uint tables_opened_arg,
const LEX_CSTRING *new_db_arg, const LEX_CSTRING *new_db_arg,
const LEX_CSTRING *new_name_arg) const LEX_CSTRING *new_name_arg)
: implicit_default_value_error_field(NULL), error_if_not_empty(false), : tables_opened(tables_opened_arg),
tables_opened(tables_opened_arg), new_db(*new_db_arg), new_name(*new_name_arg)
new_db(*new_db_arg), new_name(*new_name_arg),
fk_error_if_delete_row(false), fk_error_id(NULL),
fk_error_table(NULL),
tmp_table(false)
{ {
/* /*
Assign members db, table_name, new_db and new_name Assign members db, table_name, new_db and new_name

View File

@@ -1,5 +1,5 @@
/* Copyright (c) 2010, 2014, Oracle and/or its affiliates. /* Copyright (c) 2010, 2014, Oracle and/or its affiliates.
Copyright (c) 2013, 2020, MariaDB Corporation. Copyright (c) 2013, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -313,9 +313,9 @@ public:
void report_implicit_default_value_error(THD *thd, const TABLE_SHARE *) const; void report_implicit_default_value_error(THD *thd, const TABLE_SHARE *) const;
public: public:
Create_field *implicit_default_value_error_field; Create_field *implicit_default_value_error_field= nullptr;
bool error_if_not_empty; bool error_if_not_empty= false;
uint tables_opened; uint tables_opened= 0;
LEX_CSTRING db; LEX_CSTRING db;
LEX_CSTRING table_name; LEX_CSTRING table_name;
LEX_CSTRING storage_engine_name; LEX_CSTRING storage_engine_name;
@@ -337,13 +337,14 @@ public:
of table to the new version ER_FK_CANNOT_DELETE_PARENT error should be of table to the new version ER_FK_CANNOT_DELETE_PARENT error should be
emitted. emitted.
*/ */
bool fk_error_if_delete_row; bool fk_error_if_delete_row= false;
/** Name of foreign key for the above error. */ /** Name of foreign key for the above error. */
const char *fk_error_id; const char *fk_error_id= nullptr;
/** Name of table for the above error. */ /** Name of table for the above error. */
const char *fk_error_table; const char *fk_error_table= nullptr;
bool modified_primary_key= false;
/** Indicates that we are altering temporary table */ /** Indicates that we are altering temporary table */
bool tmp_table; bool tmp_table= false;
private: private:
char new_filename[FN_REFLEN + 1]; char new_filename[FN_REFLEN + 1];

View File

@@ -3452,9 +3452,30 @@ without_overlaps_err:
my_message(ER_WRONG_AUTO_KEY, ER_THD(thd, ER_WRONG_AUTO_KEY), MYF(0)); my_message(ER_WRONG_AUTO_KEY, ER_THD(thd, ER_WRONG_AUTO_KEY), MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
/* Sort keys in optimized order */ /*
We cannot do qsort of key info if MyISAM/Aria does inplace. These engines
do not synchronise key info on inplace alter and that qsort is
indeterministic (MDEV-25803).
Yet we do not know whether we do inplace or not. That detection is done
after this create_table_impl() and that cannot be changed because of chicken
and egg problem (inplace processing requires key info made by
create_table_impl()).
MyISAM/Aria cannot add index inplace so we are safe to qsort key info in
that case. And if we don't add index then we do not need qsort at all.
*/
if (!(create_info->options & HA_SKIP_KEY_SORT))
{
/*
Sort keys in optimized order.
Note: PK must be always first key, otherwise init_from_binary_frm_image()
can not understand it.
*/
my_qsort((uchar*) *key_info_buffer, *key_count, sizeof(KEY), my_qsort((uchar*) *key_info_buffer, *key_count, sizeof(KEY),
(qsort_cmp) sort_keys); (qsort_cmp) sort_keys);
}
create_info->null_bits= null_fields; create_info->null_bits= null_fields;
/* Check fields. */ /* Check fields. */
@@ -7668,7 +7689,6 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
uint used_fields, dropped_sys_vers_fields= 0; uint used_fields, dropped_sys_vers_fields= 0;
KEY *key_info=table->key_info; KEY *key_info=table->key_info;
bool rc= TRUE; bool rc= TRUE;
bool modified_primary_key= FALSE;
bool vers_system_invisible= false; bool vers_system_invisible= false;
Create_field *def; Create_field *def;
Field **f_ptr,*field; Field **f_ptr,*field;
@@ -8092,6 +8112,12 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
if (key_info->flags & HA_INVISIBLE_KEY) if (key_info->flags & HA_INVISIBLE_KEY)
continue; continue;
const char *key_name= key_info->name.str; const char *key_name= key_info->name.str;
const bool primary_key= table->s->primary_key == i;
const bool explicit_pk= primary_key &&
!my_strcasecmp(system_charset_info, key_name,
primary_key_name.str);
const bool implicit_pk= primary_key && !explicit_pk;
Alter_drop *drop; Alter_drop *drop;
drop_it.rewind(); drop_it.rewind();
while ((drop=drop_it++)) while ((drop=drop_it++))
@@ -8105,7 +8131,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
if (table->s->tmp_table == NO_TMP_TABLE) if (table->s->tmp_table == NO_TMP_TABLE)
{ {
(void) delete_statistics_for_index(thd, table, key_info, FALSE); (void) delete_statistics_for_index(thd, table, key_info, FALSE);
if (i == table->s->primary_key) if (primary_key)
{ {
KEY *tab_key_info= table->key_info; KEY *tab_key_info= table->key_info;
for (uint j=0; j < table->s->keys; j++, tab_key_info++) for (uint j=0; j < table->s->keys; j++, tab_key_info++)
@@ -8204,13 +8230,19 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
} }
if (!cfield) if (!cfield)
{ {
if (table->s->primary_key == i) if (primary_key)
modified_primary_key= TRUE; alter_ctx->modified_primary_key= true;
delete_index_stat= TRUE; delete_index_stat= TRUE;
if (!(kfield->flags & VERS_SYSTEM_FIELD)) if (!(kfield->flags & VERS_SYSTEM_FIELD))
dropped_key_part= key_part_name; dropped_key_part= key_part_name;
continue; // Field is removed continue; // Field is removed
} }
DBUG_ASSERT(!primary_key || kfield->flags & NOT_NULL_FLAG);
if (implicit_pk && !alter_ctx->modified_primary_key &&
!(cfield->flags & NOT_NULL_FLAG))
alter_ctx->modified_primary_key= true;
key_part_length= key_part->length; key_part_length= key_part->length;
if (cfield->field) // Not new field if (cfield->field) // Not new field
{ {
@@ -8259,7 +8291,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
{ {
if (delete_index_stat) if (delete_index_stat)
(void) delete_statistics_for_index(thd, table, key_info, FALSE); (void) delete_statistics_for_index(thd, table, key_info, FALSE);
else if (modified_primary_key && else if (alter_ctx->modified_primary_key &&
key_info->user_defined_key_parts != key_info->ext_key_parts) key_info->user_defined_key_parts != key_info->ext_key_parts)
(void) delete_statistics_for_index(thd, table, key_info, TRUE); (void) delete_statistics_for_index(thd, table, key_info, TRUE);
} }
@@ -8304,7 +8336,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
key_type= Key::SPATIAL; key_type= Key::SPATIAL;
else if (key_info->flags & HA_NOSAME) else if (key_info->flags & HA_NOSAME)
{ {
if (! my_strcasecmp(system_charset_info, key_name, primary_key_name.str)) if (explicit_pk)
key_type= Key::PRIMARY; key_type= Key::PRIMARY;
else else
key_type= Key::UNIQUE; key_type= Key::UNIQUE;
@@ -10037,6 +10069,10 @@ do_continue:;
tmp_disable_binlog(thd); tmp_disable_binlog(thd);
create_info->options|=HA_CREATE_TMP_ALTER; create_info->options|=HA_CREATE_TMP_ALTER;
if (!(alter_info->flags & ALTER_ADD_INDEX) && !alter_ctx.modified_primary_key)
create_info->options|= HA_SKIP_KEY_SORT;
else
alter_info->flags|= ALTER_INDEX_ORDER;
create_info->alias= alter_ctx.table_name; create_info->alias= alter_ctx.table_name;
/* /*
Create the .frm file for the new table. Storage engine table will not be Create the .frm file for the new table. Storage engine table will not be
@@ -10095,7 +10131,7 @@ do_continue:;
*/ */
if (!(ha_alter_info.handler_flags & if (!(ha_alter_info.handler_flags &
~(ALTER_COLUMN_ORDER | ALTER_RENAME_COLUMN))) ~(ALTER_COLUMN_ORDER | ALTER_RENAME_COLUMN | ALTER_INDEX_ORDER)))
{ {
/* /*
No-op ALTER, no need to call handler API functions. No-op ALTER, no need to call handler API functions.
@@ -10110,6 +10146,9 @@ do_continue:;
Also note that we ignore the LOCK clause here. Also note that we ignore the LOCK clause here.
TODO don't create partitioning metadata in the first place TODO don't create partitioning metadata in the first place
TODO: Now case-change index name is treated as noop which is not quite
correct.
*/ */
table->file->ha_create_partitioning_metadata(alter_ctx.get_tmp_path(), table->file->ha_create_partitioning_metadata(alter_ctx.get_tmp_path(),
NULL, CHF_DELETE_FLAG); NULL, CHF_DELETE_FLAG);

View File

@@ -1119,6 +1119,8 @@ static void mysql57_calculate_null_position(TABLE_SHARE *share,
} }
} }
static bool fix_and_check_vcol_expr(THD *thd, TABLE *table,
Virtual_column_info *vcol);
/** Parse TABLE_SHARE::vcol_defs /** Parse TABLE_SHARE::vcol_defs
@@ -1304,6 +1306,9 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
Virtual_column_info *v= new (mem_root) Virtual_column_info(); Virtual_column_info *v= new (mem_root) Virtual_column_info();
field->vcol_info= v; field->vcol_info= v;
field->vcol_info->expr= hash_item; field->vcol_info->expr= hash_item;
field->vcol_info->set_vcol_type(VCOL_USING_HASH);
if (fix_and_check_vcol_expr(thd, table, v))
goto end;
key->user_defined_key_parts= key->ext_key_parts= key->usable_key_parts= 1; key->user_defined_key_parts= key->ext_key_parts= key->usable_key_parts= 1;
key->key_part+= parts; key->key_part+= parts;

View File

@@ -7208,7 +7208,8 @@ ha_connect::check_if_supported_inplace_alter(TABLE *altered_table,
ALTER_ADD_UNIQUE_INDEX | ALTER_ADD_UNIQUE_INDEX |
ALTER_DROP_UNIQUE_INDEX | ALTER_DROP_UNIQUE_INDEX |
ALTER_ADD_PK_INDEX | ALTER_ADD_PK_INDEX |
ALTER_DROP_PK_INDEX; ALTER_DROP_PK_INDEX |
ALTER_INDEX_ORDER;
alter_table_operations inplace_offline_operations= alter_table_operations inplace_offline_operations=
ALTER_COLUMN_TYPE_CHANGE_BY_ENGINE | ALTER_COLUMN_TYPE_CHANGE_BY_ENGINE |

View File

@@ -113,6 +113,7 @@ static const alter_table_operations INNOBASE_INPLACE_IGNORE
| ALTER_VIRTUAL_GCOL_EXPR | ALTER_VIRTUAL_GCOL_EXPR
| ALTER_DROP_CHECK_CONSTRAINT | ALTER_DROP_CHECK_CONSTRAINT
| ALTER_RENAME | ALTER_RENAME
| ALTER_INDEX_ORDER
| ALTER_COLUMN_INDEX_LENGTH | ALTER_COLUMN_INDEX_LENGTH
| ALTER_CHANGE_INDEX_COMMENT | ALTER_CHANGE_INDEX_COMMENT
| ALTER_INDEX_IGNORABILITY; | ALTER_INDEX_IGNORABILITY;
@@ -2461,7 +2462,8 @@ next_column:
| ALTER_ADD_UNIQUE_INDEX | ALTER_ADD_UNIQUE_INDEX
*/ */
| ALTER_ADD_NON_UNIQUE_NON_PRIM_INDEX | ALTER_ADD_NON_UNIQUE_NON_PRIM_INDEX
| ALTER_DROP_NON_UNIQUE_NON_PRIM_INDEX); | ALTER_DROP_NON_UNIQUE_NON_PRIM_INDEX
| ALTER_INDEX_ORDER);
if (supports_instant) { if (supports_instant) {
flags &= ~(ALTER_DROP_STORED_COLUMN flags &= ~(ALTER_DROP_STORED_COLUMN
#if 0 /* MDEV-17468: remove check_v_col_in_order() and fix the code */ #if 0 /* MDEV-17468: remove check_v_col_in_order() and fix the code */

View File

@@ -80,7 +80,7 @@ que_node_t */
#include "que0que.h" #include "que0que.h"
#include "row0sel.h" #include "row0sel.h"
#ifdef __GNUC__ #if defined __GNUC__ && (!defined __clang_major__ || __clang_major__ > 11)
#pragma GCC diagnostic ignored "-Wfree-nonheap-object" #pragma GCC diagnostic ignored "-Wfree-nonheap-object"
#endif #endif

View File

@@ -38,7 +38,7 @@ que_node_t */
#include "que0que.h" #include "que0que.h"
#include "row0sel.h" #include "row0sel.h"
#ifdef __GNUC__ #if defined __GNUC__ && (!defined __clang_major__ || __clang_major__ > 11)
#pragma GCC diagnostic ignored "-Wfree-nonheap-object" #pragma GCC diagnostic ignored "-Wfree-nonheap-object"
#endif #endif

View File

@@ -736,6 +736,11 @@ static int table2maria(TABLE *table_arg, data_file_type row_type,
- compare SPATIAL keys; - compare SPATIAL keys;
- compare FIELD_SKIP_ZERO which is converted to FIELD_NORMAL correctly - compare FIELD_SKIP_ZERO which is converted to FIELD_NORMAL correctly
(should be correctly detected in table2maria). (should be correctly detected in table2maria).
FIXME:
maria_check_definition() is never used! CHECK TABLE does not detect the
corruption! Do maria_check_definition() like check_definition() is done
by MyISAM (related to MDEV-25803).
*/ */
int maria_check_definition(MARIA_KEYDEF *t1_keyinfo, int maria_check_definition(MARIA_KEYDEF *t1_keyinfo,

View File

@@ -210,7 +210,13 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function,
info->last_key.data + share->base.max_key_length*2, info->last_key.data + share->base.max_key_length*2,
info->save_lastkey_data_length + info->save_lastkey_ref_length); info->save_lastkey_data_length + info->save_lastkey_ref_length);
info->update= info->save_update | HA_STATE_WRITTEN; info->update= info->save_update | HA_STATE_WRITTEN;
info->lastinx= info->save_lastinx; if (info->lastinx != info->save_lastinx) /* Index changed */
{
info->lastinx = info->save_lastinx;
info->last_key.keyinfo= info->s->keyinfo + info->lastinx;
info->last_key.flag= 0;
info->page_changed=1;
}
info->cur_row.lastpos= info->save_lastpos; info->cur_row.lastpos= info->save_lastpos;
info->last_key.data_length= info->save_lastkey_data_length; info->last_key.data_length= info->save_lastkey_data_length;
info->last_key.ref_length= info->save_lastkey_ref_length; info->last_key.ref_length= info->save_lastkey_ref_length;

View File

@@ -713,7 +713,11 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
} }
#endif #endif
/* Write key and keyseg definitions */ /* Write key and keyseg definitions
TODO: update key and keyseg definitions for inplace alter (grep sql layer by
MDEV-25803). Do the same for Aria.
*/
DBUG_PRINT("info", ("write key and keyseg definitions")); DBUG_PRINT("info", ("write key and keyseg definitions"));
for (i=0 ; i < share.base.keys - uniques; i++) for (i=0 ; i < share.base.keys - uniques; i++)
{ {

View File

@@ -12454,6 +12454,7 @@ my_core::enum_alter_inplace_result ha_rocksdb::check_if_supported_inplace_alter(
ALTER_ADD_NON_UNIQUE_NON_PRIM_INDEX | ALTER_ADD_NON_UNIQUE_NON_PRIM_INDEX |
ALTER_PARTITIONED | ALTER_PARTITIONED |
ALTER_ADD_UNIQUE_INDEX | ALTER_ADD_UNIQUE_INDEX |
ALTER_INDEX_ORDER |
ALTER_CHANGE_CREATE_OPTION)) { ALTER_CHANGE_CREATE_OPTION)) {
DBUG_RETURN(my_core::HA_ALTER_INPLACE_NOT_SUPPORTED); DBUG_RETURN(my_core::HA_ALTER_INPLACE_NOT_SUPPORTED);
} }

View File

@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. /* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2009, 2020, MariaDB Corporation. Copyright (c) 2009, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -402,9 +402,9 @@ my_copy_fix_mb(CHARSET_INFO *cs,
size_t well_formed_nchars; size_t well_formed_nchars;
size_t well_formed_length; size_t well_formed_length;
size_t fixed_length; size_t fixed_length;
size_t min_length= MY_MIN(src_length, dst_length);
set_if_smaller(src_length, dst_length); well_formed_nchars= my_ci_well_formed_char_length(cs, src, src + min_length,
well_formed_nchars= my_ci_well_formed_char_length(cs, src, src + src_length,
nchars, status); nchars, status);
DBUG_ASSERT(well_formed_nchars <= nchars); DBUG_ASSERT(well_formed_nchars <= nchars);
well_formed_length= status->m_source_end_pos - src; well_formed_length= status->m_source_end_pos - src;

View File

@@ -609,8 +609,8 @@ my_strnxfrm_tis620(CHARSET_INFO *cs,
const uchar *src, size_t srclen, uint flags) const uchar *src, size_t srclen, uint flags)
{ {
size_t len, dstlen0= dstlen; size_t len, dstlen0= dstlen;
len= (uint) (strmake((char*) dst, (char*) src, MY_MIN(dstlen, srclen)) - len= MY_MIN(dstlen, srclen);
(char*) dst); memcpy(dst, src, len);
len= thai2sortable(dst, len); len= thai2sortable(dst, len);
set_if_smaller(dstlen, nweights); set_if_smaller(dstlen, nweights);
set_if_smaller(len, dstlen); set_if_smaller(len, dstlen);
@@ -632,8 +632,8 @@ my_strnxfrm_tis620_nopad(CHARSET_INFO *cs,
const uchar *src, size_t srclen, uint flags) const uchar *src, size_t srclen, uint flags)
{ {
size_t len, dstlen0= dstlen; size_t len, dstlen0= dstlen;
len= (uint) (strmake((char*) dst, (char*) src, MY_MIN(dstlen, srclen)) - len= MY_MIN(dstlen, srclen);
(char*) dst); memcpy(dst, src, len);
len= thai2sortable(dst, len); len= thai2sortable(dst, len);
set_if_smaller(dstlen, nweights); set_if_smaller(dstlen, nweights);
set_if_smaller(len, dstlen); set_if_smaller(len, dstlen);