summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-03-11 14:52:16 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2022-03-11 14:52:16 +0200
commit3c9f415e529e4e3dc9948b8df0ede75f628a8805 (patch)
tree5f944eb9b90c2b39564fd1350de6bc0155968e16
parent79bc654ac34ee24e24afe98215ba7c44edd8e113 (diff)
parent77c7390fc8cdcf1373c1277ebb129a13575a3a5b (diff)
downloadmariadb-git-3c9f415e529e4e3dc9948b8df0ede75f628a8805.tar.gz
Merge 10.6 into 10.7
-rw-r--r--mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result8
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test8
-rw-r--r--storage/innobase/handler/ha_innodb.h2
-rw-r--r--storage/innobase/handler/handler0alter.cc26
-rw-r--r--storage/innobase/row/row0mysql.cc3
-rw-r--r--storage/maria/ma_check.h10
-rw-r--r--storage/maria/maria_def.h8
-rw-r--r--storage/maria/s3_func.h6
-rw-r--r--storage/myisam/myisamdef.h10
9 files changed, 56 insertions, 25 deletions
diff --git a/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result b/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result
index a09ad6b97b9..8d0734f9df8 100644
--- a/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result
+++ b/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result
@@ -12,10 +12,14 @@ c char(32) DEFAULT 'dummy_text',
PRIMARY KEY (i)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
insert into t1(i) values(null);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
select * from t1;
i c
1 dummy_text
insert into t1(i) values(null), (null), (null);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
select * from t1;
i c
1 dummy_text
@@ -46,10 +50,14 @@ c char(32) DEFAULT 'dummy_text',
PRIMARY KEY (i)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
insert into t1(i) values(null);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
select * from t1;
i c
1 dummy_text
insert into t1(i) values(null), (null), (null);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
select * from t1;
i c
1 dummy_text
diff --git a/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test b/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test
index 817f4f82b43..431fa90c8e2 100644
--- a/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test
+++ b/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test
@@ -18,9 +18,17 @@
--connection node_2
SET GLOBAL wsrep_forced_binlog_format='STATEMENT';
+--disable_query_log
+call mtr.add_suppression("Unsafe statement written to the binary log");
+--enable_query_log
+
--connection node_1
SET GLOBAL wsrep_forced_binlog_format='STATEMENT';
+--disable_query_log
+call mtr.add_suppression("Unsafe statement written to the binary log");
+--enable_query_log
+
CREATE TABLE t1 (
i int(11) NOT NULL AUTO_INCREMENT,
c char(32) DEFAULT 'dummy_text',
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index ca54785feed..6a4948256a0 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -465,7 +465,7 @@ protected:
/* @return true if it's necessary to switch current statement log
format from STATEMENT to ROW if binary log format is MIXED and
autoincrement values are changed in the statement */
- bool autoinc_lock_mode_stmt_unsafe() const;
+ bool autoinc_lock_mode_stmt_unsafe() const override;
dict_index_t* innobase_get_index(uint keynr);
#ifdef WITH_WSREP
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 1965994ac37..12deba40913 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -8715,13 +8715,14 @@ inline bool rollback_inplace_alter_table(Alter_inplace_info *ha_alter_info,
const bool fts_exist= (ctx->new_table->flags2 &
(DICT_TF2_FTS_HAS_DOC_ID | DICT_TF2_FTS)) ||
ctx->adding_fulltext_index();
- if (fts_exist)
- {
- fts_optimize_remove_table(ctx->new_table);
- purge_sys.stop_FTS(*ctx->new_table);
- }
if (ctx->need_rebuild())
{
+ if (fts_exist)
+ {
+ fts_optimize_remove_table(ctx->new_table);
+ purge_sys.stop_FTS(*ctx->new_table);
+ }
+
dberr_t err= lock_table_for_trx(ctx->new_table, ctx->trx, LOCK_X);
if (fts_exist)
{
@@ -8768,12 +8769,25 @@ inline bool rollback_inplace_alter_table(Alter_inplace_info *ha_alter_info,
if (fts_exist)
{
+ const dict_index_t *fts_index= nullptr;
for (ulint a= 0; a < ctx->num_to_add_index; a++)
{
const dict_index_t *index = ctx->add_index[a];
if (index->type & DICT_FTS)
- ut_a(!fts_lock_index_tables(ctx->trx, *index));
+ fts_index= index;
}
+
+ /* Remove the fts table from fts_optimize_wq if there are
+ no FTS secondary index exist other than newly added one */
+ if (fts_index &&
+ (ib_vector_is_empty(prebuilt->table->fts->indexes) ||
+ (ib_vector_size(prebuilt->table->fts->indexes) == 1 &&
+ fts_index == static_cast<dict_index_t*>(
+ ib_vector_getp(prebuilt->table->fts->indexes, 0)))))
+ fts_optimize_remove_table(prebuilt->table);
+
+ purge_sys.stop_FTS(*prebuilt->table);
+ ut_a(!fts_index || !fts_lock_index_tables(ctx->trx, *fts_index));
ut_a(!fts_lock_common_tables(ctx->trx, *ctx->new_table));
ut_a(!lock_sys_tables(ctx->trx));
}
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index a5ca98c74d0..07ec578738b 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -2495,7 +2495,8 @@ rollback:
fts_optimize_add_table(table);
}
trx->rollback();
- row_mysql_unlock_data_dictionary(trx);
+ if (trx->dict_operation_lock_mode)
+ row_mysql_unlock_data_dictionary(trx);
return err;
}
}
diff --git a/storage/maria/ma_check.h b/storage/maria/ma_check.h
index 1c2a971098d..fa78ada6d38 100644
--- a/storage/maria/ma_check.h
+++ b/storage/maria/ma_check.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2019 MariaDB Corporation AB
+/* Copyright (C) 2019, 2022, MariaDB Corporation AB
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
@@ -20,17 +20,17 @@
in myisamchk.h
*/
-typedef struct st_sort_key_blocks /* Used when sorting */
+struct st_sort_key_blocks /* Used when sorting */
{
uchar *buff, *end_pos;
uchar lastkey[MARIA_MAX_POSSIBLE_KEY_BUFF];
uint last_length;
int inited;
-} MA_SORT_KEY_BLOCKS;
+};
-typedef struct st_sort_ftbuf
+struct st_sort_ftbuf
{
uchar *buf, *end;
int count;
uchar lastkey[MARIA_MAX_KEY_BUFF];
-} MA_SORT_FT_BUF;
+};
diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h
index d6bdffa0f7e..4479b244ddf 100644
--- a/storage/maria/maria_def.h
+++ b/storage/maria/maria_def.h
@@ -150,21 +150,21 @@ struct st_maria_share;
struct st_maria_handler; /* For referense */
struct st_maria_keydef;
-typedef struct st_maria_key /* Internal info about a key */
+struct st_maria_key /* Internal info about a key */
{
uchar *data; /* Data for key */
struct st_maria_keydef *keyinfo; /* Definition for key */
uint data_length; /* Length of key data */
uint ref_length; /* record ref + transid */
uint32 flag; /* 0 or SEARCH_PART_KEY */
-} MARIA_KEY;
+};
-typedef struct st_maria_decode_tree /* Decode huff-table */
+struct st_maria_decode_tree /* Decode huff-table */
{
uint16 *table;
uint quick_table_bits;
uchar *intervalls;
-} MARIA_DECODE_TREE;
+};
typedef struct s3_info S3_INFO;
diff --git a/storage/maria/s3_func.h b/storage/maria/s3_func.h
index bd5275494bc..a062131d5a5 100644
--- a/storage/maria/s3_func.h
+++ b/storage/maria/s3_func.h
@@ -1,6 +1,6 @@
#ifndef S3_FUNC_INCLUDED
#define S3_FUNC_INCLUDED
-/* Copyright (C) 2019, 2020 MariaDB Corporation Ab
+/* Copyright (C) 2019, 2022, MariaDB Corporation Ab
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
@@ -41,7 +41,7 @@ extern TYPELIB s3_protocol_typelib;
/* Store information about a s3 connection */
-typedef struct s3_info
+struct s3_info
{
/* Connection strings */
LEX_CSTRING access_key, secret_key, region, bucket, host_name;
@@ -63,7 +63,7 @@ typedef struct s3_info
/* Protocol for the list bucket API call. 1 for Amazon, 2 for some others */
uint8_t protocol_version;
-} S3_INFO;
+};
/* flag + length is stored in this header */
diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h
index f48d1078000..c90d989c975 100644
--- a/storage/myisam/myisamdef.h
+++ b/storage/myisam/myisamdef.h
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2017, MariaDB Corporation.
+ Copyright (c) 2017, 2022, MariaDB Corporation.
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
@@ -613,21 +613,21 @@ typedef struct st_mi_block_info /* Parameter to _mi_get_block_info */
} MI_BLOCK_INFO;
-typedef struct st_sort_key_blocks /* Used when sorting */
+struct st_sort_key_blocks /* Used when sorting */
{
uchar *buff, *end_pos;
uchar lastkey[HA_MAX_POSSIBLE_KEY_BUFF];
uint last_length;
int inited;
-} SORT_KEY_BLOCKS;
+};
-typedef struct st_sort_ftbuf
+struct st_sort_ftbuf
{
uchar *buf, *end;
int count;
uchar lastkey[HA_MAX_KEY_BUFF];
-} SORT_FT_BUF;
+};
/* bits in return from _mi_get_block_info */