Merge 10.4 into 10.5

This commit is contained in:
Marko Mäkelä 2022-06-09 12:22:55 +03:00
commit a9d0bb12e6
23 changed files with 200 additions and 108 deletions

View File

@ -1994,11 +1994,10 @@ static void DBUGOpenFile(CODE_STATE *cs,
static void DBUGCloseFile(CODE_STATE *cs, sFILE *new_value) static void DBUGCloseFile(CODE_STATE *cs, sFILE *new_value)
{ {
sFILE *fp; sFILE *fp;
if (!cs || !cs->stack || !cs->stack->out_file) if (!cs || !cs->stack || !(fp= cs->stack->out_file))
return; return;
fp= cs->stack->out_file; if (fp != sstdout && fp != sstderr && --fp->used == 0)
if (--fp->used == 0)
{ {
if (fclose(fp->file) == EOF) if (fclose(fp->file) == EOF)
{ {

View File

@ -274,12 +274,16 @@ delete from mysql.help_relation where help_keyword_id=@keyword1_id and help_topi
delete from mysql.help_relation where help_keyword_id=@keyword2_id and help_topic_id=@topic1_id; delete from mysql.help_relation where help_keyword_id=@keyword2_id and help_topic_id=@topic1_id;
delete from mysql.help_relation where help_keyword_id=@keyword3_id and help_topic_id=@topic3_id; delete from mysql.help_relation where help_keyword_id=@keyword3_id and help_topic_id=@topic3_id;
delete from mysql.help_relation where help_keyword_id=@keyword3_id and help_topic_id=@topic4_id; delete from mysql.help_relation where help_keyword_id=@keyword3_id and help_topic_id=@topic4_id;
End of 4.1 tests. flush tables;
DROP TABLE IF EXISTS t1; #
# End of 4.1 tests.
#
CREATE TABLE t1 (i INT); CREATE TABLE t1 (i INT);
LOCK TABLES t1 WRITE; LOCK TABLES t1 WRITE;
HELP no_such_topic; HELP no_such_topic;
name is_it_category name is_it_category
UNLOCK TABLES; UNLOCK TABLES;
DROP TABLE t1; DROP TABLE t1;
End of 5.1 tests. #
# End of 5.1 tests.
#

View File

@ -122,25 +122,22 @@ delete from mysql.help_relation where help_keyword_id=@keyword2_id and help_topi
delete from mysql.help_relation where help_keyword_id=@keyword3_id and help_topic_id=@topic3_id; delete from mysql.help_relation where help_keyword_id=@keyword3_id and help_topic_id=@topic3_id;
delete from mysql.help_relation where help_keyword_id=@keyword3_id and help_topic_id=@topic4_id; delete from mysql.help_relation where help_keyword_id=@keyword3_id and help_topic_id=@topic4_id;
--echo End of 4.1 tests. flush tables;
--echo #
--echo # End of 4.1 tests.
--echo #
# #
# Test that we can use HELP even under LOCK TABLES. See bug#9953: # Test that we can use HELP even under LOCK TABLES. See bug#9953:
# CONVERT_TZ requires mysql.time_zone_name to be locked. # CONVERT_TZ requires mysql.time_zone_name to be locked.
# #
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (i INT); CREATE TABLE t1 (i INT);
LOCK TABLES t1 WRITE; LOCK TABLES t1 WRITE;
HELP no_such_topic; HELP no_such_topic;
UNLOCK TABLES; UNLOCK TABLES;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo End of 5.1 tests. --echo # End of 5.1 tests.
--echo #

View File

@ -5423,6 +5423,11 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"rows_for_plan": 729, "rows_for_plan": 729,
"cost_for_plan": 451.8615234, "cost_for_plan": 451.8615234,
"semijoin_strategy_choice": [ "semijoin_strategy_choice": [
{
"strategy": "FirstMatch",
"records": 27,
"read_time": 665.225293
},
{ {
"strategy": "DuplicateWeedout", "strategy": "DuplicateWeedout",
"records": 27, "records": 27,
@ -5599,16 +5604,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}, },
"rows_for_plan": 2187, "rows_for_plan": 2187,
"cost_for_plan": 611.8461426, "cost_for_plan": 611.8461426,
"semijoin_strategy_choice": [ "semijoin_strategy_choice": [],
{
"strategy": "FirstMatch",
"records": 81,
"read_time": 2232.809033
},
{
"chosen_strategy": "FirstMatch"
}
],
"pruned_by_cost": true "pruned_by_cost": true
}, },
{ {

View File

@ -2178,10 +2178,10 @@ INSERT INTO t5 VALUES (7,0),(9,0);
explain explain
SELECT * FROM t3 WHERE t3.a IN (SELECT t5.a FROM t2, t4, t5 WHERE t2.c = t5.a AND t2.b = t5.b); SELECT * FROM t3 WHERE t3.a IN (SELECT t5.a FROM t2, t4, t5 WHERE t2.c = t5.a AND t2.b = t5.b);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t5 index a a 10 NULL 2 Using index; Start temporary 1 PRIMARY t5 index a a 10 NULL 2 Using where; Using index; LooseScan
1 PRIMARY t4 ALL NULL NULL NULL NULL 3 1 PRIMARY t4 ALL NULL NULL NULL NULL 3
1 PRIMARY t2 ALL b NULL NULL NULL 10 Using where 1 PRIMARY t2 ref b b 5 test.t5.b 2 Using where; FirstMatch(t5)
1 PRIMARY t3 ALL NULL NULL NULL NULL 15 Using where; End temporary; Using join buffer (flat, BNL join) 1 PRIMARY t3 ALL NULL NULL NULL NULL 15 Using where; Using join buffer (flat, BNL join)
SELECT * FROM t3 WHERE t3.a IN (SELECT t5.a FROM t2, t4, t5 WHERE t2.c = t5.a AND t2.b = t5.b); SELECT * FROM t3 WHERE t3.a IN (SELECT t5.a FROM t2, t4, t5 WHERE t2.c = t5.a AND t2.b = t5.b);
a a
0 0

View File

@ -2189,10 +2189,10 @@ INSERT INTO t5 VALUES (7,0),(9,0);
explain explain
SELECT * FROM t3 WHERE t3.a IN (SELECT t5.a FROM t2, t4, t5 WHERE t2.c = t5.a AND t2.b = t5.b); SELECT * FROM t3 WHERE t3.a IN (SELECT t5.a FROM t2, t4, t5 WHERE t2.c = t5.a AND t2.b = t5.b);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t5 index a a 10 NULL 2 Using index; Start temporary 1 PRIMARY t5 index a a 10 NULL 2 Using where; Using index; LooseScan
1 PRIMARY t4 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) 1 PRIMARY t4 ALL NULL NULL NULL NULL 3
1 PRIMARY t2 ALL b NULL NULL NULL 10 Using where; Using join buffer (incremental, BNL join) 1 PRIMARY t2 ref b b 5 test.t5.b 2 Using where; FirstMatch(t5)
1 PRIMARY t3 ALL NULL NULL NULL NULL 15 Using where; End temporary; Using join buffer (incremental, BNL join) 1 PRIMARY t3 ALL NULL NULL NULL NULL 15 Using where; Using join buffer (flat, BNL join)
SELECT * FROM t3 WHERE t3.a IN (SELECT t5.a FROM t2, t4, t5 WHERE t2.c = t5.a AND t2.b = t5.b); SELECT * FROM t3 WHERE t3.a IN (SELECT t5.a FROM t2, t4, t5 WHERE t2.c = t5.a AND t2.b = t5.b);
a a
0 0

View File

@ -0,0 +1 @@
--innodb-checksum-algorithm=crc32

View File

@ -3,7 +3,7 @@
# #
# restart # restart
FOUND 1 /InnoDB: New log file created, LSN=175964\d{8}/ in mysqld.1.err FOUND 1 /InnoDB: New log file created, LSN=175964\d{8}/ in mysqld.1.err
CREATE TABLE t(i INT) ENGINE INNODB; CREATE TABLE t(i INT) ENGINE=INNODB ENCRYPTED=YES;
INSERT INTO t VALUES(1); INSERT INTO t VALUES(1);
# xtrabackup backup # xtrabackup backup
SET GLOBAL innodb_flush_log_at_trx_commit=1; SET GLOBAL innodb_flush_log_at_trx_commit=1;
@ -16,6 +16,14 @@ INSERT INTO t VALUES(2);
SELECT * FROM t; SELECT * FROM t;
i i
1 1
FLUSH TABLE t FOR EXPORT;
UNLOCK TABLES;
ALTER TABLE t DISCARD TABLESPACE;
ALTER TABLE t IMPORT TABLESPACE;
FLUSH TABLE t FOR EXPORT;
UNLOCK TABLES;
ALTER TABLE t DISCARD TABLESPACE;
ALTER TABLE t IMPORT TABLESPACE;
DROP TABLE t; DROP TABLE t;
# shutdown server # shutdown server
# remove datadir # remove datadir

View File

@ -42,7 +42,7 @@ let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
--let SEARCH_PATTERN= InnoDB: New log file created, LSN=175964\d{8} --let SEARCH_PATTERN= InnoDB: New log file created, LSN=175964\d{8}
--source include/search_pattern_in_file.inc --source include/search_pattern_in_file.inc
CREATE TABLE t(i INT) ENGINE INNODB; CREATE TABLE t(i INT) ENGINE=INNODB ENCRYPTED=YES;
INSERT INTO t VALUES(1); INSERT INTO t VALUES(1);
echo # xtrabackup backup; echo # xtrabackup backup;
@ -58,6 +58,22 @@ exec $XTRABACKUP --prepare --target-dir=$targetdir;
--source include/restart_and_restore.inc --source include/restart_and_restore.inc
--enable_result_log --enable_result_log
SELECT * FROM t; SELECT * FROM t;
FLUSH TABLE t FOR EXPORT;
copy_file $_datadir/test/t.ibd $_datadir/test/t_copy.ibd;
copy_file $_datadir/test/t.cfg $_datadir/test/t_copy.cfg;
UNLOCK TABLES;
ALTER TABLE t DISCARD TABLESPACE;
move_file $_datadir/test/t_copy.ibd $_datadir/test/t.ibd;
move_file $_datadir/test/t_copy.cfg $_datadir/test/t.cfg;
ALTER TABLE t IMPORT TABLESPACE;
FLUSH TABLE t FOR EXPORT;
copy_file $_datadir/test/t.ibd $_datadir/test/t_copy.ibd;
copy_file $_datadir/test/t.cfg $_datadir/test/t_copy.cfg;
UNLOCK TABLES;
ALTER TABLE t DISCARD TABLESPACE;
move_file $_datadir/test/t_copy.ibd $_datadir/test/t.ibd;
move_file $_datadir/test/t_copy.cfg $_datadir/test/t.cfg;
ALTER TABLE t IMPORT TABLESPACE;
DROP TABLE t; DROP TABLE t;
rmdir $targetdir; rmdir $targetdir;
let $targetdir= $targetdir_old; let $targetdir= $targetdir_old;

View File

@ -842,7 +842,7 @@ EOF
fi fi
if [ $WSREP_SST_OPT_BYPASS -eq 0 ]; then if [ $WSREP_SST_OPT_BYPASS -eq 0 ]; then
if grep -m1 -qE "^$BYPASS_TAG([[space]]+.*)?\$" -- "$MAGIC_FILE"; then if grep -m1 -qE "^$BYPASS_TAG([[:space:]]+.*)?\$" -- "$MAGIC_FILE"; then
readonly WSREP_SST_OPT_BYPASS=1 readonly WSREP_SST_OPT_BYPASS=1
readonly WSREP_TRANSFER_TYPE='IST' readonly WSREP_TRANSFER_TYPE='IST'
fi fi

View File

@ -180,7 +180,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- optimize_semijoin_nests() does pre-optimization - optimize_semijoin_nests() does pre-optimization
- during join optimization, the join has one JOIN_TAB (or is it POSITION?) - during join optimization, the join has one JOIN_TAB (or is it POSITION?)
array, and suffix-based detection is used, see advance_sj_state() array, and suffix-based detection is used, see optimize_semi_joins()
- after join optimization is done, get_best_combination() switches - after join optimization is done, get_best_combination() switches
the data-structure to prefix-based, multiple JOIN_TAB ranges format. the data-structure to prefix-based, multiple JOIN_TAB ranges format.
@ -2749,7 +2749,7 @@ bool find_eq_ref_candidate(TABLE *table, table_map sj_inner_tables)
Do semi-join optimization step after we've added a new tab to join prefix Do semi-join optimization step after we've added a new tab to join prefix
SYNOPSIS SYNOPSIS
advance_sj_state() optimize_semi_joins()
join The join we're optimizing join The join we're optimizing
remaining_tables Tables not in the join prefix remaining_tables Tables not in the join prefix
new_join_tab Join tab we've just added to the join prefix new_join_tab Join tab we've just added to the join prefix
@ -2809,9 +2809,9 @@ bool is_multiple_semi_joins(JOIN *join, POSITION *prefix, uint idx, table_map in
} }
void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx, void optimize_semi_joins(JOIN *join, table_map remaining_tables, uint idx,
double *current_record_count, double *current_read_time, double *current_record_count,
POSITION *loose_scan_pos) double *current_read_time, POSITION *loose_scan_pos)
{ {
POSITION *pos= join->positions + idx; POSITION *pos= join->positions + idx;
const JOIN_TAB *new_join_tab= pos->table; const JOIN_TAB *new_join_tab= pos->table;
@ -3002,19 +3002,36 @@ void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx,
} }
} }
if ((emb_sj_nest= new_join_tab->emb_sj_nest)) update_sj_state(join, new_join_tab, idx, remaining_tables);
pos->prefix_cost.convert_from_cost(*current_read_time);
pos->prefix_record_count= *current_record_count;
pos->dups_producing_tables= dups_producing_tables;
}
/*
Update JOIN's semi-join optimization state after the join tab new_tab
has been added into the join prefix.
@seealso restore_prev_sj_state() does the reverse actoion
*/
void update_sj_state(JOIN *join, const JOIN_TAB *new_tab,
uint idx, table_map remaining_tables)
{
if (TABLE_LIST *emb_sj_nest= new_tab->emb_sj_nest)
{ {
join->cur_sj_inner_tables |= emb_sj_nest->sj_inner_tables; join->cur_sj_inner_tables |= emb_sj_nest->sj_inner_tables;
/* Remove the sj_nest if all of its SJ-inner tables are in cur_table_map */ /* Remove the sj_nest if all of its SJ-inner tables are in cur_table_map */
if (!(remaining_tables & if (!(remaining_tables &
emb_sj_nest->sj_inner_tables & ~new_join_tab->table->map)) emb_sj_nest->sj_inner_tables & ~new_tab->table->map))
join->cur_sj_inner_tables &= ~emb_sj_nest->sj_inner_tables; join->cur_sj_inner_tables &= ~emb_sj_nest->sj_inner_tables;
} }
#ifndef DBUG_OFF
pos->prefix_cost.convert_from_cost(*current_read_time); join->dbug_verify_sj_inner_tables(idx + 1);
pos->prefix_record_count= *current_record_count; #endif
pos->dups_producing_tables= dups_producing_tables;
} }
@ -3567,10 +3584,45 @@ bool Duplicate_weedout_picker::check_qep(JOIN *join,
return FALSE; return FALSE;
} }
#ifndef DBUG_OFF
/*
Verify the value of JOIN::cur_sj_inner_tables by recomputing it
*/
void JOIN::dbug_verify_sj_inner_tables(uint prefix_size) const
{
table_map cur_map= const_table_map;
table_map nests_entered= 0;
if (emb_sjm_nest)
{
DBUG_ASSERT(cur_sj_inner_tables == 0);
return;
}
for (uint i= const_tables; i < prefix_size; i++)
{
JOIN_TAB *tab= positions[i].table;
cur_map |= tab->table->map;
if (TABLE_LIST *sj_nest= tab->emb_sj_nest)
{
nests_entered |= sj_nest->sj_inner_tables;
if (!(sj_nest->sj_inner_tables & ~cur_map))
{
// all nest tables are in the prefix already
nests_entered &= ~sj_nest->sj_inner_tables;
}
}
}
DBUG_ASSERT(nests_entered == cur_sj_inner_tables);
}
#endif
/* /*
Remove the last join tab from from join->cur_sj_inner_tables bitmap Remove the last join tab from from join->cur_sj_inner_tables bitmap
we assume remaining_tables doesnt contain @tab.
@note
remaining_tables contains @tab.
@seealso update_sj_state() does the reverse
*/ */
void restore_prev_sj_state(const table_map remaining_tables, void restore_prev_sj_state(const table_map remaining_tables,
@ -3584,15 +3636,30 @@ void restore_prev_sj_state(const table_map remaining_tables,
tab->join->sjm_lookup_tables &= ~subq_tables; tab->join->sjm_lookup_tables &= ~subq_tables;
} }
if ((emb_sj_nest= tab->emb_sj_nest)) if (!tab->join->emb_sjm_nest && (emb_sj_nest= tab->emb_sj_nest))
{ {
table_map subq_tables= emb_sj_nest->sj_inner_tables &
~tab->join->const_table_map;
/* If we're removing the last SJ-inner table, remove the sj-nest */ /* If we're removing the last SJ-inner table, remove the sj-nest */
if ((remaining_tables & emb_sj_nest->sj_inner_tables) == if ((remaining_tables & subq_tables) == subq_tables)
(emb_sj_nest->sj_inner_tables & ~tab->table->map))
{ {
// All non-const tables of the SJ nest are in the remaining_tables.
// we are not in the nest anymore.
tab->join->cur_sj_inner_tables &= ~emb_sj_nest->sj_inner_tables; tab->join->cur_sj_inner_tables &= ~emb_sj_nest->sj_inner_tables;
} }
else
{
// Semi-join nest has:
// - a table being removed (not in the prefix)
// - some tables in the prefix.
tab->join->cur_sj_inner_tables |= emb_sj_nest->sj_inner_tables;
}
} }
#ifndef DBUG_OFF
/* positions[idx] has been removed. Verify the state for [0...idx-1] */
tab->join->dbug_verify_sj_inner_tables(idx);
#endif
} }
@ -3819,8 +3886,8 @@ void fix_semijoin_strategies_for_picked_join_order(JOIN *join)
join->best_positions[first].sj_strategy= SJ_OPT_MATERIALIZE_SCAN; join->best_positions[first].sj_strategy= SJ_OPT_MATERIALIZE_SCAN;
join->best_positions[first].n_sj_tables= sjm->tables; join->best_positions[first].n_sj_tables= sjm->tables;
/* /*
Do what advance_sj_state did: re-run best_access_path for every table Do what optimize_semi_joins did: re-run best_access_path for every
in the [last_inner_table + 1; pos..) range table in the [last_inner_table + 1; pos..) range
*/ */
double prefix_rec_count; double prefix_rec_count;
/* Get the prefix record count */ /* Get the prefix record count */
@ -5074,7 +5141,7 @@ int setup_semijoin_loosescan(JOIN *join)
The choice between the strategies is made by the join optimizer (see The choice between the strategies is made by the join optimizer (see
advance_sj_state() and fix_semijoin_strategies_for_picked_join_order()). optimize_semi_joins() and fix_semijoin_strategies_for_picked_join_order()).
This function sets up all fields/structures/etc needed for execution except This function sets up all fields/structures/etc needed for execution except
for setup/initialization of semi-join materialization which is done in for setup/initialization of semi-join materialization which is done in
setup_sj_materialization() (todo: can't we move that to here also?) setup_sj_materialization() (todo: can't we move that to here also?)

