summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-03-11 16:18:39 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2022-03-11 16:18:39 +0200
commit66b5b9214b1c3490cdfa8a1b3d3240e3088178d2 (patch)
tree3be13d1ec43b6abea6323c109f1556ef5a602efe
parentb95942a2a7b0127e0fc466876974bf48e2c53ed3 (diff)
parent89cd3da48c4d75d5b86282c72ec7575033ae5dc8 (diff)
downloadmariadb-git-66b5b9214b1c3490cdfa8a1b3d3240e3088178d2.tar.gz
Merge 10.8 into 10.9
-rw-r--r--include/my_alloc.h2
-rw-r--r--include/mysql.h.pp2
-rw-r--r--include/mysql/psi/psi_abi_v1.h.pp2
-rw-r--r--include/mysql/psi/psi_abi_v2.h.pp2
-rw-r--r--include/mysql/psi/psi_base.h7
-rw-r--r--include/mysql/psi/psi_memory.h7
-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
15 files changed, 68 insertions, 35 deletions
diff --git a/include/my_alloc.h b/include/my_alloc.h
index 659cc16ea14..944dcb6e1bd 100644
--- a/include/my_alloc.h
+++ b/include/my_alloc.h
@@ -20,7 +20,7 @@
#ifndef _my_alloc_h
#define _my_alloc_h
-typedef unsigned int PSI_memory_key;
+#include "mysql/psi/psi_base.h"
#define ALLOC_MAX_BLOCK_TO_DROP 4096
#define ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP 10
diff --git a/include/mysql.h.pp b/include/mysql.h.pp
index 7ae47ac836e..81b6206ae3e 100644
--- a/include/mysql.h.pp
+++ b/include/mysql.h.pp
@@ -238,7 +238,9 @@ typedef struct st_mysql_field {
typedef char **MYSQL_ROW;
typedef unsigned int MYSQL_FIELD_OFFSET;
typedef unsigned long long my_ulonglong;
+extern "C" {
typedef unsigned int PSI_memory_key;
+}
extern "C" {
typedef struct st_used_mem
{
diff --git a/include/mysql/psi/psi_abi_v1.h.pp b/include/mysql/psi/psi_abi_v1.h.pp
index a1845ac62f6..ad2bf1d21dc 100644
--- a/include/mysql/psi/psi_abi_v1.h.pp
+++ b/include/mysql/psi/psi_abi_v1.h.pp
@@ -1,8 +1,8 @@
extern "C" {
+typedef unsigned int PSI_memory_key;
}
extern "C" {
struct PSI_thread;
-typedef unsigned int PSI_memory_key;
struct PSI_memory_info_v1
{
PSI_memory_key *m_key;
diff --git a/include/mysql/psi/psi_abi_v2.h.pp b/include/mysql/psi/psi_abi_v2.h.pp
index a670e53a8b7..9188954885f 100644
--- a/include/mysql/psi/psi_abi_v2.h.pp
+++ b/include/mysql/psi/psi_abi_v2.h.pp
@@ -1,8 +1,8 @@
extern "C" {
+typedef unsigned int PSI_memory_key;
}
extern "C" {
struct PSI_thread;
-typedef unsigned int PSI_memory_key;
struct PSI_memory_info_v2
{
int placeholder;
diff --git a/include/mysql/psi/psi_base.h b/include/mysql/psi/psi_base.h
index 7b4eaf80892..2bb1d8fc354 100644
--- a/include/mysql/psi/psi_base.h
+++ b/include/mysql/psi/psi_base.h
@@ -164,6 +164,13 @@ extern "C" {
/** @} */
+/**
+ Instrumented memory key.
+ To instrument memory, a memory key must be obtained using @c register_memory.
+ Using a zero key always disable the instrumentation.
+*/
+typedef unsigned int PSI_memory_key;
+
#ifdef __cplusplus
}
#endif
diff --git a/include/mysql/psi/psi_memory.h b/include/mysql/psi/psi_memory.h
index 9b968667d53..60d68f1a6dd 100644
--- a/include/mysql/psi/psi_memory.h
+++ b/include/mysql/psi/psi_memory.h
@@ -53,13 +53,6 @@ extern "C" {
struct PSI_thread;
-/**
- Instrumented memory key.
- To instrument memory, a memory key must be obtained using @c register_memory.
- Using a zero key always disable the instrumentation.
-*/
-typedef unsigned int PSI_memory_key;
-
#ifdef HAVE_PSI_1
/**
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 7ce737249f7..306600d9c2c 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -8730,13 +8730,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)
{
@@ -8783,12 +8784,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 480f38926c1..f064f39f7df 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 */