Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
00db9c6b
Commit
00db9c6b
authored
Apr 17, 2020
by
Kentoku SHIBA
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-21884 MariaDB with Spider crashes on a query
parent
c79051e5
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
293 additions
and
0 deletions
+293
-0
storage/spider/mysql-test/spider/bugfix/include/mdev_21884_deinit.inc
...er/mysql-test/spider/bugfix/include/mdev_21884_deinit.inc
+14
-0
storage/spider/mysql-test/spider/bugfix/include/mdev_21884_init.inc
...ider/mysql-test/spider/bugfix/include/mdev_21884_init.inc
+57
-0
storage/spider/mysql-test/spider/bugfix/r/mdev_21884.result
storage/spider/mysql-test/spider/bugfix/r/mdev_21884.result
+107
-0
storage/spider/mysql-test/spider/bugfix/t/mdev_21884.cnf
storage/spider/mysql-test/spider/bugfix/t/mdev_21884.cnf
+3
-0
storage/spider/mysql-test/spider/bugfix/t/mdev_21884.test
storage/spider/mysql-test/spider/bugfix/t/mdev_21884.test
+97
-0
storage/spider/spd_db_conn.cc
storage/spider/spd_db_conn.cc
+15
-0
No files found.
storage/spider/mysql-test/spider/bugfix/include/mdev_21884_deinit.inc
0 → 100644
View file @
00db9c6b
--
let
$MASTER_1_COMMENT_2_1
=
$MASTER_1_COMMENT_2_1_BACKUP
--
let
$CHILD2_1_DROP_TABLES
=
$CHILD2_1_DROP_TABLES_BACKUP
--
let
$CHILD2_1_CREATE_TABLES
=
$CHILD2_1_CREATE_TABLES_BACKUP
--
let
$CHILD2_1_SELECT_TABLES
=
$CHILD2_1_SELECT_TABLES_BACKUP
--
connection
master_1
set
session
spider_bgs_mode
=
@
old_spider_bgs_mode
;
set
session
spider_quick_mode
=
@
old_spider_quick_mode
;
--
disable_warnings
--
disable_query_log
--
disable_result_log
--
source
../
t
/
test_deinit
.
inc
--
enable_result_log
--
enable_query_log
--
enable_warnings
storage/spider/mysql-test/spider/bugfix/include/mdev_21884_init.inc
0 → 100644
View file @
00db9c6b
--
disable_warnings
--
disable_query_log
--
disable_result_log
--
source
../
t
/
test_init
.
inc
--
enable_result_log
--
enable_query_log
--
enable_warnings
--
let
$MASTER_1_COMMENT_2_1_BACKUP
=
$MASTER_1_COMMENT_2_1
let
$MASTER_1_COMMENT_2_1
=
COMMENT
=
'table "tbl_a", srv "s_2_1"'
;
--
let
$MASTER_1_COMMENT_P_2_1_BACKUP
=
$MASTER_1_COMMENT_P_2_1
let
$MASTER_1_COMMENT_P_2_1
=
COMMENT
=
'table "ta_r3"'
PARTITION
BY
RANGE
(
a
)
(
PARTITION
pt1
VALUES
LESS
THAN
(
10
)
COMMENT
=
'srv "s_2_1", table "ta_r2",
priority "1000"'
,
PARTITION
pt2
VALUES
LESS
THAN
MAXVALUE
COMMENT
=
'srv "s_2_1", priority "1000001"'
);
--
let
$CHILD2_1_DROP_TABLES_BACKUP
=
$CHILD2_1_DROP_TABLES
let
$CHILD2_1_DROP_TABLES
=
DROP
TABLE
IF
EXISTS
tbl_a
;
let
$CHILD2_1_DROP_TABLES
=
DROP
TABLE
IF
EXISTS
ta_r2
$STR_SEMICOLON
DROP
TABLE
IF
EXISTS
ta_r3
;
--
let
$CHILD2_1_CREATE_TABLES_BACKUP
=
$CHILD2_1_CREATE_TABLES
let
$CHILD2_1_CREATE_TABLES
=
CREATE
TABLE
tbl_a
(
pkey
int
NOT
NULL
,
txt
char
(
8
)
NOT
NULL
,
PRIMARY
KEY
(
pkey
,
txt
)
)
$CHILD2_1_ENGINE
DEFAULT
CHARACTER
SET
utf8
;
let
$CHILD2_1_CREATE_TABLES
=
CREATE
TABLE
ta_r2
(
a
INT
,
b
CHAR
(
1
),
c
DATETIME
,
PRIMARY
KEY
(
a
,
b
)
)
$CHILD2_1_ENGINE
$CHILD2_1_CHARSET
$STR_SEMICOLON
CREATE
TABLE
ta_r3
(
a
INT
,
b
CHAR
(
1
),
c
DATETIME
,
PRIMARY
KEY
(
a
,
b
)
)
$CHILD2_1_ENGINE
$CHILD2_1_CHARSET
;
--
let
$CHILD2_1_SELECT_TABLES_BACKUP
=
$CHILD2_1_SELECT_TABLES
let
$CHILD2_1_SELECT_TABLES
=
SELECT
pkey
,
txt
FROM
tbl_a
ORDER
BY
pkey
;
let
$CHILD2_1_SELECT_TABLES
=
SELECT
a
,
b
,
c
FROM
ta_r2
ORDER
BY
a
$STR_SEMICOLON
SELECT
a
,
b
,
c
FROM
ta_r3
ORDER
BY
a
;
let
$CHILD2_1_SELECT_ARGUMENT1
=
SELECT
argument
FROM
mysql
.
general_log
WHERE
argument
LIKE
'%select %'
;
--
connection
master_1
set
@
old_spider_bgs_mode
=
@@
spider_bgs_mode
;
set
session
spider_bgs_mode
=
2
;
set
@
old_spider_quick_mode
=
@@
spider_quick_mode
;
set
session
spider_quick_mode
=
3
;
storage/spider/mysql-test/spider/bugfix/r/mdev_21884.result
0 → 100644
View file @
00db9c6b
for master_1
for child2
child2_1
child2_2
child2_3
for child3
connection master_1;
set @old_spider_bgs_mode= @@spider_bgs_mode;
set session spider_bgs_mode= 2;
set @old_spider_quick_mode= @@spider_quick_mode;
set session spider_quick_mode= 3;
this test is for MDEV-21884
drop and create databases
connection master_1;
CREATE DATABASE auto_test_local;
USE auto_test_local;
connection child2_1;
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = 'TABLE,FILE';
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
create table and insert
connection child2_1;
CHILD2_1_CREATE_TABLES
TRUNCATE TABLE mysql.general_log;
connection master_1;
CREATE TABLE tbl_a (
a INT,
b CHAR(1),
c DATETIME,
PRIMARY KEY(a,b)
) ENGINE=Spider COMMENT='table "ta_r3"'
PARTITION BY RANGE(a) (
PARTITION pt1 VALUES LESS THAN (10) COMMENT='srv "s_2_1", table "ta_r2",
priority "1000"',
PARTITION pt2 VALUES LESS THAN MAXVALUE COMMENT='srv "s_2_1", priority "1000001"'
)
CREATE TABLE tb_l (
a INT,
b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE2 MASTER_1_CHARSET2
INSERT INTO tbl_a (a, b, c) VALUES
(11, 'a', '2008-08-01 10:21:39'),
(11, 'b', '2000-01-01 00:00:00'),
(12, 'e', '2007-06-04 20:03:11'),
(12, 'd', '2003-11-30 05:01:03'),
(13, 'c', '2001-12-31 23:59:59');
INSERT INTO tb_l (a, b, c) VALUES
(11, 'a', '2008-08-01 10:21:39'),
(12, 'b', '2000-01-01 00:00:00'),
(13, 'e', '2007-06-04 20:03:11'),
(14, 'd', '2003-11-30 05:01:03'),
(15, 'c', '2001-12-31 23:59:59');
test 1
connection child2_1;
TRUNCATE TABLE mysql.general_log;
connection master_1;
SELECT STRAIGHT_JOIN b.a, b.b FROM tb_l a, tbl_a b WHERE a.a = b.a;
a b
11 a
11 b
12 d
12 e
13 c
connection child2_1;
SET NAMES utf8;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select `a`,`b` from `auto_test_remote`.`ta_r3` where `a` = 11 order by `b`
select `a`,`b` from `auto_test_remote`.`ta_r3` where `a` = 12 order by `b`
select `a`,`b` from `auto_test_remote`.`ta_r3` where `a` = 13 order by `b`
select `a`,`b` from `auto_test_remote`.`ta_r3` where `a` = 14 order by `b`
select `a`,`b` from `auto_test_remote`.`ta_r3` where `a` = 15 order by `b`
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT a, b, c FROM ta_r2 ORDER BY a ;
SELECT a, b, c FROM ta_r3 ORDER BY a;
a b c
a b c
11 a 2008-08-01 10:21:39
11 b 2000-01-01 00:00:00
12 d 2003-11-30 05:01:03
12 e 2007-06-04 20:03:11
13 c 2001-12-31 23:59:59
deinit
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
connection child2_1;
DROP DATABASE IF EXISTS auto_test_remote;
SET GLOBAL log_output = @old_log_output;
connection master_1;
set session spider_bgs_mode= @old_spider_bgs_mode;
set session spider_quick_mode= @old_spider_quick_mode;
for master_1
for child2
child2_1
child2_2
child2_3
for child3
end of test
storage/spider/mysql-test/spider/bugfix/t/mdev_21884.cnf
0 → 100644
View file @
00db9c6b
!include include/default_mysqld.cnf
!include ../my_1_1.cnf
!include ../my_2_1.cnf
storage/spider/mysql-test/spider/bugfix/t/mdev_21884.test
0 → 100644
View file @
00db9c6b
--
source
../
include
/
mdev_21884_init
.
inc
--
echo
--
echo
this
test
is
for
MDEV
-
21884
--
echo
--
echo
drop
and
create
databases
--
connection
master_1
--
disable_warnings
CREATE
DATABASE
auto_test_local
;
USE
auto_test_local
;
--
connection
child2_1
SET
@
old_log_output
=
@@
global
.
log_output
;
SET
GLOBAL
log_output
=
'TABLE,FILE'
;
CREATE
DATABASE
auto_test_remote
;
USE
auto_test_remote
;
--
enable_warnings
--
echo
--
echo
create
table
and
insert
--
connection
child2_1
--
disable_query_log
echo
CHILD2_1_CREATE_TABLES
;
eval
$CHILD2_1_CREATE_TABLES
;
--
enable_query_log
TRUNCATE
TABLE
mysql
.
general_log
;
--
connection
master_1
--
disable_query_log
echo
CREATE
TABLE
tbl_a
(
a
INT
,
b
CHAR
(
1
),
c
DATETIME
,
PRIMARY
KEY
(
a
,
b
)
)
$MASTER_1_ENGINE
$MASTER_1_COMMENT_P_2_1
;
eval
CREATE
TABLE
tbl_a
(
a
INT
,
b
CHAR
(
1
),
c
DATETIME
,
PRIMARY
KEY
(
a
,
b
)
)
$MASTER_1_ENGINE
$MASTER_1_COMMENT_P_2_1
;
echo
CREATE
TABLE
tb_l
(
a
INT
,
b
CHAR
(
1
),
c
DATETIME
,
PRIMARY
KEY
(
a
)
)
MASTER_1_ENGINE2
MASTER_1_CHARSET2
;
eval
CREATE
TABLE
tb_l
(
a
INT
,
b
CHAR
(
1
),
c
DATETIME
,
PRIMARY
KEY
(
a
)
)
$MASTER_1_ENGINE2
$MASTER_1_CHARSET2
;
--
enable_query_log
INSERT
INTO
tbl_a
(
a
,
b
,
c
)
VALUES
(
11
,
'a'
,
'2008-08-01 10:21:39'
),
(
11
,
'b'
,
'2000-01-01 00:00:00'
),
(
12
,
'e'
,
'2007-06-04 20:03:11'
),
(
12
,
'd'
,
'2003-11-30 05:01:03'
),
(
13
,
'c'
,
'2001-12-31 23:59:59'
);
INSERT
INTO
tb_l
(
a
,
b
,
c
)
VALUES
(
11
,
'a'
,
'2008-08-01 10:21:39'
),
(
12
,
'b'
,
'2000-01-01 00:00:00'
),
(
13
,
'e'
,
'2007-06-04 20:03:11'
),
(
14
,
'd'
,
'2003-11-30 05:01:03'
),
(
15
,
'c'
,
'2001-12-31 23:59:59'
);
--
echo
--
echo
test
1
--
connection
child2_1
TRUNCATE
TABLE
mysql
.
general_log
;
--
connection
master_1
SELECT
STRAIGHT_JOIN
b
.
a
,
b
.
b
FROM
tb_l
a
,
tbl_a
b
WHERE
a
.
a
=
b
.
a
;
--
connection
child2_1
SET
NAMES
utf8
;
eval
$CHILD2_1_SELECT_ARGUMENT1
;
eval
$CHILD2_1_SELECT_TABLES
;
--
echo
--
echo
deinit
--
disable_warnings
--
connection
master_1
DROP
DATABASE
IF
EXISTS
auto_test_local
;
--
connection
child2_1
DROP
DATABASE
IF
EXISTS
auto_test_remote
;
SET
GLOBAL
log_output
=
@
old_log_output
;
--
enable_warnings
--
source
../
include
/
mdev_21884_deinit
.
inc
--
echo
--
echo
end
of
test
storage/spider/spd_db_conn.cc
View file @
00db9c6b
...
...
@@ -3137,6 +3137,11 @@ int spider_db_fetch_table(
}
else
{
if
(
result_list
->
current_row_num
<
result_list
->
quick_page_size
)
{
if
(
!
current
->
first_position
)
{
table
->
status
=
STATUS_NOT_FOUND
;
DBUG_RETURN
(
HA_ERR_END_OF_FILE
);
}
row
=
current
->
first_position
[
result_list
->
current_row_num
].
row
;
}
else
{
if
((
error_num
=
spider_db_get_row_from_tmp_tbl
(
...
...
@@ -3335,6 +3340,11 @@ int spider_db_fetch_key(
}
else
{
if
(
result_list
->
current_row_num
<
result_list
->
quick_page_size
)
{
if
(
!
current
->
first_position
)
{
table
->
status
=
STATUS_NOT_FOUND
;
DBUG_RETURN
(
HA_ERR_END_OF_FILE
);
}
row
=
current
->
first_position
[
result_list
->
current_row_num
].
row
;
}
else
{
if
((
error_num
=
spider_db_get_row_from_tmp_tbl
(
...
...
@@ -3445,6 +3455,11 @@ int spider_db_fetch_minimum_columns(
{
DBUG_PRINT
(
"info"
,
(
"spider current=%p"
,
current
));
DBUG_PRINT
(
"info"
,
(
"spider first_position=%p"
,
current
->
first_position
));
if
(
!
current
->
first_position
)
{
table
->
status
=
STATUS_NOT_FOUND
;
DBUG_RETURN
(
HA_ERR_END_OF_FILE
);
}
DBUG_PRINT
(
"info"
,
(
"spider current_row_num=%lld"
,
result_list
->
current_row_num
));
DBUG_PRINT
(
"info"
,
(
"spider first_position[]=%p"
,
&
current
->
first_position
[
result_list
->
current_row_num
]));
row
=
current
->
first_position
[
result_list
->
current_row_num
].
row
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment