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
6599cd98
Commit
6599cd98
authored
Apr 26, 2019
by
Kentoku SHIBA
Committed by
GitHub
Apr 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-18988 Wrong result when query with group by x order by y limit n (#1286)
parent
82d06989
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
836 additions
and
1 deletion
+836
-1
storage/spider/mysql-test/spider/bugfix/include/group_by_order_by_limit_deinit.inc
.../spider/bugfix/include/group_by_order_by_limit_deinit.inc
+14
-0
storage/spider/mysql-test/spider/bugfix/include/group_by_order_by_limit_init.inc
...st/spider/bugfix/include/group_by_order_by_limit_init.inc
+54
-0
storage/spider/mysql-test/spider/bugfix/r/group_by_order_by_limit.result
...mysql-test/spider/bugfix/r/group_by_order_by_limit.result
+117
-0
storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.cnf
...er/mysql-test/spider/bugfix/t/group_by_order_by_limit.cnf
+4
-0
storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.test
...r/mysql-test/spider/bugfix/t/group_by_order_by_limit.test
+97
-0
storage/spider/mysql-test/spider/regression/e112122/include/group_by_order_by_limit_ok_deinit.inc
...ion/e112122/include/group_by_order_by_limit_ok_deinit.inc
+14
-0
storage/spider/mysql-test/spider/regression/e112122/include/group_by_order_by_limit_ok_init.inc
...ssion/e112122/include/group_by_order_by_limit_ok_init.inc
+54
-0
storage/spider/mysql-test/spider/regression/e112122/my.cnf
storage/spider/mysql-test/spider/regression/e112122/my.cnf
+4
-0
storage/spider/mysql-test/spider/regression/e112122/my_1_1.cnf
...ge/spider/mysql-test/spider/regression/e112122/my_1_1.cnf
+44
-0
storage/spider/mysql-test/spider/regression/e112122/my_2_1.cnf
...ge/spider/mysql-test/spider/regression/e112122/my_2_1.cnf
+56
-0
storage/spider/mysql-test/spider/regression/e112122/my_2_2.cnf
...ge/spider/mysql-test/spider/regression/e112122/my_2_2.cnf
+38
-0
storage/spider/mysql-test/spider/regression/e112122/r/group_by_order_by_limit_ok.result
...er/regression/e112122/r/group_by_order_by_limit_ok.result
+117
-0
storage/spider/mysql-test/spider/regression/e112122/suite.opt
...age/spider/mysql-test/spider/regression/e112122/suite.opt
+1
-0
storage/spider/mysql-test/spider/regression/e112122/suite.pm
storage/spider/mysql-test/spider/regression/e112122/suite.pm
+12
-0
storage/spider/mysql-test/spider/regression/e112122/t/group_by_order_by_limit_ok.test
...ider/regression/e112122/t/group_by_order_by_limit_ok.test
+97
-0
storage/spider/spd_table.cc
storage/spider/spd_table.cc
+99
-0
storage/spider/spd_table.h
storage/spider/spd_table.h
+14
-1
No files found.
storage/spider/mysql-test/spider/bugfix/include/group_by_order_by_limit_deinit.inc
0 → 100644
View file @
6599cd98
--
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
--
let
$CHILD2_2_DROP_TABLES
=
$CHILD2_2_DROP_TABLES_BACKUP
--
let
$CHILD2_2_CREATE_TABLES
=
$CHILD2_2_CREATE_TABLES_BACKUP
--
let
$CHILD2_2_SELECT_TABLES
=
$CHILD2_2_SELECT_TABLES_BACKUP
--
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/group_by_order_by_limit_init.inc
0 → 100644
View file @
6599cd98
--
disable_warnings
--
disable_query_log
--
disable_result_log
--
source
../
t
/
test_init
.
inc
if
(
!
$HAVE_PARTITION
)
{
--
source
group_by_order_by_limit_deinit
.
inc
--
enable_result_log
--
enable_query_log
--
enable_warnings
skip
Test
requires
partitioning
;
}
--
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"'
PARTITION
BY
KEY
(
pkey
)
(
PARTITION
pt1
COMMENT
=
'srv "s_2_1"'
,
PARTITION
pt2
COMMENT
=
'srv "s_2_2"'
);
--
let
$CHILD2_1_DROP_TABLES_BACKUP
=
$CHILD2_1_DROP_TABLES
let
$CHILD2_1_DROP_TABLES
=
DROP
TABLE
IF
EXISTS
tbl_a
;
--
let
$CHILD2_1_CREATE_TABLES_BACKUP
=
$CHILD2_1_CREATE_TABLES
let
$CHILD2_1_CREATE_TABLES
=
CREATE
TABLE
tbl_a
(
pkey
int
NOT
NULL
,
skey
int
NOT
NULL
,
PRIMARY
KEY
(
pkey
),
KEY
idx1
(
skey
)
)
$CHILD2_1_ENGINE
$CHILD2_1_CHARSET
;
--
let
$CHILD2_1_SELECT_TABLES_BACKUP
=
$CHILD2_1_SELECT_TABLES
let
$CHILD2_1_SELECT_TABLES
=
SELECT
pkey
,
skey
FROM
tbl_a
ORDER
BY
pkey
;
let
$CHILD2_1_SELECT_ARGUMENT1
=
SELECT
argument
FROM
mysql
.
general_log
WHERE
argument
LIKE
'%select %'
;
--
let
$CHILD2_2_DROP_TABLES_BACKUP
=
$CHILD2_2_DROP_TABLES
let
$CHILD2_2_DROP_TABLES
=
DROP
TABLE
IF
EXISTS
tbl_a
;
--
let
$CHILD2_2_CREATE_TABLES_BACKUP
=
$CHILD2_2_CREATE_TABLES
let
$CHILD2_2_CREATE_TABLES
=
CREATE
TABLE
tbl_a
(
pkey
int
NOT
NULL
,
skey
int
NOT
NULL
,
PRIMARY
KEY
(
pkey
),
KEY
idx1
(
skey
)
)
$CHILD2_2_ENGINE
$CHILD2_2_CHARSET
;
--
let
$CHILD2_2_SELECT_TABLES_BACKUP
=
$CHILD2_2_SELECT_TABLES
let
$CHILD2_2_SELECT_TABLES
=
SELECT
pkey
,
skey
FROM
tbl_a
ORDER
BY
pkey
;
let
$CHILD2_2_SELECT_ARGUMENT1
=
SELECT
argument
FROM
mysql
.
general_log
WHERE
argument
LIKE
'%select %'
;
storage/spider/mysql-test/spider/bugfix/r/group_by_order_by_limit.result
0 → 100644
View file @
6599cd98
for master_1
for child2
child2_1
child2_2
child2_3
for child3
this test is for MDEV-16520
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;
connection child2_2;
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = 'TABLE,FILE';
CREATE DATABASE auto_test_remote2;
USE auto_test_remote2;
create table and insert
connection child2_1;
CHILD2_1_CREATE_TABLES
TRUNCATE TABLE mysql.general_log;
connection child2_2;
CHILD2_2_CREATE_TABLES
TRUNCATE TABLE mysql.general_log;
connection master_1;
CREATE TABLE tbl_a (
pkey int NOT NULL,
skey int NOT NULL,
PRIMARY KEY (pkey),
KEY idx1 (skey)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
INSERT INTO tbl_a (pkey,skey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
INSERT INTO tbl_a (pkey,skey) VALUES (10,10),(11,11),(12,12),(13,13),(14,14),(15,15),(16,16),(17,17),(18,18),(19,19);
INSERT INTO tbl_a (pkey,skey) VALUES (20,5),(21,6),(22,7),(23,8),(24,9),(25,10),(26,11),(27,12),(28,13),(29,14);
select test 1
connection child2_1;
TRUNCATE TABLE mysql.general_log;
connection child2_2;
TRUNCATE TABLE mysql.general_log;
connection master_1;
SELECT skey, count(*) cnt FROM tbl_a GROUP BY skey ORDER BY cnt DESC, skey DESC LIMIT 5;
skey cnt
14 2
13 2
12 2
11 2
10 2
connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select count(0),`skey` from `auto_test_remote`.`tbl_a` group by `skey` order by `skey`
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT pkey, skey FROM tbl_a ORDER BY pkey;
pkey skey
1 1
3 3
5 5
7 7
9 9
11 11
13 13
15 15
17 17
19 19
21 6
23 8
25 10
27 12
29 14
connection child2_2;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select count(0),`skey` from `auto_test_remote2`.`tbl_a` group by `skey` order by `skey`
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT pkey, skey FROM tbl_a ORDER BY pkey;
pkey skey
0 0
2 2
4 4
6 6
8 8
10 10
12 12
14 14
16 16
18 18
20 5
22 7
24 9
26 11
28 13
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 child2_2;
DROP DATABASE IF EXISTS auto_test_remote2;
SET GLOBAL log_output = @old_log_output;
for master_1
for child2
child2_1
child2_2
child2_3
for child3
end of test
storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.cnf
0 → 100644
View file @
6599cd98
!include include/default_mysqld.cnf
!include ../my_1_1.cnf
!include ../my_2_1.cnf
!include ../my_2_2.cnf
storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.test
0 → 100644
View file @
6599cd98
--
source
../
include
/
group_by_order_by_limit_init
.
inc
--
echo
--
echo
this
test
is
for
MDEV
-
16520
--
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
;
--
connection
child2_2
SET
@
old_log_output
=
@@
global
.
log_output
;
SET
GLOBAL
log_output
=
'TABLE,FILE'
;
CREATE
DATABASE
auto_test_remote2
;
USE
auto_test_remote2
;
--
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
child2_2
--
disable_query_log
echo
CHILD2_2_CREATE_TABLES
;
eval
$CHILD2_2_CREATE_TABLES
;
--
enable_query_log
TRUNCATE
TABLE
mysql
.
general_log
;
--
connection
master_1
--
disable_query_log
echo
CREATE
TABLE
tbl_a
(
pkey
int
NOT
NULL
,
skey
int
NOT
NULL
,
PRIMARY
KEY
(
pkey
),
KEY
idx1
(
skey
)
)
MASTER_1_ENGINE
MASTER_1_CHARSET
MASTER_1_COMMENT_2_1
;
eval
CREATE
TABLE
tbl_a
(
pkey
int
NOT
NULL
,
skey
int
NOT
NULL
,
PRIMARY
KEY
(
pkey
),
KEY
idx1
(
skey
)
)
$MASTER_1_ENGINE
$MASTER_1_CHARSET
$MASTER_1_COMMENT_2_1
;
--
enable_query_log
INSERT
INTO
tbl_a
(
pkey
,
skey
)
VALUES
(
0
,
0
),(
1
,
1
),(
2
,
2
),(
3
,
3
),(
4
,
4
),(
5
,
5
),(
6
,
6
),(
7
,
7
),(
8
,
8
),(
9
,
9
);
INSERT
INTO
tbl_a
(
pkey
,
skey
)
VALUES
(
10
,
10
),(
11
,
11
),(
12
,
12
),(
13
,
13
),(
14
,
14
),(
15
,
15
),(
16
,
16
),(
17
,
17
),(
18
,
18
),(
19
,
19
);
INSERT
INTO
tbl_a
(
pkey
,
skey
)
VALUES
(
20
,
5
),(
21
,
6
),(
22
,
7
),(
23
,
8
),(
24
,
9
),(
25
,
10
),(
26
,
11
),(
27
,
12
),(
28
,
13
),(
29
,
14
);
--
echo
--
echo
select
test
1
--
connection
child2_1
TRUNCATE
TABLE
mysql
.
general_log
;
--
connection
child2_2
TRUNCATE
TABLE
mysql
.
general_log
;
--
connection
master_1
SELECT
skey
,
count
(
*
)
cnt
FROM
tbl_a
GROUP
BY
skey
ORDER
BY
cnt
DESC
,
skey
DESC
LIMIT
5
;
--
connection
child2_1
eval
$CHILD2_1_SELECT_ARGUMENT1
;
eval
$CHILD2_1_SELECT_TABLES
;
--
connection
child2_2
eval
$CHILD2_2_SELECT_ARGUMENT1
;
eval
$CHILD2_2_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
;
--
connection
child2_2
DROP
DATABASE
IF
EXISTS
auto_test_remote2
;
SET
GLOBAL
log_output
=
@
old_log_output
;
--
enable_warnings
--
source
../
include
/
group_by_order_by_limit_deinit
.
inc
--
echo
--
echo
end
of
test
storage/spider/mysql-test/spider/regression/e112122/include/group_by_order_by_limit_ok_deinit.inc
0 → 100644
View file @
6599cd98
--
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
--
let
$CHILD2_2_DROP_TABLES
=
$CHILD2_2_DROP_TABLES_BACKUP
--
let
$CHILD2_2_CREATE_TABLES
=
$CHILD2_2_CREATE_TABLES_BACKUP
--
let
$CHILD2_2_SELECT_TABLES
=
$CHILD2_2_SELECT_TABLES_BACKUP
--
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/regression/e112122/include/group_by_order_by_limit_ok_init.inc
0 → 100644
View file @
6599cd98
--
disable_warnings
--
disable_query_log
--
disable_result_log
--
source
../../
t
/
test_init
.
inc
if
(
!
$HAVE_PARTITION
)
{
--
source
group_by_order_by_limit_ok_deinit
.
inc
--
enable_result_log
--
enable_query_log
--
enable_warnings
skip
Test
requires
partitioning
;
}
--
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"'
PARTITION
BY
KEY
(
skey
)
(
PARTITION
pt1
COMMENT
=
'srv "s_2_1"'
,
PARTITION
pt2
COMMENT
=
'srv "s_2_2"'
);
--
let
$CHILD2_1_DROP_TABLES_BACKUP
=
$CHILD2_1_DROP_TABLES
let
$CHILD2_1_DROP_TABLES
=
DROP
TABLE
IF
EXISTS
tbl_a
;
--
let
$CHILD2_1_CREATE_TABLES_BACKUP
=
$CHILD2_1_CREATE_TABLES
let
$CHILD2_1_CREATE_TABLES
=
CREATE
TABLE
tbl_a
(
pkey
int
NOT
NULL
,
skey
int
NOT
NULL
,
KEY
idx1
(
pkey
),
KEY
idx2
(
skey
)
)
$CHILD2_1_ENGINE
$CHILD2_1_CHARSET
;
--
let
$CHILD2_1_SELECT_TABLES_BACKUP
=
$CHILD2_1_SELECT_TABLES
let
$CHILD2_1_SELECT_TABLES
=
SELECT
pkey
,
skey
FROM
tbl_a
ORDER
BY
pkey
;
let
$CHILD2_1_SELECT_ARGUMENT1
=
SELECT
argument
FROM
mysql
.
general_log
WHERE
argument
LIKE
'%select %'
;
--
let
$CHILD2_2_DROP_TABLES_BACKUP
=
$CHILD2_2_DROP_TABLES
let
$CHILD2_2_DROP_TABLES
=
DROP
TABLE
IF
EXISTS
tbl_a
;
--
let
$CHILD2_2_CREATE_TABLES_BACKUP
=
$CHILD2_2_CREATE_TABLES
let
$CHILD2_2_CREATE_TABLES
=
CREATE
TABLE
tbl_a
(
pkey
int
NOT
NULL
,
skey
int
NOT
NULL
,
KEY
idx1
(
pkey
),
KEY
idx2
(
skey
)
)
$CHILD2_2_ENGINE
$CHILD2_2_CHARSET
;
--
let
$CHILD2_2_SELECT_TABLES_BACKUP
=
$CHILD2_2_SELECT_TABLES
let
$CHILD2_2_SELECT_TABLES
=
SELECT
pkey
,
skey
FROM
tbl_a
ORDER
BY
pkey
;
let
$CHILD2_2_SELECT_ARGUMENT1
=
SELECT
argument
FROM
mysql
.
general_log
WHERE
argument
LIKE
'%select %'
;
storage/spider/mysql-test/spider/regression/e112122/my.cnf
0 → 100644
View file @
6599cd98
!include include/default_mysqld.cnf
!include my_1_1.cnf
!include my_2_1.cnf
!include my_2_2.cnf
storage/spider/mysql-test/spider/regression/e112122/my_1_1.cnf
0 → 100644
View file @
6599cd98
[mysqld.1.1]
log-bin= master-bin
loose_handlersocket_port= 20000
loose_handlersocket_port_wr= 20001
loose_handlersocket_threads= 2
loose_handlersocket_threads_wr= 1
loose_handlersocket_support_merge_table= 0
loose_handlersocket_direct_update_mode= 2
loose_handlersocket_unlimited_boundary= 65536
loose_handlersocket_bulk_insert= 0
loose_handlersocket_bulk_insert_timeout= 0
loose_handlersocket_general_log= 1
loose_handlersocket_timeout= 30
loose_handlersocket_close_table_interval=2
open_files_limit= 4096
loose_partition= 1
[ENV]
USE_GEOMETRY_TEST= 1
USE_FULLTEXT_TEST= 1
USE_HA_TEST= 1
USE_GENERAL_LOG= 1
USE_REPLICATION= 1
MASTER_1_MYPORT= @mysqld.1.1.port
MASTER_1_HSRPORT= 20000
MASTER_1_HSWPORT= 20001
MASTER_1_MYSOCK= @mysqld.1.1.socket
MASTER_1_ENGINE_TYPE= Spider
#MASTER_1_ENGINE_TYPE= MyISAM
MASTER_1_ENGINE= ENGINE=Spider
MASTER_1_CHARSET= DEFAULT CHARSET=utf8
MASTER_1_ENGINE2= ENGINE=MyISAM
MASTER_1_CHARSET2= DEFAULT CHARSET=utf8
MASTER_1_CHARSET3= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
STR_SEMICOLON= ;
#The followings are set in include/init_xxx.inc files
# MASTER_1_COMMENT_2_1
# MASTER_1_COMMENT2_2_1
# MASTER_1_COMMENT3_2_1
# MASTER_1_COMMENT4_2_1
# MASTER_1_COMMENT5_2_1
# MASTER_1_COMMENT_P_2_1
storage/spider/mysql-test/spider/regression/e112122/my_2_1.cnf
0 → 100644
View file @
6599cd98
[mysqld.2.1]
loose_handlersocket_port= 20002
loose_handlersocket_port_wr= 20003
loose_handlersocket_threads= 2
loose_handlersocket_threads_wr= 1
loose_handlersocket_support_merge_table= 0
loose_handlersocket_direct_update_mode= 2
loose_handlersocket_unlimited_boundary= 65536
loose_handlersocket_bulk_insert= 0
loose_handlersocket_bulk_insert_timeout= 0
loose_handlersocket_general_log= 1
loose_handlersocket_timeout= 30
loose_handlersocket_close_table_interval=2
open_files_limit= 4096
[ENV]
USE_CHILD_GROUP2= 1
OUTPUT_CHILD_GROUP2= 0
CHILD2_1_MYPORT= @mysqld.2.1.port
CHILD2_1_HSRPORT= 20002
CHILD2_1_HSWPORT= 20003
CHILD2_1_MYSOCK= @mysqld.2.1.socket
CHILD2_1_ENGINE_TYPE= InnoDB
CHILD2_1_ENGINE= ENGINE=InnoDB
CHILD2_1_CHARSET= DEFAULT CHARSET=utf8
CHILD2_1_CHARSET2= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
CHILD2_1_FT_MYPORT= @mysqld.2.1.port
CHILD2_1_FT_MYSOCK= @mysqld.2.1.socket
CHILD2_1_FT_ENGINE_TYPE= MyISAM
CHILD2_1_FT_ENGINE= ENGINE=MyISAM
CHILD2_1_FT_CHARSET= DEFAULT CHARSET=utf8
CHILD2_1_GM_MYPORT= @mysqld.2.1.port
CHILD2_1_GM_MYSOCK= @mysqld.2.1.socket
CHILD2_1_GM_ENGINE_TYPE= MyISAM
CHILD2_1_GM_ENGINE= ENGINE=MyISAM
CHILD2_1_GM_CHARSET= DEFAULT CHARSET=utf8
#The followings are set in include/init_xxx.inc files
# CHILD2_1_DROP_TABLES
# CHILD2_1_CREATE_TABLES
# CHILD2_1_SELECT_TABLES
# CHILD2_1_DROP_TABLES2
# CHILD2_1_CREATE_TABLES2
# CHILD2_1_SELECT_TABLES2
# CHILD2_1_DROP_TABLES3
# CHILD2_1_CREATE_TABLES3
# CHILD2_1_SELECT_TABLES3
# CHILD2_1_DROP_TABLES4
# CHILD2_1_CREATE_TABLES4
# CHILD2_1_SELECT_TABLES4
# CHILD2_1_DROP_TABLES5
# CHILD2_1_CREATE_TABLES5
# CHILD2_1_SELECT_TABLES5
# CHILD2_1_DROP_TABLES6
# CHILD2_1_CREATE_TABLES6
# CHILD2_1_SELECT_TABLES6
storage/spider/mysql-test/spider/regression/e112122/my_2_2.cnf
0 → 100644
View file @
6599cd98
[mysqld.2.2]
loose_handlersocket_port= 20004
loose_handlersocket_port_wr= 20005
loose_handlersocket_threads= 2
loose_handlersocket_threads_wr= 1
loose_handlersocket_support_merge_table= 0
loose_handlersocket_direct_update_mode= 2
loose_handlersocket_unlimited_boundary= 65536
loose_handlersocket_bulk_insert= 0
loose_handlersocket_bulk_insert_timeout= 0
loose_handlersocket_general_log= 1
loose_handlersocket_timeout= 30
loose_handlersocket_close_table_interval=2
open_files_limit= 4096
[ENV]
CHILD2_2_MYPORT= @mysqld.2.2.port
CHILD2_2_HSRPORT= 20004
CHILD2_2_HSWPORT= 20005
CHILD2_2_MYSOCK= @mysqld.2.2.socket
CHILD2_2_ENGINE_TYPE= InnoDB
CHILD2_2_ENGINE= ENGINE=InnoDB
CHILD2_2_CHARSET= DEFAULT CHARSET=utf8
CHILD2_2_FT_MYPORT= @mysqld.2.2.port
CHILD2_2_FT_MYSOCK= @mysqld.2.2.socket
CHILD2_2_FT_ENGINE_TYPE= MyISAM
CHILD2_2_FT_ENGINE= ENGINE=MyISAM
CHILD2_2_FT_CHARSET= DEFAULT CHARSET=utf8
CHILD2_2_GM_MYPORT= @mysqld.2.2.port
CHILD2_2_GM_MYSOCK= @mysqld.2.2.socket
CHILD2_2_GM_ENGINE_TYPE= MyISAM
CHILD2_2_GM_ENGINE= ENGINE=MyISAM
CHILD2_2_GM_CHARSET= DEFAULT CHARSET=utf8
#The followings are set in include/init_xxx.inc files
# CHILD2_2_DROP_TABLES
# CHILD2_2_CREATE_TABLES
# CHILD2_2_SELECT_TABLES
storage/spider/mysql-test/spider/regression/e112122/r/group_by_order_by_limit_ok.result
0 → 100644
View file @
6599cd98
for master_1
for child2
child2_1
child2_2
child2_3
for child3
this test is for MDEV-18988
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;
connection child2_2;
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = 'TABLE,FILE';
CREATE DATABASE auto_test_remote2;
USE auto_test_remote2;
create table and insert
connection child2_1;
CHILD2_1_CREATE_TABLES
TRUNCATE TABLE mysql.general_log;
connection child2_2;
CHILD2_2_CREATE_TABLES
TRUNCATE TABLE mysql.general_log;
connection master_1;
CREATE TABLE tbl_a (
pkey int NOT NULL,
skey int NOT NULL,
KEY idx1 (pkey),
KEY idx2 (skey)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
INSERT INTO tbl_a (pkey,skey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
INSERT INTO tbl_a (pkey,skey) VALUES (10,10),(11,11),(12,12),(13,13),(14,14),(15,15),(16,16),(17,17),(18,18),(19,19);
INSERT INTO tbl_a (pkey,skey) VALUES (20,5),(21,6),(22,7),(23,8),(24,9),(25,10),(26,11),(27,12),(28,13),(29,14);
select test 1
connection child2_1;
TRUNCATE TABLE mysql.general_log;
connection child2_2;
TRUNCATE TABLE mysql.general_log;
connection master_1;
SELECT skey, count(*) cnt FROM tbl_a GROUP BY skey ORDER BY cnt DESC, skey DESC LIMIT 5;
skey cnt
14 2
13 2
12 2
11 2
10 2
connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select count(0),`skey` from `auto_test_remote`.`tbl_a` group by `skey` order by count(0) desc,`skey` desc limit 5
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT pkey, skey FROM tbl_a ORDER BY pkey;
pkey skey
1 1
3 3
5 5
7 7
9 9
11 11
13 13
15 15
17 17
19 19
20 5
22 7
24 9
26 11
28 13
connection child2_2;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select count(0),`skey` from `auto_test_remote2`.`tbl_a` group by `skey` order by count(0) desc,`skey` desc limit 5
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT pkey, skey FROM tbl_a ORDER BY pkey;
pkey skey
0 0
2 2
4 4
6 6
8 8
10 10
12 12
14 14
16 16
18 18
21 6
23 8
25 10
27 12
29 14
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 child2_2;
DROP DATABASE IF EXISTS auto_test_remote2;
SET GLOBAL log_output = @old_log_output;
for master_1
for child2
child2_1
child2_2
child2_3
for child3
end of test
storage/spider/mysql-test/spider/regression/e112122/suite.opt
0 → 100644
View file @
6599cd98
--loose-innodb --loose-skip-performance-schema
storage/spider/mysql-test/spider/regression/e112122/suite.pm
0 → 100644
View file @
6599cd98
package
My::Suite::
Spider
;
@ISA
=
qw(My::Suite)
;
return
"
No Spider engine
"
unless
$ENV
{
HA_SPIDER_SO
};
return
"
Not run for embedded server
"
if
$::opt_embedded_server
;
return
"
Test needs --big-test
"
unless
$::opt_big_test
;
sub
is_default
{
1
}
bless
{
};
storage/spider/mysql-test/spider/regression/e112122/t/group_by_order_by_limit_ok.test
0 → 100644
View file @
6599cd98
--
source
../
include
/
group_by_order_by_limit_ok_init
.
inc
--
echo
--
echo
this
test
is
for
MDEV
-
18988
--
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
;
--
connection
child2_2
SET
@
old_log_output
=
@@
global
.
log_output
;
SET
GLOBAL
log_output
=
'TABLE,FILE'
;
CREATE
DATABASE
auto_test_remote2
;
USE
auto_test_remote2
;
--
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
child2_2
--
disable_query_log
echo
CHILD2_2_CREATE_TABLES
;
eval
$CHILD2_2_CREATE_TABLES
;
--
enable_query_log
TRUNCATE
TABLE
mysql
.
general_log
;
--
connection
master_1
--
disable_query_log
echo
CREATE
TABLE
tbl_a
(
pkey
int
NOT
NULL
,
skey
int
NOT
NULL
,
KEY
idx1
(
pkey
),
KEY
idx2
(
skey
)
)
MASTER_1_ENGINE
MASTER_1_CHARSET
MASTER_1_COMMENT_2_1
;
eval
CREATE
TABLE
tbl_a
(
pkey
int
NOT
NULL
,
skey
int
NOT
NULL
,
KEY
idx1
(
pkey
),
KEY
idx2
(
skey
)
)
$MASTER_1_ENGINE
$MASTER_1_CHARSET
$MASTER_1_COMMENT_2_1
;
--
enable_query_log
INSERT
INTO
tbl_a
(
pkey
,
skey
)
VALUES
(
0
,
0
),(
1
,
1
),(
2
,
2
),(
3
,
3
),(
4
,
4
),(
5
,
5
),(
6
,
6
),(
7
,
7
),(
8
,
8
),(
9
,
9
);
INSERT
INTO
tbl_a
(
pkey
,
skey
)
VALUES
(
10
,
10
),(
11
,
11
),(
12
,
12
),(
13
,
13
),(
14
,
14
),(
15
,
15
),(
16
,
16
),(
17
,
17
),(
18
,
18
),(
19
,
19
);
INSERT
INTO
tbl_a
(
pkey
,
skey
)
VALUES
(
20
,
5
),(
21
,
6
),(
22
,
7
),(
23
,
8
),(
24
,
9
),(
25
,
10
),(
26
,
11
),(
27
,
12
),(
28
,
13
),(
29
,
14
);
--
echo
--
echo
select
test
1
--
connection
child2_1
TRUNCATE
TABLE
mysql
.
general_log
;
--
connection
child2_2
TRUNCATE
TABLE
mysql
.
general_log
;
--
connection
master_1
SELECT
skey
,
count
(
*
)
cnt
FROM
tbl_a
GROUP
BY
skey
ORDER
BY
cnt
DESC
,
skey
DESC
LIMIT
5
;
--
connection
child2_1
eval
$CHILD2_1_SELECT_ARGUMENT1
;
eval
$CHILD2_1_SELECT_TABLES
;
--
connection
child2_2
eval
$CHILD2_2_SELECT_ARGUMENT1
;
eval
$CHILD2_2_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
;
--
connection
child2_2
DROP
DATABASE
IF
EXISTS
auto_test_remote2
;
SET
GLOBAL
log_output
=
@
old_log_output
;
--
enable_warnings
--
source
../
include
/
group_by_order_by_limit_ok_deinit
.
inc
--
echo
--
echo
end
of
test
storage/spider/spd_table.cc
View file @
6599cd98
...
...
@@ -8909,6 +8909,13 @@ bool spider_check_direct_order_limit(
break
;
}
}
if
(
!
spider_all_part_in_order
((
ORDER
*
)
select_lex
->
group_list
.
first
,
spider
->
get_table
()))
{
DBUG_PRINT
(
"info"
,(
"spider FALSE by group condition"
));
first_check
=
FALSE
;
spider
->
result_list
.
direct_distinct
=
FALSE
;
}
#endif
}
...
...
@@ -8974,6 +8981,98 @@ bool spider_check_direct_order_limit(
DBUG_RETURN
(
FALSE
);
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
bool
spider_all_part_in_order
(
ORDER
*
order
,
TABLE
*
table
)
{
TABLE_LIST
*
parent
;
partition_info
*
part_info
;
Field
**
part_fields
;
ORDER
*
ptr
;
Item
*
item
;
Item_field
*
item_field
;
DBUG_ENTER
(
"spider_all_part_in_order"
);
while
(
TRUE
)
{
DBUG_PRINT
(
"info"
,
(
"spider table_name = %s"
,
table
->
s
->
db
.
str
));
DBUG_PRINT
(
"info"
,(
"spider part_info=%p"
,
table
->
part_info
));
if
((
part_info
=
table
->
part_info
))
{
for
(
part_fields
=
part_info
->
full_part_field_array
;
*
part_fields
;
++
part_fields
)
{
DBUG_PRINT
(
"info"
,
(
"spider part_field = %s"
,
SPIDER_field_name_str
(
*
part_fields
)));
for
(
ptr
=
order
;
ptr
;
ptr
=
ptr
->
next
)
{
item
=
*
ptr
->
item
;
if
(
item
->
type
()
!=
Item
::
FIELD_ITEM
)
{
continue
;
}
item_field
=
(
Item_field
*
)
item
;
Field
*
field
=
item_field
->
field
;
if
(
!
field
)
{
continue
;
}
DBUG_PRINT
(
"info"
,
(
"spider field_name = %s.%s"
,
field
->
table
->
s
->
db
.
str
,
SPIDER_field_name_str
(
field
)));
if
(
*
part_fields
==
spider_field_exchange
(
table
->
file
,
field
))
{
break
;
}
}
if
(
!
ptr
)
{
DBUG_RETURN
(
FALSE
);
}
}
}
if
(
!
(
parent
=
table
->
pos_in_table_list
->
parent_l
))
{
break
;
}
table
=
parent
->
table
;
}
DBUG_RETURN
(
TRUE
);
}
Field
*
spider_field_exchange
(
handler
*
handler
,
Field
*
field
)
{
DBUG_ENTER
(
"spider_field_exchange"
);
#ifdef HA_CAN_BULK_ACCESS
if
(
handler
->
is_bulk_access_clone
)
{
handler
=
handler
->
pt_clone_source_handler
;
}
#endif
DBUG_PRINT
(
"info"
,(
"spider in field=%p"
,
field
));
DBUG_PRINT
(
"info"
,(
"spider in field->table=%p"
,
field
->
table
));
#ifdef HANDLER_HAS_TOP_TABLE_FIELDS
if
(
handler
->
set_top_table_fields
)
{
DBUG_PRINT
(
"info"
,(
"spider top_table=%p"
,
handler
->
top_table
));
if
(
field
->
table
!=
handler
->
top_table
)
DBUG_RETURN
(
NULL
);
if
(
!
(
field
=
handler
->
top_table_field
[
field
->
field_index
]))
DBUG_RETURN
(
NULL
);
}
else
{
#endif
DBUG_PRINT
(
"info"
,(
"spider table=%p"
,
handler
->
get_table
()));
if
(
field
->
table
!=
handler
->
get_table
())
DBUG_RETURN
(
NULL
);
#ifdef HANDLER_HAS_TOP_TABLE_FIELDS
}
#endif
DBUG_PRINT
(
"info"
,(
"spider out field=%p"
,
field
));
DBUG_RETURN
(
field
);
}
#endif
int
spider_set_direct_limit_offset
(
ha_spider
*
spider
)
{
...
...
storage/spider/spd_table.h
View file @
6599cd98
/* Copyright (C) 2008-2017 Kentoku Shiba
/* Copyright (C) 2008-2019 Kentoku Shiba
Copyright (C) 2019 MariaDB corp
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -638,6 +639,18 @@ bool spider_check_direct_order_limit(
ha_spider
*
spider
);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
bool
spider_all_part_in_order
(
ORDER
*
order
,
TABLE
*
table
);
Field
*
spider_field_exchange
(
handler
*
handler
,
Field
*
field
);
#endif
int
spider_set_direct_limit_offset
(
ha_spider
*
spider
);
...
...
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