Merge branch '10.10' into 10.11

This commit is contained in:
Sergei Golubchik 2023-09-24 19:41:43 +02:00
commit 034848c6c2
20 changed files with 120 additions and 38 deletions

View File

@ -33,8 +33,9 @@ MACRO (CHECK_LIBFMT)
#include <fmt/format-inl.h>
#include <iostream>
int main() {
int answer= 42;
fmt::format_args::format_arg arg=
fmt::detail::make_arg<fmt::format_context>(42);
fmt::detail::make_arg<fmt::format_context>(answer);
std::cout << fmt::vformat(\"The answer is {}.\",
fmt::format_args(&arg, 1));
}" HAVE_SYSTEM_LIBFMT)

View File

@ -218,9 +218,7 @@ enum ha_extra_function {
/** Start writing rows during ALTER TABLE...ALGORITHM=COPY. */
HA_EXTRA_BEGIN_ALTER_COPY,
/** Finish writing rows during ALTER TABLE...ALGORITHM=COPY. */
HA_EXTRA_END_ALTER_COPY,
/** IGNORE is being used for the insert statement */
HA_EXTRA_IGNORE_INSERT
HA_EXTRA_END_ALTER_COPY
};
/* Compatible option, to be deleted in 6.0 */

View File

@ -4,4 +4,4 @@
log-bin=mysqld-bin
log-slave-updates
binlog-format=ROW
wsrep-replicate-myisam=ON
wsrep_mode=REPLICATE_MYISAM

View File

@ -0,0 +1,2 @@
423a424
> ERROR 42000: Row size too large (> 1982). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.

View File

