Merge 10.5 into 10.6

Note: Changes to the test innodb.stats_persistent
in commit e5c4c0842d (MDEV-35443)
are not merged, because the test scenario is impossible
due to commit e66928ab28 (MDEV-33462).
This commit is contained in:
Marko Mäkelä 2025-01-03 09:10:25 +02:00
commit f20ee931d8
8 changed files with 32 additions and 23 deletions

View file

@ -186,6 +186,7 @@ xb_fil_cur_open(
}
#else
err = fstat(cursor->file.m_file, &cursor->statinfo);
MSAN_STAT_WORKAROUND(&cursor->statinfo);
#endif
if (max_file_size < (ulonglong)cursor->statinfo.st_size) {
cursor->statinfo.st_size = (ulonglong)max_file_size;

View file

@ -3756,6 +3756,7 @@ next_file:
return(-1);
}
MSAN_STAT_WORKAROUND(&statinfo);
info->size = statinfo.st_size;
if (S_ISDIR(statinfo.st_mode)) {

View file

@ -454,9 +454,8 @@ sub mtr_report_stats ($$$$) {
# Print info about reporting the error
print
"The log files in var/log may give you some hint of what went wrong.\n\n",
"If you want to report this error, please read first ",
"the documentation\n",
"at http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html\n\n";
"If you want to report this error, MariaDB's bug tracker is found at\n",
"https://jira.mariadb.org\n\n";
}
else

View file

@ -198,9 +198,8 @@ sub mtr_report_stats ($) {
print
"The log files in var/log may give you some hint\n",
"of what went wrong.\n",
"If you want to report this error, please read first ",
"the documentation at\n",
"http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html\n";
"If you want to report this error, MariaDB's bug tracker is found at\n",
"https://jira.mariadb.org\n"
}
if (!$::opt_extern)
{

View file

@ -7968,11 +7968,15 @@ bool setup_tables(THD *thd, Name_resolution_context *context,
DBUG_RETURN(1);
}
tablenr++;
}
if (tablenr > MAX_TABLES)
{
my_error(ER_TOO_MANY_TABLES,MYF(0), static_cast<int>(MAX_TABLES));
DBUG_RETURN(1);
/*
Test MAX_TABLES overflow here inside the loop as setup_table_map()
called in each iteration is sensitive for this
*/
if (tablenr > MAX_TABLES)
{
my_error(ER_TOO_MANY_TABLES, MYF(0), static_cast<int>(MAX_TABLES));
DBUG_RETURN(1);
}
}
if (select_insert && !is_insert_tables_num_set)
{

View file

@ -358,6 +358,7 @@ inline void setup_table_map(TABLE *table, TABLE_LIST *table_list, uint tablenr)
table->maybe_null= embedding->outer_join;
embedding= embedding->embedding;
}
DBUG_ASSERT(tablenr <= MAX_TABLES);
table->tablenr= tablenr;
table->map= (table_map) 1 << tablenr;
table->force_index= table_list->force_index;

View file

@ -1225,6 +1225,14 @@ public:
| DICT_FTS | DICT_CORRUPT)));
}
/** @return whether this is a normal, non-virtual B-tree index
(not the change buffer, not SPATIAL or FULLTEXT) */
bool is_normal_btree() const noexcept {
return UNIV_LIKELY(!(type & (DICT_IBUF | DICT_SPATIAL
| DICT_FTS | DICT_CORRUPT
| DICT_VIRTUAL)));
}
/** @return whether the index includes virtual columns */
bool has_virtual() const { return type & DICT_VIRTUAL; }

View file

@ -340,9 +340,7 @@ opt_calc_index_goodness(
ulint op;
ulint j;
/* At least for now we don't support using FTS indexes for queries
done through InnoDB's own SQL parser. */
if (dict_index_is_online_ddl(index) || (index->type & DICT_FTS)) {
if (!index->is_normal_btree() || !index->is_committed()) {
return(0);
}
@ -553,7 +551,8 @@ opt_search_plan_for_table(
plan_t* plan;
dict_index_t* index;
ulint n_fields;
ulint best_last_op;
ulint best_goodness = 0;
ulint best_last_op = 0;
que_node_t* index_plan[256];
que_node_t* best_index_plan[256];
@ -567,14 +566,9 @@ opt_search_plan_for_table(
/* Calculate goodness for each index of the table */
plan->index = index = dict_table_get_first_index(table);
ulint best_goodness = opt_calc_index_goodness(
index, sel_node, i, best_index_plan, &best_last_op);
while ((index = dict_table_get_next_index(index))) {
if (!index->is_btree()) {
continue;
}
ulint last_op;
do {
ulint last_op = 0;
ulint goodness = opt_calc_index_goodness(index, sel_node, i,
index_plan, &last_op);
if (goodness > best_goodness) {
@ -586,7 +580,9 @@ opt_search_plan_for_table(
n_fields * sizeof *index_plan);
best_last_op = last_op;
}
}
index = dict_table_get_next_index(index);
} while (index);
n_fields = opt_calc_n_fields_from_goodness(best_goodness);