Skip to content

Commit c208006

Browse files
MDEV-29008 Server crash or assertion `field' failed in spider_db_open_item_ident / group by handler
ha_spider::field_exchange() returns NULL and that results in a crash or a assertion failure in spider_db_open_item_ident(). In the first place, there seems to be no need to call field_exchange() for printing an identity (column name with alias). Thus, we simply remove the call.
1 parent 8c21dc5 commit c208006

File tree

4 files changed

+80
-2
lines changed

4 files changed

+80
-2
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#
2+
# MDEV-29008 Server crash or assertion `field' failed in spider_db_open_item_ident / group by handler
3+
#
4+
for master_1
5+
for child2
6+
child2_1
7+
child2_2
8+
child2_3
9+
for child3
10+
connection child2_1;
11+
CREATE DATABASE auto_test_remote;
12+
USE auto_test_remote;
13+
CREATE TABLE tbl_a (
14+
a INT,
15+
b INT
16+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
17+
INSERT INTO tbl_a VALUES (1,2),(3,4);
18+
connection master_1;
19+
CREATE DATABASE auto_test_local;
20+
USE auto_test_local;
21+
CREATE TABLE tbl_a (
22+
a INT,
23+
b INT
24+
) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"';
25+
SELECT MIN(t2.a) AS f1, t1.b AS f2 FROM tbl_a AS t1 JOIN tbl_a AS t2 GROUP BY f2 ORDER BY f1, f2;
26+
f1 f2
27+
1 2
28+
1 4
29+
connection master_1;
30+
DROP DATABASE IF EXISTS auto_test_local;
31+
connection child2_1;
32+
DROP DATABASE IF EXISTS auto_test_remote;
33+
for master_1
34+
for child2
35+
child2_1
36+
child2_2
37+
child2_3
38+
for child3
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
!include include/default_mysqld.cnf
2+
!include ../my_1_1.cnf
3+
!include ../my_2_1.cnf
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
--echo #
2+
--echo # MDEV-29008 Server crash or assertion `field' failed in spider_db_open_item_ident / group by handler
3+
--echo #
4+
5+
--disable_query_log
6+
--disable_result_log
7+
--source ../../t/test_init.inc
8+
--enable_result_log
9+
--enable_query_log
10+
11+
--connection child2_1
12+
CREATE DATABASE auto_test_remote;
13+
USE auto_test_remote;
14+
eval CREATE TABLE tbl_a (
15+
a INT,
16+
b INT
17+
) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
18+
INSERT INTO tbl_a VALUES (1,2),(3,4);
19+
20+
--connection master_1
21+
CREATE DATABASE auto_test_local;
22+
USE auto_test_local;
23+
eval CREATE TABLE tbl_a (
24+
a INT,
25+
b INT
26+
) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"';
27+
28+
SELECT MIN(t2.a) AS f1, t1.b AS f2 FROM tbl_a AS t1 JOIN tbl_a AS t2 GROUP BY f2 ORDER BY f1, f2;
29+
30+
--connection master_1
31+
DROP DATABASE IF EXISTS auto_test_local;
32+
--connection child2_1
33+
DROP DATABASE IF EXISTS auto_test_remote;
34+
35+
--disable_query_log
36+
--disable_result_log
37+
--source ../t/test_deinit.inc
38+
--enable_query_log
39+
--enable_result_log

storage/spider/spd_db_conn.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9115,8 +9115,6 @@ int spider_db_open_item_ident(
91159115
SPIDER_FIELD_HOLDER *field_holder = field_chain->field_holder;
91169116
spider = field_holder->spider;
91179117
share = spider->share;
9118-
field = spider->field_exchange(field);
9119-
DBUG_ASSERT(field);
91209118
if ((error_num = share->dbton_share[dbton_id]->
91219119
append_column_name_with_alias(str, field->field_index,
91229120
field_holder->alias->ptr(), field_holder->alias->length())))

0 commit comments

Comments
 (0)