Skip to content

Commit

Permalink
Merge 10.6 into 10.7
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Oct 5, 2021
2 parents d5e606c + 4ca56e8 commit 822066a
Show file tree
Hide file tree
Showing 22 changed files with 377 additions and 88 deletions.
2 changes: 1 addition & 1 deletion client/mysqldump.c
Original file line number Diff line number Diff line change
Expand Up @@ -4518,7 +4518,7 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
if (!opt_xml && opt_copy_s3_tables && (ignore_flag & IGNORE_S3_TABLE))
{
DYNAMIC_STRING alter_string;
init_dynamic_string_checked(&alter_string, "ATER TABLE ", 1024, 1024);
init_dynamic_string_checked(&alter_string, "ALTER TABLE ", 1024, 1024);
dynstr_append_checked(&alter_string, opt_quoted_table);
dynstr_append_checked(&alter_string, " ENGINE=S3;\n");
fputs(alter_string.str, md_result_file);
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/main/sp.test
Original file line number Diff line number Diff line change
Expand Up @@ -10432,7 +10432,7 @@ SELECT VARIABLE_VALUE into @local_mem_used FROM INFORMATION_SCHEMA.SESSION_STATU
CREATE PROCEDURE sp1() SELECT 1;
SHOW CREATE PROCEDURE sp1;
SELECT VARIABLE_VALUE-@local_mem_used FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='MEMORY_USED';
# 10.5 FIXME: This occasionally shows 56 or 64 bytes of difference!
# FIXME: MDEV-26754 main.sp test fails for embedded server
#SELECT VARIABLE_VALUE-@global_mem_used FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='MEMORY_USED';
DROP PROCEDURE sp1;
--echo # End of 10.3 tests
Expand Down
11 changes: 11 additions & 0 deletions mysql-test/suite/galera/r/MDEV-22708.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
connection node_2;
connection node_1;
SET @wsrep_forced_binlog_format_saved = @@GLOBAL.wsrep_forced_binlog_format;
SET @@GLOBAL.wsrep_forced_binlog_format = STATEMENT;
CREATE TABLE t1(c INT PRIMARY KEY) ENGINE = MyISAM;
INSERT DELAYED INTO t1 VALUES (1),(2),(3);
SELECT SLEEP(1);
SLEEP(1)
0
DROP TABLE t1;
SET @@GLOBAL.wsrep_forced_binlog_format = @wsrep_forced_binlog_format_saved;
56 changes: 56 additions & 0 deletions mysql-test/suite/galera/r/galera_fulltext.result
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,59 @@ COUNT(f1) = 1000
1
DROP TABLE t1;
DROP TABLE ten;
connection node_1;
SET @value=REPEAT (1,5001);
CREATE TABLE t (a VARCHAR(5000),FULLTEXT (a)) engine=innodb;
INSERT IGNORE INTO t VALUES(@value);
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
SELECT COUNT(*) FROM t;
COUNT(*)
1
connection node_2;
SELECT COUNT(*) FROM t;
COUNT(*)
1
connection node_1;
DROP TABLE t;
CREATE TABLE t (a VARCHAR(5000)) engine=innodb;
INSERT IGNORE INTO t VALUES(@value);
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
SELECT COUNT(*) FROM t;
COUNT(*)
1
connection node_2;
SELECT COUNT(*) FROM t;
COUNT(*)
1
connection node_1;
DROP TABLE t;
connection node_1;
SET @value=REPEAT (1,5001);
CREATE TABLE t (a VARCHAR(5000),FULLTEXT (a)) engine=innodb DEFAULT CHARSET=utf8;
INSERT IGNORE INTO t VALUES(@value);
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
SELECT COUNT(*) FROM t;
COUNT(*)
1
connection node_2;
SELECT COUNT(*) FROM t;
COUNT(*)
1
connection node_1;
DROP TABLE t;
CREATE TABLE t (a VARCHAR(5000)) engine=innodb DEFAULT CHARSET=utf8;
INSERT IGNORE INTO t VALUES(@value);
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
SELECT COUNT(*) FROM t;
COUNT(*)
1
connection node_2;
SELECT COUNT(*) FROM t;
COUNT(*)
1
connection node_1;
DROP TABLE t;
4 changes: 4 additions & 0 deletions mysql-test/suite/galera/t/MDEV-22708.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
!include ../galera_2nodes.cnf

[mysqld]
log-bin
14 changes: 14 additions & 0 deletions mysql-test/suite/galera/t/MDEV-22708.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc

SET @wsrep_forced_binlog_format_saved = @@GLOBAL.wsrep_forced_binlog_format;
SET @@GLOBAL.wsrep_forced_binlog_format = STATEMENT;

CREATE TABLE t1(c INT PRIMARY KEY) ENGINE = MyISAM;

INSERT DELAYED INTO t1 VALUES (1),(2),(3);
SELECT SLEEP(1);

DROP TABLE t1;

SET @@GLOBAL.wsrep_forced_binlog_format = @wsrep_forced_binlog_format_saved;
64 changes: 43 additions & 21 deletions mysql-test/suite/galera/t/galera_fulltext.test
Original file line number Diff line number Diff line change
Expand Up @@ -58,28 +58,50 @@ SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('abcdefjhk');

DROP TABLE t1;
DROP TABLE ten;

#
# Case 2: UTF-8
# TODO: MDEV-24978
#
#--connection node_1
#SET @value=REPEAT (1,5001);
#CREATE TABLE t (a VARCHAR(5000),FULLTEXT (a)) engine=innodb DEFAULT CHARSET=utf8;
#INSERT IGNORE INTO t VALUES(@value);
#SELECT COUNT(*) FROM t;
# MDEV-24978 : SIGABRT in __libc_message
#
#--connection node_2
#SELECT COUNT(*) FROM t;
#
#--connection node_1
#DROP TABLE t;
#CREATE TABLE t (a VARCHAR(5000)) engine=innodb DEFAULT CHARSET=utf8;
#INSERT IGNORE INTO t VALUES(@value);
#SELECT COUNT(*) FROM t;
--connection node_1
SET @value=REPEAT (1,5001);
CREATE TABLE t (a VARCHAR(5000),FULLTEXT (a)) engine=innodb;
INSERT IGNORE INTO t VALUES(@value);
SELECT COUNT(*) FROM t;

--connection node_2
SELECT COUNT(*) FROM t;

--connection node_1
DROP TABLE t;
CREATE TABLE t (a VARCHAR(5000)) engine=innodb;
INSERT IGNORE INTO t VALUES(@value);
SELECT COUNT(*) FROM t;

--connection node_2
SELECT COUNT(*) FROM t;

--connection node_1
DROP TABLE t;

#
#--connection node_2
#SELECT COUNT(*) FROM t;
# Case 2: UTF-8
#
#--connection node_1
#DROP TABLE t;
--connection node_1
SET @value=REPEAT (1,5001);
CREATE TABLE t (a VARCHAR(5000),FULLTEXT (a)) engine=innodb DEFAULT CHARSET=utf8;
INSERT IGNORE INTO t VALUES(@value);
SELECT COUNT(*) FROM t;

--connection node_2
SELECT COUNT(*) FROM t;

--connection node_1
DROP TABLE t;
CREATE TABLE t (a VARCHAR(5000)) engine=innodb DEFAULT CHARSET=utf8;
INSERT IGNORE INTO t VALUES(@value);
SELECT COUNT(*) FROM t;

--connection node_2
SELECT COUNT(*) FROM t;

--connection node_1
DROP TABLE t;
8 changes: 2 additions & 6 deletions mysql-test/suite/s3/mysqldump.result
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@ CREATE TABLE `t1` (
PRIMARY KEY (`pk`)
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `t1` VALUES
(1,1),
(2,2),
(3,3),
(4,4);
ATER TABLE `t1` ENGINE=S3;
INSERT INTO `t1` VALUES (1,1),(2,2),(3,3),(4,4);
ALTER TABLE `t1` ENGINE=S3;
#####
# mysqldump with --copy-s3-tables=1 XML
###
Expand Down
11 changes: 5 additions & 6 deletions sql/service_wsrep.cc
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,11 @@ extern "C" my_bool wsrep_thd_order_before(const THD *left, const THD *right)
extern "C" my_bool wsrep_thd_is_aborting(const MYSQL_THD thd)
{
mysql_mutex_assert_owner(&thd->LOCK_thd_data);
if (thd != 0)

const wsrep::client_state& cs(thd->wsrep_cs());
const enum wsrep::transaction::state tx_state(cs.transaction().state());
switch (tx_state)
{
const wsrep::client_state& cs(thd->wsrep_cs());
const enum wsrep::transaction::state tx_state(cs.transaction().state());
switch (tx_state)
{
case wsrep::transaction::s_must_abort:
return (cs.state() == wsrep::client_state::s_exec ||
cs.state() == wsrep::client_state::s_result);
Expand All @@ -282,8 +281,8 @@ extern "C" my_bool wsrep_thd_is_aborting(const MYSQL_THD thd)
return true;
default:
return false;
}
}

return false;
}

Expand Down
2 changes: 1 addition & 1 deletion sql/sql_insert.cc
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ void upgrade_lock_type(THD *thd, thr_lock_type *lock_type,
}

bool log_on= (thd->variables.option_bits & OPTION_BIN_LOG);
if (global_system_variables.binlog_format == BINLOG_FORMAT_STMT &&
if (thd->wsrep_binlog_format() == BINLOG_FORMAT_STMT &&
log_on && mysql_bin_log.is_open())
{
/*
Expand Down
3 changes: 2 additions & 1 deletion sql/sql_yacc.yy
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
/* this is to get the bison compilation windows warnings out */
#ifdef _MSC_VER
/* warning C4065: switch statement contains 'default' but no 'case' labels */
#pragma warning (disable : 4065)
/* warning C4102: 'yyexhaustedlab': unreferenced label */
#pragma warning (disable : 4065 4102)
#endif
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wunused-label" /* yyexhaustedlab: */
Expand Down
45 changes: 23 additions & 22 deletions storage/innobase/fil/fil0fil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ fil_node_t* fil_space_t::add(const char* name, pfs_os_file_t handle,
this->size += size;
UT_LIST_ADD_LAST(chain, node);
if (node->is_open()) {
n_pending.fetch_and(~CLOSING, std::memory_order_relaxed);
clear_closing();
if (++fil_system.n_open >= srv_max_n_open_files) {
reacquire();
try_to_close(true);
Expand Down Expand Up @@ -683,7 +683,7 @@ ATTRIBUTE_COLD bool fil_space_t::prepare(bool have_mutex)
}
else
clear:
n_pending.fetch_and(~CLOSING, std::memory_order_relaxed);
clear_closing();

if (!have_mutex)
mysql_mutex_unlock(&fil_system.mutex);
Expand Down Expand Up @@ -1527,38 +1527,23 @@ static void fil_name_write(uint32_t space_id, const char *name,
fil_space_t *fil_space_t::check_pending_operations(uint32_t id)
{
ut_a(!is_system_tablespace(id));
bool being_deleted= false;
mysql_mutex_lock(&fil_system.mutex);
fil_space_t *space= fil_space_get_by_id(id);

if (!space);
else if (space->pending() & STOPPING)
being_deleted= true;
else
{
if (space->crypt_data)
{
space->reacquire();
mysql_mutex_unlock(&fil_system.mutex);
fil_space_crypt_close_tablespace(space);
mysql_mutex_lock(&fil_system.mutex);
space->release();
}
being_deleted= space->set_stopping();
}
mysql_mutex_unlock(&fil_system.mutex);

if (!space)
{
mysql_mutex_unlock(&fil_system.mutex);
return nullptr;
}

if (being_deleted)
if (space->pending() & STOPPING)
{
being_deleted:
/* A thread executing DDL and another thread executing purge may
be executing fil_delete_tablespace() concurrently for the same
tablespace. Wait for the other thread to complete the operation. */
for (ulint count= 0;; count++)
{
mysql_mutex_lock(&fil_system.mutex);
space= fil_space_get_by_id(id);
ut_ad(!space || space->is_stopping());
mysql_mutex_unlock(&fil_system.mutex);
Expand All @@ -1569,8 +1554,24 @@ fil_space_t *fil_space_t::check_pending_operations(uint32_t id)
sql_print_warning("InnoDB: Waiting for tablespace " UINT32PF
" to be deleted", id);
std::this_thread::sleep_for(std::chrono::milliseconds(20));
mysql_mutex_lock(&fil_system.mutex);
}
}
else
{
if (space->crypt_data)
{
space->reacquire();
mysql_mutex_unlock(&fil_system.mutex);
fil_space_crypt_close_tablespace(space);
mysql_mutex_lock(&fil_system.mutex);
space->release();
}
if (space->set_stopping_check())
goto being_deleted;
}

mysql_mutex_unlock(&fil_system.mutex);

for (ulint count= 0;; count++)
{
Expand Down
14 changes: 9 additions & 5 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6789,10 +6789,14 @@ wsrep_store_key_val_for_row(

/* In a column prefix index, we may need to truncate
the stored value: */

if (true_len > key_len) {
true_len = key_len;
}
/* cannot exceed max column lenght either, we may need to truncate
the stored value: */
if (true_len > sizeof(sorted)) {
true_len = sizeof(sorted);
}

memcpy(sorted, data, true_len);
true_len = wsrep_innobase_mysql_sort(
Expand All @@ -6805,8 +6809,8 @@ wsrep_store_key_val_for_row(
actual data. The rest of the space was reset to zero
in the bzero() call above. */
if (true_len > buff_space) {
fprintf (stderr,
"WSREP: key truncated: %s\n",
WSREP_DEBUG (
"write set key truncated for: %s\n",
wsrep_thd_query(thd));
true_len = buff_space;
}
Expand Down Expand Up @@ -18507,7 +18511,7 @@ void lock_wait_wsrep_kill(trx_t *bf_trx, ulong thd_id, trx_id_t trx_id)
wsrep_thd_transaction_state_str(vthd),
wsrep_thd_query(vthd));
/* Mark transaction as a victim for Galera abort */
vtrx->lock.was_chosen_as_deadlock_victim.fetch_or(2);
vtrx->lock.set_wsrep_victim();
if (!wsrep_thd_set_wsrep_aborter(bf_thd, vthd))
aborting= true;
else
Expand Down Expand Up @@ -18562,7 +18566,7 @@ wsrep_abort_transaction(
wsrep_thd_transaction_state_str(victim_thd));

if (victim_trx) {
victim_trx->lock.was_chosen_as_deadlock_victim.fetch_or(2);
victim_trx->lock.set_wsrep_victim();

wsrep_thd_kill_LOCK(victim_thd);
wsrep_thd_LOCK(victim_thd);
Expand Down
Loading

0 comments on commit 822066a

Please sign in to comment.