@ -28,6 +28,7 @@ DROP DATABASE db1;
#
# End of 10.6 tests
#
SET foreign_key_checks=0, unique_checks=0;
#
# MDEV-30796 Auto_increment values not updated after bulk
# insert operation
@ -35,7 +36,21 @@ DROP DATABASE db1;
CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT,
f2 INT NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB;
INSERT INTO t1 VALUES(1, 2), (25, 3), (2, 4);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL AUTO_INCREMENT,
`f2` int(11) NOT NULL,
PRIMARY KEY (`f1`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
# restart
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL AUTO_INCREMENT,
`f2` int(11) NOT NULL,
PRIMARY KEY (`f1`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t1(f2) VALUES(5);
SELECT max(f1) FROM t1;
max(f1)

View File

@ -435,6 +435,14 @@ CREATE TABLE t1 (pk int primary key, c01 text, c02 text, c03 text,
SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= COMPACT;
--replace_result 1982 8126 4030 8126
ALTER TABLE t1 FORCE;
let $page_size= `SELECT @@innodb_page_size`;
let $error_code = 0;
if ($page_size == 4096) {
let $error_code = ER_TOO_BIG_ROWSIZE;
}
--error $error_code
INSERT IGNORE INTO t1 VALUES
(1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)),
(2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107));

View File

@ -42,6 +42,7 @@ DROP DATABASE db1;
--echo # End of 10.6 tests
--echo #
SET foreign_key_checks=0, unique_checks=0;
--echo #
--echo # MDEV-30796 Auto_increment values not updated after bulk
--echo # insert operation
@ -49,7 +50,9 @@ DROP DATABASE db1;
CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT,
f2 INT NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB;
INSERT INTO t1 VALUES(1, 2), (25, 3), (2, 4);
SHOW CREATE TABLE t1;
--source include/restart_mysqld.inc
SHOW CREATE TABLE t1;
INSERT INTO t1(f2) VALUES(5);
SELECT max(f1) FROM t1;
DROP TABLE t1;

View File

@ -4,13 +4,13 @@ package My::Suite::Vault;
use strict;
return "Hashicorp Vault key management utility not found"
unless `sh -c "command -v vault"`;
return "You need to set the value of the VAULT_ADDR variable"
unless $ENV{VAULT_ADDR};
return "You need to set the value of the VAULT_TOKEN variable"
unless $ENV{VAULT_TOKEN};
return "Hashicorp Vault key management utility not found"
unless `sh -c "command -v vault"`;
bless {};

View File

@ -3187,3 +3187,18 @@ SELECT * FROM t1 WHERE d >= ALL (SELECT * FROM t1);
d
00000000-0000-0000-0000-111111111111
DROP TABLE t1;
#
# MDEV-31719 Wrong result of: WHERE inet6_column IN ('','::1')
#
CREATE TABLE t1 (a UUID);
INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000');
SELECT * FROM t1 WHERE a IN ('','00000000-0000-0000-0000-000000000001');
a
Warnings:
Warning 1292 Incorrect uuid value: ''
SELECT * FROM t1 WHERE a='';
a
Warnings:
Warning 1292 Incorrect uuid value: ''
Warning 1292 Incorrect uuid value: ''
DROP TABLE t1;

View File

@ -1682,3 +1682,14 @@ SELECT * FROM t1 ORDER BY d;
SELECT * FROM t1 WHERE d <= ALL (SELECT * FROM t1);
SELECT * FROM t1 WHERE d >= ALL (SELECT * FROM t1);
DROP TABLE t1;
--echo #
--echo # MDEV-31719 Wrong result of: WHERE inet6_column IN ('','::1')
--echo #
CREATE TABLE t1 (a UUID);
INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000');
SELECT * FROM t1 WHERE a IN ('','00000000-0000-0000-0000-000000000001');
SELECT * FROM t1 WHERE a='';
DROP TABLE t1;

View File

@ -9479,7 +9479,6 @@ int ha_partition::extra(enum ha_extra_function operation)
case HA_EXTRA_STARTING_ORDERED_INDEX_SCAN:
case HA_EXTRA_BEGIN_ALTER_COPY:
case HA_EXTRA_END_ALTER_COPY:
case HA_EXTRA_IGNORE_INSERT:
DBUG_RETURN(loop_partitions(extra_cb, &operation));
default:
{

View File

@ -1407,11 +1407,24 @@ namespace fmt {
*/
String *Item_func_sformat::val_str(String *res)
{
/*
A union that stores a numeric format arg value.
fmt::detail::make_arg does not accept temporaries, so all of its numeric
args are temporarily stored in the fmt_args array.
See: https://github.com/fmtlib/fmt/issues/3596
*/
union Format_arg_store {
longlong val_int;
float val_float;
double val_double;
};
DBUG_ASSERT(fixed());
using ctx= fmt::format_context;
String *fmt_arg= NULL;
String *parg= NULL;
fmt::format_args::format_arg *vargs= NULL;
using ctx= fmt::format_context;
String *fmt_arg= NULL;
String *parg= NULL;
fmt::format_args::format_arg *vargs= NULL;
Format_arg_store *fmt_args= NULL;
null_value= true;
if (!(fmt_arg= args[0]->val_str(res)))
@ -1420,25 +1433,39 @@ String *Item_func_sformat::val_str(String *res)
if (!(vargs= new fmt::format_args::format_arg[arg_count - 1]))
return NULL;
if (!(fmt_args= new Format_arg_store[arg_count - 1]))
{
delete [] vargs;
return NULL;
}
/* Creates the array of arguments for vformat */
for (uint carg= 1; carg < arg_count; carg++)
{
switch (args[carg]->result_type())
{
case INT_RESULT:
vargs[carg-1]= fmt::detail::make_arg<ctx>(args[carg]->val_int());
fmt_args[carg-1].val_int= args[carg]->val_int();
vargs[carg-1]= fmt::detail::make_arg<ctx>(fmt_args[carg-1].val_int);
break;
case DECIMAL_RESULT: // TODO
case REAL_RESULT:
if (args[carg]->field_type() == MYSQL_TYPE_FLOAT)
vargs[carg-1]= fmt::detail::make_arg<ctx>((float)args[carg]->val_real());
{
fmt_args[carg-1].val_float= (float)args[carg]->val_real();
vargs[carg-1]= fmt::detail::make_arg<ctx>(fmt_args[carg-1].val_float);
}
else
vargs[carg-1]= fmt::detail::make_arg<ctx>(args[carg]->val_real());
{
fmt_args[carg-1].val_double= args[carg]->val_real();
vargs[carg-1]= fmt::detail::make_arg<ctx>(fmt_args[carg-1].val_double);
}
break;
case STRING_RESULT:
if (!(parg= args[carg]->val_str(&val_arg[carg-1])))
{
delete [] vargs;
delete [] fmt_args;
return NULL;
}
vargs[carg-1]= fmt::detail::make_arg<ctx>(*parg);
@ -1448,6 +1475,7 @@ String *Item_func_sformat::val_str(String *res)
default:
DBUG_ASSERT(0);
delete [] vargs;
delete [] fmt_args;
return NULL;
}
}
@ -1471,6 +1499,7 @@ String *Item_func_sformat::val_str(String *res)
null_value= true;
}
delete [] vargs;
delete [] fmt_args;
return null_value ? NULL : res;
}

View File

@ -2222,9 +2222,6 @@ int write_record(THD *thd, TABLE *table, COPY_INFO *info, select_result *sink)
goto after_trg_or_ignored_err;
}
/* Notify the engine about insert ignore operation */
if (info->handle_duplicates == DUP_ERROR && info->ignore)
table->file->extra(HA_EXTRA_IGNORE_INSERT);
after_trg_n_copied_inc:
info->copied++;
thd->record_first_successful_insert_id_in_cur_stmt(table->file->insert_id_for_cur_row);

View File

@ -11842,9 +11842,6 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
}
else
{
/* In case of alter ignore, notify the engine about it. */
if (ignore)
to->file->extra(HA_EXTRA_IGNORE_INSERT);
DEBUG_SYNC(thd, "copy_data_between_tables_before");
found_count++;
mysql_stage_set_work_completed(thd->m_stage_progress_psi, found_count);

View File

@ -10086,7 +10086,6 @@ bool TR_table::update(ulonglong start_id, ulonglong end_id)
table->file->print_error(error, MYF(0));
/* extra() is used to apply the bulk insert operation
on mysql/transaction_registry table */
table->file->extra(HA_EXTRA_IGNORE_INSERT);
return error;
}

