Skip to content

Commit

Permalink
Merge branch '10.2' into 10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Dec 6, 2021
2 parents 045f5f7 + 71027ec commit 153b75b
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 8 deletions.
3 changes: 2 additions & 1 deletion cmake/Internal/CPack/CPackRPM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ macro(restore WHAT)
endmacro()

foreach (WHAT SUMMARY DESCRIPTION)
if(NOT CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${WHAT})
if(CPACK_RPM_PACKAGE_COMPONENT AND
NOT CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${WHAT})
message(FATAL_ERROR "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${WHAT} is not defined")
endif()
endforeach()
Expand Down
24 changes: 24 additions & 0 deletions mysql-test/main/range.result
Original file line number Diff line number Diff line change
Expand Up @@ -3180,5 +3180,29 @@ pk i v a b
2 2 4 2 4
drop table t1, t2;
#
# MDEV-26553: Always FALSE/NULL disjunct on top level of WHERE is removed
#
create table t1 (a int, b int, index idx(a,b));
insert into t1 values (1,1), (1,2), (2,1), (2,2), (3,3);
create table t2 (c int);
insert into t2 values (5), (2), (3), (4);
select 1 from t1 s1
where 1 not in (select 1 from t1
where ((a = 1 or a = 2) and b = 1) or (b > 5 and b < 1));
1
select 1 from t1 s1
where 1 not in (select 1 from t1
where ((a = 1 or a = 2) and b = 1) or b = NULL);
1
select c from t2
where 2 not in (select 1 from t1
where ((a=1 or a=2) and b = 1) or (b > 5 and b < 1));
c
5
2
3
4
drop table t1,t2;
#
# End of 10.2 tests
#
24 changes: 24 additions & 0 deletions mysql-test/main/range.test
Original file line number Diff line number Diff line change
Expand Up @@ -2203,6 +2203,30 @@ select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk);
select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk);
drop table t1, t2;

--echo #
--echo # MDEV-26553: Always FALSE/NULL disjunct on top level of WHERE is removed
--echo #

create table t1 (a int, b int, index idx(a,b));
insert into t1 values (1,1), (1,2), (2,1), (2,2), (3,3);

create table t2 (c int);
insert into t2 values (5), (2), (3), (4);

select 1 from t1 s1
where 1 not in (select 1 from t1
where ((a = 1 or a = 2) and b = 1) or (b > 5 and b < 1));

select 1 from t1 s1
where 1 not in (select 1 from t1
where ((a = 1 or a = 2) and b = 1) or b = NULL);

select c from t2
where 2 not in (select 1 from t1
where ((a=1 or a=2) and b = 1) or (b > 5 and b < 1));

drop table t1,t2;

--echo #
--echo # End of 10.2 tests
--echo #
24 changes: 24 additions & 0 deletions mysql-test/main/range_mrr_icp.result
Original file line number Diff line number Diff line change
Expand Up @@ -3192,6 +3192,30 @@ pk i v a b
2 2 4 2 4
drop table t1, t2;
#
# MDEV-26553: Always FALSE/NULL disjunct on top level of WHERE is removed
#
create table t1 (a int, b int, index idx(a,b));
insert into t1 values (1,1), (1,2), (2,1), (2,2), (3,3);
create table t2 (c int);
insert into t2 values (5), (2), (3), (4);
select 1 from t1 s1
where 1 not in (select 1 from t1
where ((a = 1 or a = 2) and b = 1) or (b > 5 and b < 1));
1
select 1 from t1 s1
where 1 not in (select 1 from t1
where ((a = 1 or a = 2) and b = 1) or b = NULL);
1
select c from t2
where 2 not in (select 1 from t1
where ((a=1 or a=2) and b = 1) or (b > 5 and b < 1));
c
5
2
3
4
drop table t1,t2;
#
# End of 10.2 tests
#
set optimizer_switch=@mrr_icp_extra_tmp;
2 changes: 1 addition & 1 deletion mysql-test/mysql-test-run.pl
Original file line number Diff line number Diff line change
Expand Up @@ -5156,7 +5156,7 @@ ($$)
$mysqld->{'started_opts'}= $extra_opts;

my $expect_file= "$opt_vardir/tmp/".$mysqld->name().".expect";
return $oldexe eq $exe ||
return $oldexe eq ($exe || '') ||
sleep_until_file_created($mysqld->value('pid-file'), $expect_file,
$opt_start_timeout, $mysqld->{'proc'}, $warn_seconds);
}
Expand Down
5 changes: 3 additions & 2 deletions mysys/lf_alloc-pin.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,9 @@ static int ptr_cmp(void **a, void **b)
#define add_to_purgatory(PINS, ADDR) \
do \
{ \
*(void **)((char *)(ADDR)+(PINS)->pinbox->free_ptr_offset)= \
(PINS)->purgatory; \
my_atomic_storeptr_explicit( \
(void **)((char *)(ADDR)+(PINS)->pinbox->free_ptr_offset), \
(PINS)->purgatory, MY_MEMORY_ORDER_RELEASE); \
(PINS)->purgatory= (ADDR); \
(PINS)->purgatory_count++; \
} while (0)
Expand Down
9 changes: 6 additions & 3 deletions mysys/lf_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,16 @@ static int l_find(LF_SLIST **head, CHARSET_INFO *cs, uint32 hashnr,

cur_hashnr= cursor->curr->hashnr;
cur_keylen= cursor->curr->keylen;
cur_key= cursor->curr->key;
cur_key= my_atomic_loadptr_explicit((void **) &cursor->curr->key,
MY_MEMORY_ORDER_ACQUIRE);

do {
link= cursor->curr->link;
link= (intptr) my_atomic_loadptr_explicit((void **) &cursor->curr->link,
MY_MEMORY_ORDER_RELAXED);
cursor->next= PTR(link);
lf_pin(pins, 0, cursor->next);
} while (link != cursor->curr->link && LF_BACKOFF());
} while (link != (intptr) my_atomic_loadptr((void **) &cursor->curr->link)
&& LF_BACKOFF());

if (!DELETED(link))
{
Expand Down
7 changes: 7 additions & 0 deletions sql/sql_select.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5070,6 +5070,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
if (!s->const_keys.is_clear_all())
{
sargable_cond= get_sargable_cond(join, s->table);
bool is_sargable_cond_of_where= sargable_cond == &join->conds;

select= make_select(s->table, found_const_table_map,
found_const_table_map,
Expand All @@ -5087,6 +5088,12 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
*/
*sargable_cond= select->cond;

if (is_sargable_cond_of_where &&
join->conds && join->conds->type() == Item::COND_ITEM &&
((Item_cond*) (join->conds))->functype() ==
Item_func::COND_AND_FUNC)
join->cond_equal= &((Item_cond_and*) (join->conds))->m_cond_equal;

s->quick=select->quick;
s->needed_reg=select->needed_reg;
select->quick=0;
Expand Down
2 changes: 1 addition & 1 deletion unittest/mysys/thr_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ int main(int argc __attribute__((unused)), char **argv)

pthread_mutex_init(&mutex, 0);

#define CYCLES 3000
#define CYCLES 30000
#define THREADS 30

diag("N CPUs: %d", my_getncpus());
Expand Down

0 comments on commit 153b75b

Please sign in to comment.