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
f32a5115
Commit
f32a5115
authored
Sep 22, 2016
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '10.2' into bb-10.2-connector-c-integ-subm
parents
f7640e11
27263788
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
119 additions
and
90 deletions
+119
-90
mysql-test/r/cte_recursive.result
mysql-test/r/cte_recursive.result
+48
-0
mysql-test/t/cte_recursive.test
mysql-test/t/cte_recursive.test
+38
-0
sql/sql_parse.cc
sql/sql_parse.cc
+4
-2
sql/sql_yacc.yy
sql/sql_yacc.yy
+18
-8
storage/innobase/sync/sync0arr.cc
storage/innobase/sync/sync0arr.cc
+9
-78
storage/innobase/ut/ut0crc32.cc
storage/innobase/ut/ut0crc32.cc
+2
-2
No files found.
mysql-test/r/cte_recursive.result
View file @
f32a5115
...
...
@@ -1556,6 +1556,54 @@ EXPLAIN
}
}
}
create table my_ancestors
with recursive
ancestor_ids (id)
as
(
select father from folks where name = 'Me'
union
select mother from folks where name = 'Me'
union
select father from folks, ancestor_ids a where folks.id = a.id
union
select mother from folks, ancestor_ids a where folks.id = a.id
)
select p.* from folks as p, ancestor_ids as a where p.id = a.id;
select * from my_ancestors;
id name dob father mother
20 Dad 1970-02-02 10 9
30 Mom 1975-03-03 8 7
10 Grandpa Bill 1940-04-05 NULL NULL
9 Grandma Ann 1941-10-15 NULL NULL
7 Grandma Sally 1943-08-23 NULL 6
8 Grandpa Ben 1940-10-21 NULL NULL
6 Grandgrandma Martha 1923-05-17 NULL NULL
delete from my_ancestors;
insert into my_ancestors
with recursive
ancestor_ids (id)
as
(
select father from folks where name = 'Me'
union
select mother from folks where name = 'Me'
union
select father from folks, ancestor_ids a where folks.id = a.id
union
select mother from folks, ancestor_ids a where folks.id = a.id
)
select p.* from folks as p, ancestor_ids as a where p.id = a.id;
select * from my_ancestors;
id name dob father mother
20 Dad 1970-02-02 10 9
30 Mom 1975-03-03 8 7
10 Grandpa Bill 1940-04-05 NULL NULL
9 Grandma Ann 1941-10-15 NULL NULL
7 Grandma Sally 1943-08-23 NULL 6
8 Grandpa Ben 1940-10-21 NULL NULL
6 Grandgrandma Martha 1923-05-17 NULL NULL
drop table my_ancestors;
drop table folks;
#
# MDEV-10372: [bb-10.2-mdev9864 tree] EXPLAIN with recursive CTE enters endless recursion
...
...
mysql-test/t/cte_recursive.test
View file @
f32a5115
...
...
@@ -1162,6 +1162,44 @@ select h_name, h_dob, w_name, w_dob
from
ancestor_couples
;
create
table
my_ancestors
with
recursive
ancestor_ids
(
id
)
as
(
select
father
from
folks
where
name
=
'Me'
union
select
mother
from
folks
where
name
=
'Me'
union
select
father
from
folks
,
ancestor_ids
a
where
folks
.
id
=
a
.
id
union
select
mother
from
folks
,
ancestor_ids
a
where
folks
.
id
=
a
.
id
)
select
p
.*
from
folks
as
p
,
ancestor_ids
as
a
where
p
.
id
=
a
.
id
;
select
*
from
my_ancestors
;
delete
from
my_ancestors
;
insert
into
my_ancestors
with
recursive
ancestor_ids
(
id
)
as
(
select
father
from
folks
where
name
=
'Me'
union
select
mother
from
folks
where
name
=
'Me'
union
select
father
from
folks
,
ancestor_ids
a
where
folks
.
id
=
a
.
id
union
select
mother
from
folks
,
ancestor_ids
a
where
folks
.
id
=
a
.
id
)
select
p
.*
from
folks
as
p
,
ancestor_ids
as
a
where
p
.
id
=
a
.
id
;
select
*
from
my_ancestors
;
drop
table
my_ancestors
;
drop
table
folks
;
--
echo
#
...
...
sql/sql_parse.cc
View file @
f32a5115
...
...
@@ -3781,7 +3781,8 @@ mysql_execute_command(THD *thd)
/* Copy temporarily the statement flags to thd for lock_table_names() */
uint
save_thd_create_info_options
=
thd
->
lex
->
create_info
.
options
;
thd
->
lex
->
create_info
.
options
|=
create_info
.
options
;
res
=
open_and_lock_tables
(
thd
,
create_info
,
lex
->
query_tables
,
TRUE
,
0
);
if
(
!
(
res
=
check_dependencies_in_with_clauses
(
lex
->
with_clauses_list
)))
res
=
open_and_lock_tables
(
thd
,
create_info
,
lex
->
query_tables
,
TRUE
,
0
);
thd
->
lex
->
create_info
.
options
=
save_thd_create_info_options
;
if
(
res
)
{
...
...
@@ -4394,7 +4395,8 @@ mysql_execute_command(THD *thd)
unit
->
set_limit
(
select_lex
);
if
(
!
(
res
=
open_and_lock_tables
(
thd
,
all_tables
,
TRUE
,
0
)))
if
(
!
(
res
=
check_dependencies_in_with_clauses
(
lex
->
with_clauses_list
))
&&
!
(
res
=
open_and_lock_tables
(
thd
,
all_tables
,
TRUE
,
0
)))
{
MYSQL_INSERT_SELECT_START
(
thd
->
query
());
/*
...
...
sql/sql_yacc.yy
View file @
f32a5115
...
...
@@ -4810,16 +4810,22 @@ create_like:
opt_create_select:
/* empty */ {}
| opt_duplicate opt_as create_select_query_expression
_body
| opt_duplicate opt_as create_select_query_expression
;
create_select_query_expression
_body
:
SELECT_SYM create_select_part2 opt_table_expression
create_select_query_expression:
opt_with_clause
SELECT_SYM create_select_part2 opt_table_expression
create_select_part4
{ Select->set_braces(0);}
{
Select->set_braces(0);
Select->set_with_clause($1);
}
union_clause
| SELECT_SYM create_select_part2 create_select_part3_union_not_ready
create_select_part4
| opt_with_clause SELECT_SYM create_select_part2
create_select_part3_union_not_ready create_select_part4
{
Select->set_with_clause($1);
}
| '(' create_select_query_specification ')'
| '(' create_select_query_specification ')'
{ Select->set_braces(1);} union_list {}
...
...
@@ -5519,7 +5525,11 @@ opt_part_option:
*/
create_select_query_specification:
SELECT_SYM create_select_part2 create_select_part3 create_select_part4
SELECT_SYM opt_with_clause create_select_part2 create_select_part3
create_select_part4
{
Select->set_with_clause($2);
}
;
create_select_part2:
...
...
@@ -12308,7 +12318,7 @@ fields:
insert_values:
VALUES values_list {}
| VALUE_SYM values_list {}
| create_select_query_expression
_body
{}
| create_select_query_expression {}
;
values_list:
...
...
storage/innobase/sync/sync0arr.cc
View file @
f32a5115
...
...
@@ -501,9 +501,7 @@ void
sync_array_cell_print
(
/*==================*/
FILE
*
file
,
/*!< in: file where to print */
sync_cell_t
*
cell
,
/*!< in: sync cell */
os_thread_id_t
*
reserver
)
/*!< out: write reserver or
0 */
sync_cell_t
*
cell
)
/*!< in: sync cell */
{
rw_lock_t
*
rwlock
;
ulint
type
;
...
...
@@ -601,7 +599,6 @@ sync_array_cell_print(
writer
==
RW_LOCK_X
?
" exclusive
\n
"
:
writer
==
RW_LOCK_SX
?
" SX
\n
"
:
" wait exclusive
\n
"
);
*
reserver
=
rwlock
->
writer_thread
;
}
fprintf
(
file
,
...
...
@@ -715,7 +712,7 @@ sync_array_report_error(
sync_cell_t
*
cell
)
{
fprintf
(
stderr
,
"rw-lock %p "
,
(
void
*
)
lock
);
sync_array_cell_print
(
stderr
,
cell
,
0
);
sync_array_cell_print
(
stderr
,
cell
);
rw_lock_debug_print
(
stderr
,
debug
);
}
...
...
@@ -788,7 +785,7 @@ sync_array_detect_deadlock(
<<
" file "
<<
name
<<
" line "
<<
policy
.
get_enter_line
();
sync_array_cell_print
(
stderr
,
cell
,
0
);
sync_array_cell_print
(
stderr
,
cell
);
return
(
true
);
}
...
...
@@ -1152,7 +1149,7 @@ sync_array_print_long_waits_low(
if
(
diff
>
SYNC_ARRAY_TIMEOUT
)
{
ib
::
warn
()
<<
"A long semaphore wait:"
;
sync_array_cell_print
(
stderr
,
cell
,
0
);
sync_array_cell_print
(
stderr
,
cell
);
*
noticed
=
TRUE
;
}
...
...
@@ -1167,14 +1164,12 @@ sync_array_print_long_waits_low(
}
}
/* We found a long semaphore wait,
wai
t all threads that are
/* We found a long semaphore wait,
prin
t all threads that are
waiting for a semaphore. */
if
(
*
noticed
)
{
for
(
i
=
0
;
i
<
arr
->
n_cells
;
i
++
)
{
void
*
wait_object
;
os_thread_id_t
reserver
=
(
os_thread_id_t
)
ULINT_UNDEFINED
;
sync_cell_t
*
cell
;
ulint
loop
=
0
;
cell
=
sync_array_get_nth_cell
(
arr
,
i
);
...
...
@@ -1185,41 +1180,8 @@ sync_array_print_long_waits_low(
continue
;
}
fputs
(
"InnoDB: Warning: semaphore wait:
\n
"
,
stderr
);
sync_array_cell_print
(
stderr
,
cell
,
0
);
/* Try to output cell information for writer recursive way */
while
(
reserver
!=
(
os_thread_id_t
)
ULINT_UNDEFINED
)
{
sync_cell_t
*
reserver_wait
;
reserver_wait
=
sync_array_find_thread
(
arr
,
reserver
);
if
(
reserver_wait
&&
reserver_wait
->
latch
.
mutex
!=
NULL
&&
reserver_wait
->
waiting
)
{
fputs
(
"InnoDB: Warning: Writer thread is waiting this semaphore:
\n
"
,
stderr
);
reserver
=
(
os_thread_id_t
)
ULINT_UNDEFINED
;
sync_array_cell_print
(
stderr
,
reserver_wait
,
&
reserver
);
loop
++
;
/* TODO: FIXME:
if (reserver_wait->thread == reserver) {
reserver = (os_thread_id_t)ULINT_UNDEFINED;
}
*/
}
else
{
reserver
=
(
os_thread_id_t
)
ULINT_UNDEFINED
;
}
/* This is protection against loop */
if
(
loop
>
100
)
{
fputs
(
"InnoDB: Warning: Too many waiting threads.
\n
"
,
stderr
);
break
;
}
}
ib
::
info
()
<<
"A semaphore wait:"
;
sync_array_cell_print
(
stderr
,
cell
);
}
}
...
...
@@ -1314,7 +1276,7 @@ sync_array_print_info_low(
if
(
cell
->
latch
.
mutex
!=
0
)
{
count
++
;
sync_array_cell_print
(
file
,
cell
,
0
);
sync_array_cell_print
(
file
,
cell
);
}
}
}
...
...
@@ -1404,8 +1366,6 @@ sync_array_print_innodb(void)
for
(
i
=
0
;
i
<
arr
->
n_cells
;
i
++
)
{
void
*
wait_object
;
sync_cell_t
*
cell
;
os_thread_id_t
reserver
=
(
os_thread_id_t
)
ULINT_UNDEFINED
;
ulint
loop
=
0
;
cell
=
sync_array_get_nth_cell
(
arr
,
i
);
...
...
@@ -1418,36 +1378,7 @@ sync_array_print_innodb(void)
fputs
(
"InnoDB: Warning: semaphore wait:
\n
"
,
stderr
);
sync_array_cell_print
(
stderr
,
cell
,
&
reserver
);
/* Try to output cell information for writer recursive way */
while
(
reserver
!=
(
os_thread_id_t
)
ULINT_UNDEFINED
)
{
sync_cell_t
*
reserver_wait
;
reserver_wait
=
sync_array_find_thread
(
arr
,
reserver
);
if
(
reserver_wait
&&
reserver_wait
->
latch
.
mutex
!=
NULL
&&
reserver_wait
->
waiting
)
{
fputs
(
"InnoDB: Warning: Writer thread is waiting this semaphore:
\n
"
,
stderr
);
sync_array_cell_print
(
stderr
,
reserver_wait
,
&
reserver
);
/* JAN: FIXME:
if (reserver_wait->thread == reserver) {
reserver = (os_thread_id_t)ULINT_UNDEFINED;
}
*/
}
else
{
reserver
=
(
os_thread_id_t
)
ULINT_UNDEFINED
;
}
/* This is protection against loop */
if
(
loop
>
100
)
{
fputs
(
"InnoDB: Warning: Too many waiting threads.
\n
"
,
stderr
);
break
;
}
}
sync_array_cell_print
(
stderr
,
cell
);
}
fputs
(
"InnoDB: Semaphore wait debug output ended:
\n
"
,
stderr
);
...
...
storage/innobase/ut/ut0crc32.cc
View file @
f32a5115
...
...
@@ -447,12 +447,12 @@ static bool ut_crc32_slice8_table_initialized = false;
/********************************************************************//**
Initializes the table that is used to generate the CRC32 if the CPU does
not have support for it. */
#ifndef HAVE_CRC32_VPMSUM
static
void
ut_crc32_slice8_table_init
()
/*========================*/
{
#ifndef HAVE_CRC32_VPMSUM
/* bit-reversed poly 0x1EDC6F41 (from SSE42 crc32 instruction) */
static
const
uint32_t
poly
=
0x82f63b78
;
uint32_t
n
;
...
...
@@ -476,8 +476,8 @@ ut_crc32_slice8_table_init()
}
ut_crc32_slice8_table_initialized
=
true
;
}
#endif
}
/** Calculate CRC32 over 8-bit data using a software implementation.
@param[in,out] crc crc32 checksum so far when this function is called,
...
...
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