View File

@ -15679,13 +15679,6 @@ ha_innobase::extra(
case HA_EXTRA_RESET_STATE:
reset_template();
trx->duplicates = 0;
/* fall through */
case HA_EXTRA_IGNORE_INSERT:
/* HA_EXTRA_IGNORE_INSERT is very similar to
HA_EXTRA_IGNORE_DUP_KEY, but with one crucial difference:
we want !trx->duplicates for INSERT IGNORE so that
row_ins_duplicate_error_in_clust() will acquire a
shared lock instead of an exclusive lock. */
stmt_boundary:
trx->bulk_insert_apply();
trx->end_bulk_insert(*m_prebuilt->table);

View File

@ -532,6 +532,13 @@ public:
{
return bulk_store && is_bulk_insert();
}
/** Free bulk insert operation */
void clear_bulk_buffer()
{
delete bulk_store;
bulk_store= nullptr;
}
};
/** Collection of persistent tables and their first modification

View File

@ -281,10 +281,10 @@ row_merge_insert_index_tuples(
ut_stage_alter_t* stage= nullptr,
merge_file_t* blob_file= nullptr);
/******************************************************//**
Encode an index record. */
/** Encode an index record.
@return size of the record */
static MY_ATTRIBUTE((nonnull))
void
ulint
row_merge_buf_encode(
/*=================*/
byte** b, /*!< in/out: pointer to
@ -315,6 +315,7 @@ row_merge_buf_encode(
entry->fields, n_fields);
*b += size;
return size;
}
static MY_ATTRIBUTE((malloc, nonnull))
@ -1175,7 +1176,13 @@ dberr_t row_merge_buf_write(const row_merge_buf_t *buf,
}
}
row_merge_buf_encode(&b, index, entry, n_fields);
ulint rec_size= row_merge_buf_encode(
&b, index, entry, n_fields);
if (blob_file && rec_size > srv_page_size) {
err = DB_TOO_BIG_RECORD;
goto func_exit;
}
ut_ad(b < &block[srv_sort_buf_size]);
DBUG_LOG("ib_merge_sort",
@ -5337,7 +5344,7 @@ func_exit:
if (err != DB_SUCCESS)
trx->error_info= index;
else if (index->is_primary() && table->persistent_autoinc)
btr_write_autoinc(index, table->autoinc);
btr_write_autoinc(index, table->autoinc - 1);
err= btr_bulk.finish(err);
return err;
}
@ -5390,6 +5397,7 @@ bulk_rollback:
if (t.second.get_first() < low_limit)
low_limit= t.second.get_first();
delete t.second.bulk_store;
t.second.bulk_store= nullptr;
}
}
trx_savept_t bulk_save{low_limit};

View File

@ -146,7 +146,10 @@ inline void trx_t::rollback_low(trx_savept_t *savept)
trx_mod_tables_t::iterator j= i++;
ut_ad(j->second.valid());
if (j->second.rollback(limit))
{
j->second.clear_bulk_buffer();
mod_tables.erase(j);
}
else if (!apply_online_log)
apply_online_log= j->first->is_active_ddl();
}

View File

@ -596,9 +596,6 @@ static const char *mrn_inspect_extra_function(enum ha_extra_function operation)
inspected = "HA_EXTRA_NO_AUTOINC_LOCKING";
break;
#endif
case HA_EXTRA_IGNORE_INSERT:
inspected = "HA_EXTRA_IGNORE_INSERT";
break;
}
return inspected;
}