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
eb7f46ca
Commit
eb7f46ca
authored
Jun 23, 2022
by
Vladislav Vaintroub
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/10.5' into 10.6
parents
0f0a45b2
35f2cdcb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
14 deletions
+73
-14
mysql-test/main/range.result
mysql-test/main/range.result
+19
-0
mysql-test/main/range.test
mysql-test/main/range.test
+18
-0
mysql-test/main/range_mrr_icp.result
mysql-test/main/range_mrr_icp.result
+19
-0
sql/sql_select.cc
sql/sql_select.cc
+8
-6
tpool/tpool_generic.cc
tpool/tpool_generic.cc
+9
-8
No files found.
mysql-test/main/range.result
View file @
eb7f46ca
...
...
@@ -3635,6 +3635,25 @@ SELECT * FROM t1 LEFT JOIN t2 ON a = pk WHERE b >= 0 AND pk IS NULL;
a pk b
DROP TABLE t1, t2;
SET @@optimizer_switch= @save_optimizer_switch;
# MDEV-28858 Wrong result with table elimination combined with
# not_null_range_scan
#
CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (10,1),(null,2);
CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1),(2);
SET @save_optimizer_switch= @@optimizer_switch;
SET optimizer_switch= 'not_null_range_scan=on';
SELECT t1.b FROM t1 LEFT JOIN t2 ON t1.a = t2.pk WHERE t1.a IS NULL ORDER BY t1.b;
b
2
SET optimizer_switch= 'not_null_range_scan=off';
SELECT t1.b FROM t1 LEFT JOIN t2 ON t1.a = t2.pk WHERE t1.a IS NULL ORDER BY t1.b;
b
2
SET @@optimizer_switch=@save_optimizer_switch;
drop table t1,t2;
#
# End of 10.5 tests
#
...
...
mysql-test/main/range.test
View file @
eb7f46ca
...
...
@@ -2492,6 +2492,24 @@ DROP TABLE t1, t2;
SET
@@
optimizer_switch
=
@
save_optimizer_switch
;
--
echo
--
echo
# MDEV-28858 Wrong result with table elimination combined with
--
echo
# not_null_range_scan
--
echo
#
CREATE
TABLE
t1
(
a
INT
,
b
INT
)
ENGINE
=
MyISAM
;
INSERT
INTO
t1
VALUES
(
10
,
1
),(
null
,
2
);
CREATE
TABLE
t2
(
pk
INT
PRIMARY
KEY
)
ENGINE
=
MyISAM
;
INSERT
INTO
t2
VALUES
(
1
),(
2
);
SET
@
save_optimizer_switch
=
@@
optimizer_switch
;
SET
optimizer_switch
=
'not_null_range_scan=on'
;
SELECT
t1
.
b
FROM
t1
LEFT
JOIN
t2
ON
t1
.
a
=
t2
.
pk
WHERE
t1
.
a
IS
NULL
ORDER
BY
t1
.
b
;
SET
optimizer_switch
=
'not_null_range_scan=off'
;
SELECT
t1
.
b
FROM
t1
LEFT
JOIN
t2
ON
t1
.
a
=
t2
.
pk
WHERE
t1
.
a
IS
NULL
ORDER
BY
t1
.
b
;
SET
@@
optimizer_switch
=@
save_optimizer_switch
;
drop
table
t1
,
t2
;
--
echo
#
--
echo
# End of 10.5 tests
--
echo
#
...
...
mysql-test/main/range_mrr_icp.result
View file @
eb7f46ca
...
...
@@ -3624,6 +3624,25 @@ SELECT * FROM t1 LEFT JOIN t2 ON a = pk WHERE b >= 0 AND pk IS NULL;
a pk b
DROP TABLE t1, t2;
SET @@optimizer_switch= @save_optimizer_switch;
# MDEV-28858 Wrong result with table elimination combined with
# not_null_range_scan
#
CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (10,1),(null,2);
CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1),(2);
SET @save_optimizer_switch= @@optimizer_switch;
SET optimizer_switch= 'not_null_range_scan=on';
SELECT t1.b FROM t1 LEFT JOIN t2 ON t1.a = t2.pk WHERE t1.a IS NULL ORDER BY t1.b;
b
2
SET optimizer_switch= 'not_null_range_scan=off';
SELECT t1.b FROM t1 LEFT JOIN t2 ON t1.a = t2.pk WHERE t1.a IS NULL ORDER BY t1.b;
b
2
SET @@optimizer_switch=@save_optimizer_switch;
drop table t1,t2;
#
# End of 10.5 tests
#
...
...
sql/sql_select.cc
View file @
eb7f46ca
...
...
@@ -29976,11 +29976,12 @@ bool build_notnull_conds_for_range_scans(JOIN *join, Item *cond,
DBUG_ENTER
(
"build_notnull_conds_for_range_scans"
);
for (JOIN_TAB *s= join->join_tab
+ join->const_tables
;
for
(
JOIN_TAB
*
s
=
join
->
join_tab
;
s
<
join
->
join_tab
+
join
->
table_count
;
s
++
)
{
/* Clear all needed bitmaps to mark found fields */
if (allowed & s->table->map)
if
((
allowed
&
s
->
table
->
map
)
&&
!
(
s
->
table
->
map
&&
join
->
const_table_map
))
bitmap_clear_all
(
&
s
->
table
->
tmp_set
);
}
...
...
@@ -29995,17 +29996,18 @@ bool build_notnull_conds_for_range_scans(JOIN *join, Item *cond,
For each table t from 'allowed' build a conjunction of NOT NULL predicates
constructed for all found fields if they are included in some indexes.
If the construction of the conjunction succeeds attach the formula to
t->table->notnull_cond. The condition will be used to look for
complementary
range scans.
t->table->notnull_cond. The condition will be used to look for
complementary
range scans.
*/
for (JOIN_TAB *s= join->join_tab
+ join->const_tables
;
for
(
JOIN_TAB
*
s
=
join
->
join_tab
;
s
<
join
->
join_tab
+
join
->
table_count
;
s
++
)
{
TABLE
*
tab
=
s
->
table
;
List
<
Item
>
notnull_list
;
Item
*
notnull_cond
=
0
;
if (!(allowed & tab->map))
if
(
!
(
allowed
&
tab
->
map
)
||
(
s
->
table
->
map
&&
join
->
const_table_map
))
continue
;
for
(
Field
**
field_ptr
=
tab
->
field
;
*
field_ptr
;
field_ptr
++
)
...
...
tpool/tpool_generic.cc
View file @
eb7f46ca
...
...
@@ -327,21 +327,22 @@ class thread_pool_generic : public thread_pool
int
m_period
;
std
::
mutex
m_mtx
;
bool
m_on
;
std
::
atomic
<
bool
>
m_running
;
std
::
atomic
<
int
>
m_running
;
void
run
()
{
/*
In rare cases, multiple callbacks can be scheduled,
e.g with set_time(0,0) in a loop.
We do not allow parallel execution,
as user is not prepared
.
at the same time,.
e.g with set_time(0,0) in a loop.
We do not allow parallel execution,
since it is against the expectations
.
*/
bool
expected
=
false
;
if
(
!
m_running
.
compare_exchange_strong
(
expected
,
true
))
if
(
m_running
.
fetch_add
(
1
,
std
::
memory_order_acquire
)
>
0
)
return
;
m_callback
(
m_data
);
m_running
=
false
;
do
{
m_callback
(
m_data
);
}
while
(
m_running
.
fetch_sub
(
1
,
std
::
memory_order_release
)
!=
1
);
if
(
m_pool
&&
m_period
)
{
...
...
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