diff options
author | Nayuta Yanagisawa <nayuta.yanagisawa@hey.com> | 2022-04-13 17:52:27 +0900 |
---|---|---|
committer | Nayuta Yanagisawa <nayuta.yanagisawa@hey.com> | 2022-04-13 17:52:27 +0900 |
commit | cbf9d8a8d5362e710144c308c97b2f96432c233d (patch) | |
tree | 19fcb0ab38dbb7f68b0a812860499b427b31194e /storage/spider | |
parent | c5512878fe219199c6052d76eb3c70c921378edc (diff) | |
parent | e87c710dfc802254a59fa1bb0f9f43afaf3ef301 (diff) | |
download | mariadb-git-cbf9d8a8d5362e710144c308c97b2f96432c233d.tar.gz |
Merge 10.7 into 10.8
Diffstat (limited to 'storage/spider')
-rw-r--r-- | storage/spider/ha_spider.cc | 136 | ||||
-rw-r--r-- | storage/spider/mysql-test/spider/bugfix/r/mdev_27239.result | 20 | ||||
-rw-r--r-- | storage/spider/mysql-test/spider/bugfix/t/mdev_27239.cnf | 2 | ||||
-rw-r--r-- | storage/spider/mysql-test/spider/bugfix/t/mdev_27239.test | 24 | ||||
-rw-r--r-- | storage/spider/mysql-test/spider/r/variable_deprecation.result | 17 | ||||
-rw-r--r-- | storage/spider/mysql-test/spider/t/variable_deprecation.test | 12 | ||||
-rw-r--r-- | storage/spider/spd_param.cc | 2 | ||||
-rw-r--r-- | storage/spider/spd_table.cc | 2 |
8 files changed, 139 insertions, 76 deletions
diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 7b4b7b9e127..f0ac3af7d6d 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -1027,64 +1027,83 @@ int ha_spider::external_lock( int error_num = 0; SPIDER_TRX *trx; backup_error_status(); + DBUG_ENTER("ha_spider::external_lock"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider lock_type=%x", lock_type)); -#if MYSQL_VERSION_ID < 50500 - DBUG_PRINT("info",("spider thd->options=%x", (int) thd->options)); -#endif -#ifdef WITH_PARTITION_STORAGE_ENGINE - if ( - wide_handler->stage == SPD_HND_STAGE_EXTERNAL_LOCK && - wide_handler->stage_executor != this) + DBUG_PRINT("info", ("spider sql_command=%d", thd_sql_command(thd))); + + if (wide_handler->stage == SPD_HND_STAGE_EXTERNAL_LOCK) { - DBUG_RETURN(0); + /* Only the stage executor deals with table locks. */ + if (wide_handler->stage_executor != this) + { + DBUG_RETURN(0); + } + } + else + { + /* Update the stage executor when the stage changes */ + wide_handler->stage= SPD_HND_STAGE_EXTERNAL_LOCK; + wide_handler->stage_executor= this; } - wide_handler->stage = SPD_HND_STAGE_EXTERNAL_LOCK; - wide_handler->stage_executor = this; -#endif -#ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC - info_auto_called = FALSE; -#endif + info_auto_called = FALSE; + wide_handler->external_lock_type= lock_type; wide_handler->sql_command = thd_sql_command(thd); + + /* We treat BEGIN as if UNLOCK TABLE. */ if (wide_handler->sql_command == SQLCOM_BEGIN) + { wide_handler->sql_command = SQLCOM_UNLOCK_TABLES; + } + if (lock_type == F_UNLCK && + wide_handler->sql_command != SQLCOM_UNLOCK_TABLES) + { + DBUG_RETURN(0); + } trx = spider_get_trx(thd, TRUE, &error_num); if (error_num) + { DBUG_RETURN(error_num); + } wide_handler->trx = trx; - DBUG_PRINT("info",("spider sql_command=%d", wide_handler->sql_command)); -#ifdef HA_CAN_BULK_ACCESS - wide_handler->external_lock_cnt++; -#endif - if ( - lock_type == F_UNLCK && - wide_handler->sql_command != SQLCOM_UNLOCK_TABLES - ) - DBUG_RETURN(0); + /* Question: Why the following if block is necessary? Why here? */ if (store_error_num) + { DBUG_RETURN(store_error_num); - wide_handler->external_lock_type = lock_type; - if ( - /* SQLCOM_RENAME_TABLE and SQLCOM_DROP_DB don't come here */ - wide_handler->sql_command == SQLCOM_DROP_TABLE || - wide_handler->sql_command == SQLCOM_ALTER_TABLE - ) { - if (trx->locked_connections) - { - my_message(ER_SPIDER_ALTER_BEFORE_UNLOCK_NUM, - ER_SPIDER_ALTER_BEFORE_UNLOCK_STR, MYF(0)); - DBUG_RETURN(ER_SPIDER_ALTER_BEFORE_UNLOCK_NUM); - } - DBUG_RETURN(0); + } + + DBUG_ASSERT(wide_handler->sql_command != SQLCOM_RENAME_TABLE && + wide_handler->sql_command != SQLCOM_DROP_DB); + + if (wide_handler->sql_command == SQLCOM_DROP_TABLE || + wide_handler->sql_command == SQLCOM_ALTER_TABLE) + { + if (trx->locked_connections) + { + my_message(ER_SPIDER_ALTER_BEFORE_UNLOCK_NUM, + ER_SPIDER_ALTER_BEFORE_UNLOCK_STR, MYF(0)); + DBUG_RETURN(ER_SPIDER_ALTER_BEFORE_UNLOCK_NUM); } - if (unlikely((error_num = spider_internal_start_trx(this)))) + DBUG_RETURN(0); + } + + if (lock_type != F_UNLCK) + { + if (unlikely((error_num= spider_internal_start_trx(this)))) { DBUG_RETURN(error_num); } + if (wide_handler->sql_command != SQLCOM_SELECT && + wide_handler->sql_command != SQLCOM_HA_READ) + { + trx->updated_in_this_trx= TRUE; + DBUG_PRINT("info", ("spider trx->updated_in_this_trx=TRUE")); + } + } if (wide_handler->lock_table_type > 0 || wide_handler->sql_command == SQLCOM_UNLOCK_TABLES) @@ -1097,12 +1116,10 @@ int ha_spider::external_lock( } /* lock/unlock tables */ -#ifdef WITH_PARTITION_STORAGE_ENGINE if (partition_handler && partition_handler->handlers) { - uint roop_count; - for (roop_count = 0; roop_count < partition_handler->no_parts; - ++roop_count) + for (uint roop_count= 0; roop_count < partition_handler->no_parts; + ++roop_count) { if (unlikely((error_num = partition_handler->handlers[roop_count]->lock_tables()))) @@ -1110,44 +1127,13 @@ int ha_spider::external_lock( DBUG_RETURN(error_num); } } - } else { -#endif - if (unlikely((error_num = lock_tables()))) - { - DBUG_RETURN(error_num); - } -#ifdef WITH_PARTITION_STORAGE_ENGINE } -#endif - } - - DBUG_PRINT("info",("spider trx_start=%s", - trx->trx_start ? "TRUE" : "FALSE")); - /* need to check after spider_internal_start_trx() */ - if (trx->trx_start) - { - switch (wide_handler->sql_command) + else if (unlikely((error_num= lock_tables()))) { - case SQLCOM_SELECT: - case SQLCOM_HA_READ: - /* nothing to do */ - break; - case SQLCOM_UPDATE: - case SQLCOM_UPDATE_MULTI: - case SQLCOM_CREATE_TABLE: - case SQLCOM_INSERT: - case SQLCOM_INSERT_SELECT: - case SQLCOM_DELETE: - case SQLCOM_LOAD: - case SQLCOM_REPLACE: - case SQLCOM_REPLACE_SELECT: - case SQLCOM_DELETE_MULTI: - default: - trx->updated_in_this_trx = TRUE; - DBUG_PRINT("info",("spider trx->updated_in_this_trx=TRUE")); - break; + DBUG_RETURN(error_num); } } + DBUG_RETURN(0); } diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_27239.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_27239.result new file mode 100644 index 00000000000..de135972a22 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_27239.result @@ -0,0 +1,20 @@ +# +# MDEV-27239 Spider: Assertion `thd->transaction->stmt.ha_list == __null || trans == &thd->transaction->stmt' failed in ha_commit_trans on BEGIN WORK after FTWRL +# +for master_1 +for child2 +for child3 +CREATE DATABASE auto_test_local; +USE auto_test_local; +CREATE TABLE tbl_a (a INT) ENGINE=SPIDER; +FLUSH TABLE tbl_a WITH READ LOCK; +Warnings: +Error 1429 Unable to connect to foreign data source: localhost +Error 1429 Unable to connect to foreign data source: localhost +Error 1429 Unable to connect to foreign data source: localhost +Error 1429 Unable to connect to foreign data source: localhost +BEGIN; +DROP DATABASE auto_test_local; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_27239.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_27239.cnf new file mode 100644 index 00000000000..b0853e32654 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_27239.cnf @@ -0,0 +1,2 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_27239.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_27239.test new file mode 100644 index 00000000000..3cf4bebd369 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_27239.test @@ -0,0 +1,24 @@ +--echo # +--echo # MDEV-27239 Spider: Assertion `thd->transaction->stmt.ha_list == __null || trans == &thd->transaction->stmt' failed in ha_commit_trans on BEGIN WORK after FTWRL +--echo # + +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log + +CREATE DATABASE auto_test_local; +USE auto_test_local; + +CREATE TABLE tbl_a (a INT) ENGINE=SPIDER; +FLUSH TABLE tbl_a WITH READ LOCK; +BEGIN; + +DROP DATABASE auto_test_local; + +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log diff --git a/storage/spider/mysql-test/spider/r/variable_deprecation.result b/storage/spider/mysql-test/spider/r/variable_deprecation.result index b9c7fb17839..6d715d95b9f 100644 --- a/storage/spider/mysql-test/spider/r/variable_deprecation.result +++ b/storage/spider/mysql-test/spider/r/variable_deprecation.result @@ -26,6 +26,8 @@ Warning 1287 The table parameter 'uhd' is deprecated and will be removed in a fu CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='use_handler "3"'; Warnings: Warning 1287 The table parameter 'use_handler' is deprecated and will be removed in a future release +DROP TABLE tbl_a; +DROP TABLE tbl_b; # MDEV-28005 Deprecate Spider plugin variables regarding UDFs SET GLOBAL spider_udf_ds_bulk_insert_rows = 1; Warnings: @@ -57,6 +59,21 @@ Warning 1287 '@@spider_udf_ct_bulk_insert_rows' is deprecated and will be remove SHOW VARIABLES LIKE "spider_udf_ct_bulk_insert_rows"; Variable_name Value spider_udf_ct_bulk_insert_rows 1 +# MDEV-27981 Deprecate spider_internal_limit +SET spider_internal_limit = 1; +Warnings: +Warning 1287 '@@spider_internal_limit' is deprecated and will be removed in a future release +SHOW VARIABLES LIKE "spider_internal_limit"; +Variable_name Value +spider_internal_limit 9223372032559808513 +CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='ilm "1"'; +Warnings: +Warning 1287 The table parameter 'ilm' is deprecated and will be removed in a future release +CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='internal_limit "1"'; +Warnings: +Warning 1287 The table parameter 'internal_limit' is deprecated and will be removed in a future release +DROP TABLE tbl_a; +DROP TABLE tbl_b; DROP DATABASE auto_test_local; for master_1 for child2 diff --git a/storage/spider/mysql-test/spider/t/variable_deprecation.test b/storage/spider/mysql-test/spider/t/variable_deprecation.test index 23519be146e..8521f5595d1 100644 --- a/storage/spider/mysql-test/spider/t/variable_deprecation.test +++ b/storage/spider/mysql-test/spider/t/variable_deprecation.test @@ -18,6 +18,9 @@ SHOW VARIABLES LIKE "spider_use_handler"; eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='uhd "3"'; eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='use_handler "3"'; +DROP TABLE tbl_a; +DROP TABLE tbl_b; + --echo # MDEV-28005 Deprecate Spider plugin variables regarding UDFs SET GLOBAL spider_udf_ds_bulk_insert_rows = 1; SHOW VARIABLES LIKE "spider_udf_ds_bulk_insert_rows"; @@ -34,6 +37,15 @@ SHOW VARIABLES LIKE "spider_udf_ct_bulk_insert_interval"; SET GLOBAL spider_udf_ct_bulk_insert_rows = 1; SHOW VARIABLES LIKE "spider_udf_ct_bulk_insert_rows"; +--echo # MDEV-27981 Deprecate spider_internal_limit +SET spider_internal_limit = 1; +SHOW VARIABLES LIKE "spider_internal_limit"; +eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='ilm "1"'; +eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='internal_limit "1"'; + +DROP TABLE tbl_a; +DROP TABLE tbl_b; + DROP DATABASE auto_test_local; --disable_query_log diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc index 09d435f22f0..c14f95ae182 100644 --- a/storage/spider/spd_param.cc +++ b/storage/spider/spd_param.cc @@ -474,7 +474,7 @@ longlong spider_param_internal_offset( */ static MYSQL_THDVAR_LONGLONG( internal_limit, /* name */ - PLUGIN_VAR_RQCMDARG, /* opt */ + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */ "Internal limit", /* comment */ NULL, /* check */ spider_use_table_value_deprecated, /* update */ diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 57954aa9543..f04b4208002 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -2343,6 +2343,7 @@ int spider_parse_connect_info( SPIDER_PARAM_LONGLONG("frd", first_read, 0); SPIDER_PARAM_INT("isa", init_sql_alloc_size, 0); SPIDER_PARAM_INT_WITH_MAX("idl", internal_delayed, 0, 1); + SPIDER_PARAM_DEPRECATED_WARNING("ilm"); SPIDER_PARAM_LONGLONG("ilm", internal_limit, 0); SPIDER_PARAM_LONGLONG("ios", internal_offset, 0); SPIDER_PARAM_INT_WITH_MAX("iom", internal_optimize, 0, 1); @@ -2522,6 +2523,7 @@ int spider_parse_connect_info( error_num = connect_string_parse.print_param_error(); goto error; case 14: + SPIDER_PARAM_DEPRECATED_WARNING("internal_limit"); SPIDER_PARAM_LONGLONG("internal_limit", internal_limit, 0); #ifndef WITHOUT_SPIDER_BG_SEARCH SPIDER_PARAM_LONGLONG("bgs_first_read", bgs_first_read, 0); |