View File

@ -314,9 +314,11 @@ public:
}; };
void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx, void optimize_semi_joins(JOIN *join, table_map remaining_tables, uint idx,
double *current_record_count, double *current_read_time, double *current_record_count,
POSITION *loose_scan_pos); double *current_read_time, POSITION *loose_scan_pos);
void update_sj_state(JOIN *join, const JOIN_TAB *new_tab,
uint idx, table_map remaining_tables);
void restore_prev_sj_state(const table_map remaining_tables, void restore_prev_sj_state(const table_map remaining_tables,
const JOIN_TAB *tab, uint idx); const JOIN_TAB *tab, uint idx);

View File

@ -8680,7 +8680,7 @@ ER_JSON_ESCAPING
eng "Incorrect escaping in JSON text in argument %d to function '%s' at position %d" eng "Incorrect escaping in JSON text in argument %d to function '%s' at position %d"
ER_JSON_DEPTH ER_JSON_DEPTH
chi "超过JSON嵌套深度的%d限制 参数%d 函数'%s' 位置%d的" chi "超过JSON嵌套深度的%d限制 参数%d 函数'%s' 位置%d的"
eng "Limit of %d on JSON nested strucures depth is reached in argument %d to function '%s' at position %d" eng "Limit of %d on JSON nested structures depth is reached in argument %d to function '%s' at position %d"
ER_JSON_PATH_EOS ER_JSON_PATH_EOS
chi "JSON文本路径错误 参数%d 函数'%s'" chi "JSON文本路径错误 参数%d 函数'%s'"
eng "Unexpected end of JSON path in argument %d to function '%s'" eng "Unexpected end of JSON path in argument %d to function '%s'"

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. /* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2020, MariaDB Corporation. Copyright (c) 2009, 2022, MariaDB Corporation
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -6677,8 +6677,8 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
can be satisfied only with the strict mode that ensures can be satisfied only with the strict mode that ensures
against "genuine" gtid duplicates. against "genuine" gtid duplicates.
*/ */
rpl_gtid *gtid_in_slave_state= IF_DBUG(rpl_gtid *gtid_in_slave_state=
mi->gtid_current_pos.find(mi->last_queued_gtid.domain_id); mi->gtid_current_pos.find(mi->last_queued_gtid.domain_id),);
// Slave gtid state must not have updated yet to the last received gtid. // Slave gtid state must not have updated yet to the last received gtid.
DBUG_ASSERT((mi->using_gtid == Master_info::USE_GTID_NO || DBUG_ASSERT((mi->using_gtid == Master_info::USE_GTID_NO ||

View File

@ -8439,6 +8439,10 @@ choose_plan(JOIN *join, table_map join_tables)
{ {
choose_initial_table_order(join); choose_initial_table_order(join);
} }
/*
Note: constant tables are already in the join prefix. We don't
put them into the cur_sj_inner_tables, though.
*/
join->cur_sj_inner_tables= 0; join->cur_sj_inner_tables= 0;
if (straight_join) if (straight_join)
@ -8752,8 +8756,8 @@ optimize_straight_join(JOIN *join, table_map join_tables)
read_time+= COST_ADD(read_time - filter_cmp_gain, read_time+= COST_ADD(read_time - filter_cmp_gain,
COST_ADD(position->read_time, COST_ADD(position->read_time,
record_count / TIME_FOR_COMPARE)); record_count / TIME_FOR_COMPARE));
advance_sj_state(join, join_tables, idx, &record_count, &read_time, optimize_semi_joins(join, join_tables, idx, &record_count, &read_time,
&loose_scan_pos); &loose_scan_pos);
join_tables&= ~(s->table->map); join_tables&= ~(s->table->map);
double pushdown_cond_selectivity= 1.0; double pushdown_cond_selectivity= 1.0;
@ -8930,6 +8934,12 @@ greedy_search(JOIN *join,
/* This has been already checked by best_extension_by_limited_search */ /* This has been already checked by best_extension_by_limited_search */
DBUG_ASSERT(!is_interleave_error); DBUG_ASSERT(!is_interleave_error);
/*
Also, update the semi-join optimization state. Information about the
picked semi-join operation is in best_pos->...picker, but we need to
update the global state in the JOIN object, too.
*/
update_sj_state(join, best_table, idx, remaining_tables);
/* find the position of 'best_table' in 'join->best_ref' */ /* find the position of 'best_table' in 'join->best_ref' */
best_idx= idx; best_idx= idx;
@ -9730,8 +9740,8 @@ best_extension_by_limited_search(JOIN *join,
trace_one_table.add("rows_for_plan", current_record_count); trace_one_table.add("rows_for_plan", current_record_count);
trace_one_table.add("cost_for_plan", current_read_time); trace_one_table.add("cost_for_plan", current_read_time);
} }
advance_sj_state(join, remaining_tables, idx, &current_record_count, optimize_semi_joins(join, remaining_tables, idx, &current_record_count,
&current_read_time, &loose_scan_pos); &current_read_time, &loose_scan_pos);
/* Expand only partial plans with lower cost than the best QEP so far */ /* Expand only partial plans with lower cost than the best QEP so far */
if (current_read_time >= join->best_read) if (current_read_time >= join->best_read)

View File

@ -1295,9 +1295,15 @@ public:
Bitmap of inner tables of semi-join nests that have a proper subset of Bitmap of inner tables of semi-join nests that have a proper subset of
their tables in the current join prefix. That is, of those semi-join their tables in the current join prefix. That is, of those semi-join
nests that have their tables both in and outside of the join prefix. nests that have their tables both in and outside of the join prefix.
(Note: tables that are constants but have not been pulled out of semi-join
nests are not considered part of semi-join nests)
*/ */
table_map cur_sj_inner_tables; table_map cur_sj_inner_tables;
#ifndef DBUG_OFF
void dbug_verify_sj_inner_tables(uint n_positions) const;
#endif
/* We also maintain a stack of join optimization states in * join->positions[] */ /* We also maintain a stack of join optimization states in * join->positions[] */
/******* Join optimization state members end *******/ /******* Join optimization state members end *******/

View File

@ -2485,15 +2485,6 @@ MEM_ROOT tz_storage;
char fullname[FN_REFLEN + 1]; char fullname[FN_REFLEN + 1];
char *root_name_end; char *root_name_end;
/*
known file types that exist in the zoneinfo directory that are safe to
silently skip
*/
const char *known_extensions[]= {
".tab",
NullS
};
/* /*
Recursively scan zoneinfo directory and print all found time zone Recursively scan zoneinfo directory and print all found time zone
@ -2590,20 +2581,19 @@ scan_tz_dir(char * name_end, uint symlink_recursion_level, uint verbose)
else else
{ {
/* /*
Some systems (like debian, opensuse etc) have description Some systems (like Debian, openSUSE, etc) have non-timezone files:
files (.tab). We skip these silently if verbose is > 0 * iso3166.tab
* leap-seconds.list
* leapseconds
* tzdata.zi
* zone.tab
* zone1970.tab
We skip these silently unless verbose > 0.
*/ */
const char *current_ext= fn_ext(fullname); const char *current_ext= fn_ext(fullname);
my_bool known_ext= 0; my_bool known_ext= strlen(current_ext) ||
!strcmp(my_basename(fullname), "leapseconds");
for (const char **ext= known_extensions ; *ext ; ext++)
{
if (!strcmp(*ext, current_ext))
{
known_ext= 1;
break;
}
}
if (verbose > 0 || !known_ext) if (verbose > 0 || !known_ext)
{ {
fflush(stdout); fflush(stdout);

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, 2021, MariaDB Corporation. Copyright (c) 2016, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the Free Software the terms of the GNU General Public License as published by the Free Software
@ -1298,7 +1298,8 @@ dict_sys_tables_rec_read(
high bit set in n_cols, and flags would be zero. high bit set in n_cols, and flags would be zero.
MySQL 4.1 was the first version to support innodb_file_per_table, MySQL 4.1 was the first version to support innodb_file_per_table,
that is, *space_id != 0. */ that is, *space_id != 0. */
if (not_redundant || *space_id != 0 || *n_cols & DICT_N_COLS_COMPACT) { if (not_redundant || *space_id != 0 || *n_cols & DICT_N_COLS_COMPACT
|| fil_system.sys_space->full_crc32()) {
/* Get flags2 from SYS_TABLES.MIX_LEN */ /* Get flags2 from SYS_TABLES.MIX_LEN */
field = rec_get_nth_field_old( field = rec_get_nth_field_old(

View File

@ -7266,9 +7266,12 @@ ha_innobase::build_template(
ulint num_v = 0; ulint num_v = 0;
if ((active_index != MAX_KEY if (active_index != MAX_KEY
&& active_index == pushed_idx_cond_keyno) && active_index == pushed_idx_cond_keyno) {
|| (pushed_rowid_filter && rowid_filter_is_active)) { m_prebuilt->idx_cond = this;
goto icp;
} else if (pushed_rowid_filter && rowid_filter_is_active) {
icp:
/* Push down an index condition or an end_range check. */ /* Push down an index condition or an end_range check. */
for (ulint i = 0; i < n_fields; i++) { for (ulint i = 0; i < n_fields; i++) {
const Field* field = table->field[i]; const Field* field = table->field[i];
@ -7449,9 +7452,6 @@ ha_innobase::build_template(
} }
} }
} }
if (active_index == pushed_idx_cond_keyno) {
m_prebuilt->idx_cond = this;
}
} else { } else {
no_icp: no_icp:
/* No index condition pushdown */ /* No index condition pushdown */

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2018, MariaDB Corporation. Copyright (c) 2015, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the Free Software the terms of the GNU General Public License as published by the Free Software
@ -146,9 +146,6 @@ enum dberr_t {
DB_IO_PARTIAL_FAILED, /*!< Partial IO request failed */ DB_IO_PARTIAL_FAILED, /*!< Partial IO request failed */
DB_FORCED_ABORT, /*!< Transaction was forced to rollback
by a higher priority transaction */
DB_TABLE_CORRUPT, /*!< Table/clustered index is DB_TABLE_CORRUPT, /*!< Table/clustered index is
corrupted */ corrupted */

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2021, MariaDB Corporation. Copyright (c) 2015, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the Free Software the terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1994, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1994, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2021, MariaDB Corporation. Copyright (c) 2017, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the Free Software the terms of the GNU General Public License as published by the Free Software
@ -456,9 +456,6 @@ ut_strerr(
return("Table is encrypted but decrypt failed."); return("Table is encrypted but decrypt failed.");
case DB_IO_PARTIAL_FAILED: case DB_IO_PARTIAL_FAILED:
return("Partial IO failed"); return("Partial IO failed");
case DB_FORCED_ABORT:
return("Transaction aborted by another higher priority "
"transaction");
case DB_COMPUTE_VALUE_FAILED: case DB_COMPUTE_VALUE_FAILED:
return("Compute generated column failed"); return("Compute generated column failed");
case DB_NO_FK_ON_S_BASE_COL: case DB_NO_FK_ON_S_BASE_COL:

View File

@ -9,7 +9,7 @@
# When this is done the mysql server will be started when the machine is # When this is done the mysql server will be started when the machine is
# started and shut down when the systems goes down. # started and shut down when the systems goes down.
# Comments to support chkconfig on RedHat Linux # Comments to support chkconfig on Red Hat Linux
# chkconfig: 2345 64 36 # chkconfig: 2345 64 36
# description: A very fast and reliable SQL database engine. # description: A very fast and reliable SQL database engine.
@ -52,7 +52,7 @@ datadir=
# Negative numbers mean to wait indefinitely # Negative numbers mean to wait indefinitely
service_startup_timeout=900 service_startup_timeout=900
# Lock directory for RedHat / SuSE. # Lock directory for Red Hat / SuSE.
lockdir='/var/lock/subsys' lockdir='/var/lock/subsys'
lock_file_path="$lockdir/mysql" lock_file_path="$lockdir/mysql"
@ -91,7 +91,7 @@ datadir_set=
# #
# Use LSB init script functions for printing messages, if possible # Use LSB init script functions for printing messages, if possible
# Include non-LSB RedHat init functions to make systemctl redirect work # Include non-LSB Red Hat init functions to make systemctl redirect work
init_functions="/etc/init.d/functions" init_functions="/etc/init.d/functions"
lsb_functions="/lib/lsb/init-functions" lsb_functions="/lib/lsb/init-functions"
if test -f $lsb_functions; then if test -f $lsb_functions; then
@ -100,6 +100,7 @@ fi
if test -f $init_functions; then if test -f $init_functions; then
. $init_functions . $init_functions
else
log_success_msg() log_success_msg()
{ {
echo " SUCCESS! $@" echo " SUCCESS! $@"
@ -309,7 +310,7 @@ case "$mode" in
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mariadbd_pid_file_path" "$@" & $bindir/mysqld_safe --datadir="$datadir" --pid-file="$mariadbd_pid_file_path" "$@" &
wait_for_ready; return_value=$? wait_for_ready; return_value=$?
# Make lock for RedHat / SuSE # Make lock for Red Hat / SuSE
if test -w "$lockdir" if test -w "$lockdir"
then then
touch "$lock_file_path" touch "$lock_file_path"
@ -339,7 +340,7 @@ case "$mode" in
rm "$mariadbd_pid_file_path" rm "$mariadbd_pid_file_path"
fi fi
# Delete lock for RedHat / SuSE # Delete lock for Red Hat / SuSE
if test -f "$lock_file_path" if test -f "$lock_file_path"
then then
rm -f "$lock_file_path" rm -f "$lock_file_path"