mirror of
https://github.com/MariaDB/server.git
synced 2025-10-01 13:29:18 +02:00

This is a squash of about two dozen commits for MDEV-37114, MDEV-37110, MDEV-37111, see below ---- MDEV-27260 [WIP] Initial stub of spider select handler MDEV-27260 [wip] An dummy implementation of spider select that returns a single row of NULL Sample test case: --disable_query_log --disable_result_log --source ../../t/test_init.inc --enable_result_log --enable_query_log set spider_same_server_link= 1; set spider_disable_select_handler= 0; evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); create table t2 (c int); create table t1 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; insert into t1 values (1), (2), (3); select * from t1; drop table t1, t2; drop server srv; --disable_query_log --disable_result_log --source ../../t/test_deinit.inc --enable_result_log --enable_query_log MDEV-27260 [wip] beelining a spider select handler poc Works for the following simple case --disable_query_log --disable_result_log --source ../../t/test_init.inc --enable_result_log --enable_query_log set spider_same_server_link= 1; set spider_disable_select_handler= 0; evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); create table t2 (c int); create table t1 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; insert into t1 values (1), (2), (3); select c from t1; drop table t1, t2; drop server srv; --disable_query_log --disable_result_log --source ../../t/test_deinit.inc --enable_result_log --enable_query_log MDEV-27260 MDEV-37110 [wip] Make spider sh work with cases not working well with spider gbh See added testcase MDEV-27260 MDEV-37111 spider sh: Check backends used by spider tables MDEV-37111 set first_link_idx and create conn for every ha_spider involved also return failure when remote query execution fails. MDEV-37111 Fix some result mismatch Later we'll have to find a way (rdiff?) to accommodate both sh and gbh MDEV-37111 spider sh: do not create for partitioned tables neither does gbh except when there's one partition only. MDEV-37111 Ban spider sh if containing any subqueries The same limitation applies to gbh MDEV-37111 spider sh: reset select_column_mode just like gbh MDEV-37111 mtr --record spider.direct_join MDEV-37111 Do not create spider sh if not all tables share the same first connection We have been only checking the first connection. If no tables have HA, and they all use the same remote server, then an sh creation can proceed MDEV-37111 spider sh: sync link idx of dbton_handler and the connection ...so that the table name translation is correct MDEV-37111 add a possible error caused by the spider sh spider error reporting. previous query INSERT INTO t2 SELECT * FROM t3 failed to connect because t1 is self-referencing, though the reported error is ER_WRONG_VALUE_COUNT_ON_ROW from the sql layer. in SELECT * FROM t3 then during optimization (skipped in sh) the previous error gets reported. It's mainly a problem with spider error reporting, so we fix it with a record MDEV-37111 spider sh: check error mode before reporting errors With erm (error_read_mode) an error becomes an empty result with a warning MDEV-37111 spider sh: add checks and set db for udf udf_pushdown passes, but the two ha tests now fail MDEV-37111 spider sh: fix mdev_34541 just a different (non-spider version of the) error MDEV-37111 spider sh: only create if the first link is OK gbh implementation w.r.t. checking remote link status is unnecessarily convoluted. MDEV-37111 spider sh: append correct lock in INSERT...SELECT Also record spider_fixes tests results because the direct_order_limit status variable makes no sense MDEV-37111 spider sh: execute queries that are required by some system variables Whether these queries are needed is a separate question. This fixes failures in sql_mode_mysql and sql_mode_mariadb. For similar reasons, execute start transaction and commit because of test .result file has them. MDEV-37111 spider sh: mtr --record engine_defined_attributes without spider sh, the "FORCE INDEX" hint is appended in ha_spider::append_hint_after_table_sql_part through get_index_max_value as part of the optimization, and gbh is not involved. TODO: consider respecting the hint in spider sh/gbh MDEV-37111 spider sh: do not create if the query has been optimized Check select_lex->first_cond_optimization. It could happen during 2nd and subsequent ps execution when sh is not created in the first ps execution
13 lines
368 B
C++
13 lines
368 B
C++
class spider_select_handler: public select_handler
|
|
{
|
|
spider_fields *fields;
|
|
int store_error;
|
|
public:
|
|
spider_select_handler(THD *, SELECT_LEX *, spider_fields *);
|
|
~spider_select_handler();
|
|
int init_scan() override;
|
|
int next_row() override;
|
|
int end_scan() override;
|
|
};
|
|
|
|
select_handler *spider_create_select_handler(THD *, SELECT_LEX *, SELECT_LEX_UNIT *);
|