Merge branch '10.4' into 10.5

This commit is contained in:
Oleksandr Byelkin 2023-08-01 08:15:42 +02:00
commit 65405308a1
10 changed files with 130 additions and 60 deletions

View file

@ -2770,11 +2770,7 @@ static uint dump_routines_for_db(char *db)
routine_type[i], routine_name);
if (mysql_query_with_error_report(mysql, &routine_res, query_buff))
{
mysql_free_result(routine_list_res);
routine_list_res= 0;
DBUG_RETURN(1);
}
continue;
while ((row= mysql_fetch_row(routine_res)))
{

View file

@ -6342,6 +6342,7 @@ END utf8 utf8_general_ci latin1_swedish_ci
DROP DATABASE test1;
DROP DATABASE test2;
SET sql_mode=@save_sql_mode;
use test;
#
# MDEV-4875 Can't restore a mysqldump if --add-drop-database meets general_log
#
@ -6435,4 +6436,67 @@ TABLE 1
SET GLOBAL LOG_OUTPUT=DEFAULT, GLOBAL GENERAL_LOG=@save_general_log;
TRUNCATE TABLE mysql.general_log;
DROP DATABASE test1;
#
# End of 10.3 tests
#
#
# MDEV-31092 mysqldump --force doesn't ignore error as it should
#
create function f1() returns int return 1;
create function f2() returns int return 2;
update mysql.proc set body='return no_such_var' where db='test' and name='f1';
create event e1 on schedule every 1 year starts '2030-01-01' do select 1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
update mysql.event set body ='select not_a_value' where db='test' and name='e1';
create table t1 (i int);
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
mariadb-dump: Couldn't execute 'SHOW CREATE FUNCTION `f1`': Undeclared variable: no_such_var (1327)
/*!50106 SET @save_time_zone= @@TIME_ZONE */ ;
DELIMITER ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
/*!50003 SET character_set_client = utf8 */ ;;
/*!50003 SET character_set_results = utf8 */ ;;
/*!50003 SET collation_connection = utf8_general_ci */ ;;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;
/*!50003 SET sql_mode = '' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
/*!50003 SET time_zone = 'SYSTEM' */ ;;
/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `e1` ON SCHEDULE EVERY 1 YEAR STARTS '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO select not_a_value */ ;;
/*!50003 SET time_zone = @saved_time_zone */ ;;
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
/*!50003 SET character_set_results = @saved_cs_results */ ;;
/*!50003 SET collation_connection = @saved_col_connection */ ;;
DELIMITER ;
/*!50106 SET TIME_ZONE= @save_time_zone */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `f2`() RETURNS int(11)
return 2 ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
drop function f1;
drop function f2;
drop event e1;
drop table t1;
#
# End of 10.4 tests
#

View file

@ -2922,6 +2922,7 @@ DROP DATABASE test1;
DROP DATABASE test2;
SET sql_mode=@save_sql_mode;
--remove_file $MYSQLTEST_VARDIR/tmp/dumptest1.sql
use test;
--echo #
--echo # MDEV-4875 Can't restore a mysqldump if --add-drop-database meets general_log
@ -2982,4 +2983,27 @@ TRUNCATE TABLE mysql.general_log;
DROP DATABASE test1;
--remove_file $MYSQLTEST_VARDIR/tmp/dumptest1.sql
--echo #
--echo # End of 10.3 tests
--echo #
--echo #
--echo # MDEV-31092 mysqldump --force doesn't ignore error as it should
--echo #
create function f1() returns int return 1;
create function f2() returns int return 2;
update mysql.proc set body='return no_such_var' where db='test' and name='f1';
create event e1 on schedule every 1 year starts '2030-01-01' do select 1;
update mysql.event set body ='select not_a_value' where db='test' and name='e1';
create table t1 (i int);
--replace_result mariadb-dump.exe mariadb-dump
--error 2
--exec $MYSQL_DUMP --compact --events --routines --force test 2>&1
drop function f1;
drop function f2;
drop event e1;
drop table t1;
--echo #
--echo # End of 10.4 tests
--echo #

View file

@ -1140,5 +1140,18 @@ c d
DROP TABLE t1, t2;
SET @@sql_mode=@save_sql_mode;
#
# MDEV-31800 Problem with open ranges on prefix blobs keys
#
create table t1 (d text not null, key a (d(6))) ;
insert into t1 values ('prefix 2' ), ('prefix 0' );
select d from t1 where d >= 'prefix 1' and d < 'prefix 3';
d
prefix 2
alter table t1 drop index a;
select d from t1 where d >= 'prefix 1' and d < 'prefix 3';
d
prefix 2
drop table t1;
#
# End of 10.4 test
#

View file

@ -756,6 +756,16 @@ select * from t2;
DROP TABLE t1, t2;
SET @@sql_mode=@save_sql_mode;
--echo #
--echo # MDEV-31800 Problem with open ranges on prefix blobs keys
--echo #
create table t1 (d text not null, key a (d(6))) ;
insert into t1 values ('prefix 2' ), ('prefix 0' );
select d from t1 where d >= 'prefix 1' and d < 'prefix 3';
alter table t1 drop index a;
select d from t1 where d >= 'prefix 1' and d < 'prefix 3';
drop table t1;
--echo #
--echo # End of 10.4 test
--echo #

View file

@ -1393,26 +1393,3 @@ INSERT INTO t1 VALUES(repeat("this is the test case", 500));
ALTER TABLE t1 KEY_BLOCK_SIZE=4;
ALTER TABLE t1 KEY_BLOCK_SIZE=0;
DROP TABLE t1;
#
# MDEV-30528 Assertion in dtype_get_at_most_n_mbchars
#
create table t (f text) with system versioning character set utf8 engine=innodb;
insert into t (f) values
('mysql from tutorial dbms stands for database ...') ,
('when to use mysql well after that you went through a ...'),
('where will optimizing mysql in what tutorial we will show ...'),
('1001 mysql tricks 1. never run mysqld as root. 2. ...'),
('mysql vs. yoursql in the following database comparison ...'),
('mysql security when configured properly, mysql ...');
delete from t where f like 'mysql%';
alter table t add fulltext (f);
select * from t where match(f) against ("use");
f
when to use mysql well after that you went through a ...
select * from t where match(f) against ("run");
f
1001 mysql tricks 1. never run mysqld as root. 2. ...
select * from t where match(f) against ("tutorial");
f
where will optimizing mysql in what tutorial we will show ...
drop table t;

View file

@ -1342,21 +1342,3 @@ ALTER TABLE t1 KEY_BLOCK_SIZE=4;
ALTER TABLE t1 KEY_BLOCK_SIZE=0;
DROP TABLE t1;
--echo #
--echo # MDEV-30528 Assertion in dtype_get_at_most_n_mbchars
--echo #
create table t (f text) with system versioning character set utf8 engine=innodb;
insert into t (f) values
('mysql from tutorial dbms stands for database ...') ,
('when to use mysql well after that you went through a ...'),
('where will optimizing mysql in what tutorial we will show ...'),
('1001 mysql tricks 1. never run mysqld as root. 2. ...'),
('mysql vs. yoursql in the following database comparison ...'),
('mysql security when configured properly, mysql ...');
delete from t where f like 'mysql%';
alter table t add fulltext (f);
select * from t where match(f) against ("use");
select * from t where match(f) against ("run");
select * from t where match(f) against ("tutorial");
# cleanup
drop table t;

View file

@ -15,6 +15,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include <my_global.h>
#include <openssl/evp.h>
#include <ssl_compat.h>
/*

View file

@ -1961,18 +1961,25 @@ public:
Use this constructor if value->save_in_field() went precisely,
without any data rounding or truncation.
*/
SEL_ARG_LT(const uchar *key, Field *field)
SEL_ARG_LT(const uchar *key, const KEY_PART *key_part, Field *field)
:SEL_ARG_LE(key, field)
{ max_flag= NEAR_MAX; }
{
// Don't use open ranges for partial key_segments
if (!(key_part->flag & HA_PART_KEY_SEG))
max_flag= NEAR_MAX;
}
/*
Use this constructor if value->save_in_field() returned success,
but we don't know if rounding or truncation happened
(as some Field::store() do not report minor data changes).
*/
SEL_ARG_LT(THD *thd, const uchar *key, Field *field, Item *value)
SEL_ARG_LT(THD *thd, const uchar *key,
const KEY_PART *key_part, Field *field, Item *value)
:SEL_ARG_LE(key, field)
{
if (stored_field_cmp_to_item(thd, field, value) == 0)
// Don't use open ranges for partial key_segments
if (!(key_part->flag & HA_PART_KEY_SEG) &&
stored_field_cmp_to_item(thd, field, value) == 0)
max_flag= NEAR_MAX;
}
};
@ -9047,7 +9054,7 @@ SEL_ARG *Field::stored_field_make_mm_leaf(RANGE_OPT_PARAM *param,
case SCALAR_CMP_LE:
DBUG_RETURN(new (mem_root) SEL_ARG_LE(str, this));
case SCALAR_CMP_LT:
DBUG_RETURN(new (mem_root) SEL_ARG_LT(thd, str, this, value));
DBUG_RETURN(new (mem_root) SEL_ARG_LT(thd, str, key_part, this, value));
case SCALAR_CMP_GT:
DBUG_RETURN(new (mem_root) SEL_ARG_GT(thd, str, key_part, this, value));
case SCALAR_CMP_GE:
@ -9076,7 +9083,7 @@ SEL_ARG *Field::stored_field_make_mm_leaf_exact(RANGE_OPT_PARAM *param,
case SCALAR_CMP_LE:
DBUG_RETURN(new (param->mem_root) SEL_ARG_LE(str, this));
case SCALAR_CMP_LT:
DBUG_RETURN(new (param->mem_root) SEL_ARG_LT(str, this));
DBUG_RETURN(new (param->mem_root) SEL_ARG_LT(str, key_part, this));
case SCALAR_CMP_GT:
DBUG_RETURN(new (param->mem_root) SEL_ARG_GT(str, key_part, this));
case SCALAR_CMP_GE:

View file

@ -504,8 +504,7 @@ row_merge_buf_add(
VCOL_STORAGE vcol_storage;
DBUG_ENTER("row_merge_buf_add");
if (buf->n_tuples >= buf->max_tuples
|| (history_fts && (buf->index->type & DICT_FTS))) {
if (buf->n_tuples >= buf->max_tuples) {
error:
n_row_added = 0;
goto end;
@ -598,8 +597,7 @@ error:
/* Tokenize and process data for FTS */
if (index->type & DICT_FTS) {
ut_ad(!history_fts);
if (!history_fts && (index->type & DICT_FTS)) {
fts_doc_item_t* doc_item;
byte* value;
void* ptr;
@ -1874,7 +1872,6 @@ row_merge_read_clustered_index(
mach_write_to_8(new_sys_trx_start, trx->id);
mach_write_to_8(new_sys_trx_end, TRX_ID_MAX);
uint64_t n_rows = 0;
bool history_row = false;
/* Scan the clustered index. */
for (;;) {
@ -1891,7 +1888,7 @@ row_merge_read_clustered_index(
dtuple_t* row;
row_ext_t* ext;
page_cur_t* cur = btr_pcur_get_page_cur(&pcur);
bool history_fts = false;
bool history_row, history_fts = false;
page_cur_move_to_next(cur);
@ -2517,8 +2514,7 @@ write_buffers:
ut_ad(i == 0);
break;
}
} else if (!history_row
&& dict_index_is_unique(buf->index)) {
} else if (dict_index_is_unique(buf->index)) {
row_merge_dup_t dup = {
buf->index, table, col_map, 0};