mirror of
https://github.com/MariaDB/server.git
synced 2026-05-14 19:07:15 +02:00
Merge 10.2 into 10.3
This commit is contained in:
commit
980dd09be6
22 changed files with 287 additions and 132 deletions
|
|
@ -3957,14 +3957,25 @@ static rocksdb::Status check_rocksdb_options_compatibility(
|
|||
return status;
|
||||
}
|
||||
|
||||
bool prevent_myrocks_loading= false;
|
||||
|
||||
|
||||
/*
|
||||
Storage Engine initialization function, invoked when plugin is loaded.
|
||||
*/
|
||||
|
||||
static int rocksdb_init_func(void *const p) {
|
||||
|
||||
DBUG_ENTER_FUNC();
|
||||
|
||||
if (prevent_myrocks_loading)
|
||||
{
|
||||
my_error(ER_INTERNAL_ERROR, MYF(0),
|
||||
"Loading MyRocks plugin after it has been unloaded is not "
|
||||
"supported. Please restart mysqld");
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
// Validate the assumption about the size of ROCKSDB_SIZEOF_HIDDEN_PK_COLUMN.
|
||||
static_assert(sizeof(longlong) == 8, "Assuming that longlong is 8 bytes.");
|
||||
|
||||
|
|
@ -4505,12 +4516,27 @@ static int rocksdb_done_func(void *const p) {
|
|||
}
|
||||
#endif /* HAVE_purify */
|
||||
|
||||
rocksdb_db_options = nullptr;
|
||||
rocksdb_tbl_options = nullptr;
|
||||
/*
|
||||
MariaDB: don't clear rocksdb_db_options and rocksdb_tbl_options.
|
||||
MyRocks' plugin variables refer to them.
|
||||
|
||||
The plugin cannot be loaded again (see prevent_myrocks_loading) but plugin
|
||||
variables are processed before myrocks::rocksdb_init_func is invoked, so
|
||||
they must point to valid memory.
|
||||
*/
|
||||
//rocksdb_db_options = nullptr;
|
||||
rocksdb_db_options->statistics = nullptr;
|
||||
//rocksdb_tbl_options = nullptr;
|
||||
rocksdb_stats = nullptr;
|
||||
|
||||
my_error_unregister(HA_ERR_ROCKSDB_FIRST, HA_ERR_ROCKSDB_LAST);
|
||||
|
||||
/*
|
||||
Prevent loading the plugin after it has been loaded and then unloaded. This
|
||||
doesn't work currently.
|
||||
*/
|
||||
prevent_myrocks_loading= true;
|
||||
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
|
|
@ -10031,6 +10057,7 @@ int ha_rocksdb::external_lock(THD *const thd, int lock_type) {
|
|||
thd->lex->sql_command != SQLCOM_LOCK_TABLES && // (*)
|
||||
thd->lex->sql_command != SQLCOM_ANALYZE && // (**)
|
||||
thd->lex->sql_command != SQLCOM_OPTIMIZE && // (**)
|
||||
thd->lex->sql_command != SQLCOM_FLUSH && // (**)
|
||||
my_core::thd_binlog_filter_ok(thd)) {
|
||||
my_error(ER_REQUIRE_ROW_BINLOG_FORMAT, MYF(0));
|
||||
DBUG_RETURN(HA_ERR_UNSUPPORTED);
|
||||
|
|
|
|||
|
|
@ -1414,4 +1414,5 @@ private:
|
|||
|
||||
const int MYROCKS_MARIADB_PLUGIN_MATURITY_LEVEL= MariaDB_PLUGIN_MATURITY_GAMMA;
|
||||
|
||||
extern bool prevent_myrocks_loading;
|
||||
} // namespace myrocks
|
||||
|
|
|
|||
|
|
@ -10,3 +10,22 @@ insert into test.t1 values (1);
|
|||
connection default;
|
||||
DROP TABLE t1;
|
||||
UNINSTALL SONAME 'ha_rocksdb';
|
||||
#
|
||||
# MDEV-15686: Loading MyRocks plugin back after it has been unloaded causes a crash
|
||||
#
|
||||
call mtr.add_suppression("Plugin 'ROCKSDB.*' init function returned error.");
|
||||
call mtr.add_suppression("Plugin 'ROCKSDB.*' registration as a INFORMATION SCHEMA failed.");
|
||||
call mtr.add_suppression("Plugin 'ROCKSDB' registration as a STORAGE ENGINE failed");
|
||||
#
|
||||
# There are two possible scenarios:
|
||||
# ha_rocksdb.{dll,so} is still loaded into mysqld's address space. Its
|
||||
# global variables are in the state that doesn't allow it to be
|
||||
# initialized back (this is what MDEV-15686 is about). This is handled
|
||||
# by intentionally returning an error from rocksdb_init_func.
|
||||
#
|
||||
# The second case is when ha_rocksdb.{ddl,so} has been fully unloaded
|
||||
# and so it will be now loaded as if it happens for the first time.
|
||||
INSTALL SONAME 'ha_rocksdb';
|
||||
# Whatever happened on the previous step, restore things to the way they
|
||||
# were at testcase start.
|
||||
UNINSTALL SONAME 'ha_rocksdb';
|
||||
|
|
|
|||
14
storage/rocksdb/mysql-test/rocksdb/r/mariadb_port_rpl.result
Normal file
14
storage/rocksdb/mysql-test/rocksdb/r/mariadb_port_rpl.result
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#
|
||||
# MDEV-15472: Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failure ...
|
||||
#
|
||||
select @@log_bin;
|
||||
@@log_bin
|
||||
1
|
||||
select @@binlog_format;
|
||||
@@binlog_format
|
||||
ROW
|
||||
CREATE OR REPLACE TABLE t1 (i INT) ENGINE=RocksDB;
|
||||
LOCK TABLE t1 WRITE;
|
||||
FLUSH TABLES;
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE t1;
|
||||
|
|
@ -5,7 +5,14 @@
|
|||
--echo # MDEV-14843: Assertion `s_tx_list.size() == 0' failed in myrocks::Rdb_transaction::term_mutex
|
||||
--echo #
|
||||
|
||||
#
|
||||
# On Linux, wsrep plugin is always loaded so XA is enabled at this point.
|
||||
# On Windows, there is no wsrep, so we get this warning:
|
||||
# Warning 1105 Cannot enable tc-log at run-time. XA features of ROCKSDB are disabled
|
||||
#
|
||||
--disable_warnings
|
||||
INSTALL SONAME 'ha_rocksdb';
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (i INT) ENGINE=RocksDB;
|
||||
insert into t1 values (1);
|
||||
|
|
@ -19,3 +26,30 @@ connection default;
|
|||
# Cleanup
|
||||
DROP TABLE t1;
|
||||
UNINSTALL SONAME 'ha_rocksdb';
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-15686: Loading MyRocks plugin back after it has been unloaded causes a crash
|
||||
--echo #
|
||||
call mtr.add_suppression("Plugin 'ROCKSDB.*' init function returned error.");
|
||||
call mtr.add_suppression("Plugin 'ROCKSDB.*' registration as a INFORMATION SCHEMA failed.");
|
||||
call mtr.add_suppression("Plugin 'ROCKSDB' registration as a STORAGE ENGINE failed");
|
||||
|
||||
--echo #
|
||||
--echo # There are two possible scenarios:
|
||||
|
||||
--echo # ha_rocksdb.{dll,so} is still loaded into mysqld's address space. Its
|
||||
--echo # global variables are in the state that doesn't allow it to be
|
||||
--echo # initialized back (this is what MDEV-15686 is about). This is handled
|
||||
--echo # by intentionally returning an error from rocksdb_init_func.
|
||||
--echo #
|
||||
--echo # The second case is when ha_rocksdb.{ddl,so} has been fully unloaded
|
||||
--echo # and so it will be now loaded as if it happens for the first time.
|
||||
|
||||
--error 0,ER_INTERNAL_ERROR
|
||||
INSTALL SONAME 'ha_rocksdb';
|
||||
|
||||
--echo # Whatever happened on the previous step, restore things to the way they
|
||||
--echo # were at testcase start.
|
||||
--error 0,ER_SP_DOES_NOT_EXIST
|
||||
UNINSTALL SONAME 'ha_rocksdb';
|
||||
|
||||
|
|
|
|||
14
storage/rocksdb/mysql-test/rocksdb/t/mariadb_port_rpl.test
Normal file
14
storage/rocksdb/mysql-test/rocksdb/t/mariadb_port_rpl.test
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
--source include/have_rocksdb.inc
|
||||
--source include/have_binlog_format_row.inc
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-15472: Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failure ...
|
||||
--echo #
|
||||
select @@log_bin;
|
||||
select @@binlog_format;
|
||||
CREATE OR REPLACE TABLE t1 (i INT) ENGINE=RocksDB;
|
||||
LOCK TABLE t1 WRITE;
|
||||
FLUSH TABLES;
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
|
@ -142,6 +142,9 @@ static int rdb_i_s_cfstats_fill_table(
|
|||
static int rdb_i_s_cfstats_init(void *p) {
|
||||
DBUG_ENTER_FUNC();
|
||||
|
||||
if (prevent_myrocks_loading)
|
||||
DBUG_RETURN(1);
|
||||
|
||||
DBUG_ASSERT(p != nullptr);
|
||||
|
||||
my_core::ST_SCHEMA_TABLE *schema;
|
||||
|
|
@ -235,6 +238,9 @@ static int rdb_i_s_dbstats_fill_table(
|
|||
static int rdb_i_s_dbstats_init(void *const p) {
|
||||
DBUG_ENTER_FUNC();
|
||||
|
||||
if (prevent_myrocks_loading)
|
||||
DBUG_RETURN(1);
|
||||
|
||||
DBUG_ASSERT(p != nullptr);
|
||||
|
||||
my_core::ST_SCHEMA_TABLE *schema;
|
||||
|
|
@ -336,6 +342,8 @@ static int rdb_i_s_perf_context_fill_table(
|
|||
static int rdb_i_s_perf_context_init(void *const p) {
|
||||
DBUG_ENTER_FUNC();
|
||||
|
||||
if (prevent_myrocks_loading)
|
||||
DBUG_RETURN(1);
|
||||
DBUG_ASSERT(p != nullptr);
|
||||
|
||||
my_core::ST_SCHEMA_TABLE *schema;
|
||||
|
|
@ -403,6 +411,9 @@ static int rdb_i_s_perf_context_global_fill_table(
|
|||
static int rdb_i_s_perf_context_global_init(void *const p) {
|
||||
DBUG_ENTER_FUNC();
|
||||
|
||||
if (prevent_myrocks_loading)
|
||||
DBUG_RETURN(1);
|
||||
|
||||
DBUG_ASSERT(p != nullptr);
|
||||
|
||||
my_core::ST_SCHEMA_TABLE *schema;
|
||||
|
|
@ -1017,6 +1028,9 @@ static int rdb_i_s_ddl_fill_table(my_core::THD *const thd,
|
|||
static int rdb_i_s_ddl_init(void *const p) {
|
||||
DBUG_ENTER_FUNC();
|
||||
|
||||
if (prevent_myrocks_loading)
|
||||
DBUG_RETURN(1);
|
||||
|
||||
my_core::ST_SCHEMA_TABLE *schema;
|
||||
|
||||
DBUG_ASSERT(p != nullptr);
|
||||
|
|
@ -1032,6 +1046,9 @@ static int rdb_i_s_ddl_init(void *const p) {
|
|||
static int rdb_i_s_cfoptions_init(void *const p) {
|
||||
DBUG_ENTER_FUNC();
|
||||
|
||||
if (prevent_myrocks_loading)
|
||||
DBUG_RETURN(1);
|
||||
|
||||
DBUG_ASSERT(p != nullptr);
|
||||
|
||||
my_core::ST_SCHEMA_TABLE *schema;
|
||||
|
|
@ -1047,6 +1064,9 @@ static int rdb_i_s_cfoptions_init(void *const p) {
|
|||
static int rdb_i_s_global_info_init(void *const p) {
|
||||
DBUG_ENTER_FUNC();
|
||||
|
||||
if (prevent_myrocks_loading)
|
||||
DBUG_RETURN(1);
|
||||
|
||||
DBUG_ASSERT(p != nullptr);
|
||||
|
||||
my_core::ST_SCHEMA_TABLE *schema;
|
||||
|
|
@ -1063,6 +1083,10 @@ static int rdb_i_s_compact_stats_init(void *p) {
|
|||
my_core::ST_SCHEMA_TABLE *schema;
|
||||
|
||||
DBUG_ENTER_FUNC();
|
||||
|
||||
if (prevent_myrocks_loading)
|
||||
DBUG_RETURN(1);
|
||||
|
||||
DBUG_ASSERT(p != nullptr);
|
||||
|
||||
schema = reinterpret_cast<my_core::ST_SCHEMA_TABLE *>(p);
|
||||
|
|
@ -1237,6 +1261,9 @@ static int rdb_i_s_index_file_map_fill_table(
|
|||
static int rdb_i_s_index_file_map_init(void *const p) {
|
||||
DBUG_ENTER_FUNC();
|
||||
|
||||
if (prevent_myrocks_loading)
|
||||
DBUG_RETURN(1);
|
||||
|
||||
DBUG_ASSERT(p != nullptr);
|
||||
|
||||
my_core::ST_SCHEMA_TABLE *schema;
|
||||
|
|
@ -1320,6 +1347,9 @@ static int rdb_i_s_lock_info_fill_table(
|
|||
static int rdb_i_s_lock_info_init(void *const p) {
|
||||
DBUG_ENTER_FUNC();
|
||||
|
||||
if (prevent_myrocks_loading)
|
||||
DBUG_RETURN(1);
|
||||
|
||||
DBUG_ASSERT(p != nullptr);
|
||||
|
||||
my_core::ST_SCHEMA_TABLE *schema;
|
||||
|
|
@ -1450,6 +1480,9 @@ static int rdb_i_s_trx_info_fill_table(
|
|||
static int rdb_i_s_trx_info_init(void *const p) {
|
||||
DBUG_ENTER_FUNC();
|
||||
|
||||
if (prevent_myrocks_loading)
|
||||
DBUG_RETURN(1);
|
||||
|
||||
DBUG_ASSERT(p != nullptr);
|
||||
|
||||
my_core::ST_SCHEMA_TABLE *schema;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue