1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge 10.4 into 10.5

This commit is contained in:
Marko Mäkelä
2020-10-30 11:15:30 +02:00
184 changed files with 20295 additions and 2598 deletions

View File

@ -2785,6 +2785,10 @@ int JOIN::optimize_stage2()
(select_options & (SELECT_DESCRIBE | SELECT_NO_JOIN_CACHE)) |
(select_lex->ftfunc_list->elements ? SELECT_NO_JOIN_CACHE : 0);
if (select_lex->options & OPTION_SCHEMA_TABLE &&
optimize_schema_tables_reads(this))
DBUG_RETURN(1);
if (make_join_readinfo(this, select_opts_for_readinfo, no_jbuf_after))
DBUG_RETURN(1);
@ -2961,10 +2965,6 @@ int JOIN::optimize_stage2()
having_is_correlated= MY_TEST(having->used_tables() & OUTER_REF_TABLE_BIT);
tmp_having= having;
if ((select_lex->options & OPTION_SCHEMA_TABLE) &&
optimize_schema_tables_reads(this))
DBUG_RETURN(TRUE);
if (unlikely(thd->is_error()))
DBUG_RETURN(TRUE);
@ -18172,8 +18172,7 @@ public:
bool add_schema_fields(THD *thd, TABLE *table,
TMP_TABLE_PARAM *param,
const ST_SCHEMA_TABLE &schema_table,
const MY_BITMAP &bitmap);
const ST_SCHEMA_TABLE &schema_table);
bool finalize(THD *thd, TABLE *table, TMP_TABLE_PARAM *param,
bool do_not_open, bool keep_row_order);
@ -18282,8 +18281,7 @@ TABLE *Create_tmp_table::start(THD *thd,
No need to change table name to lower case as we are only creating
MyISAM, Aria or HEAP tables here
*/
fn_format(path, path, mysql_tmpdir, "",
MY_REPLACE_EXT|MY_UNPACK_FILENAME);
fn_format(path, path, mysql_tmpdir, "", MY_REPLACE_EXT|MY_UNPACK_FILENAME);
if (m_group)
{
@ -19105,8 +19103,7 @@ err:
bool Create_tmp_table::add_schema_fields(THD *thd, TABLE *table,
TMP_TABLE_PARAM *param,
const ST_SCHEMA_TABLE &schema_table,
const MY_BITMAP &bitmap)
const ST_SCHEMA_TABLE &schema_table)
{
DBUG_ENTER("Create_tmp_table::add_schema_fields");
DBUG_ASSERT(table);
@ -19125,11 +19122,9 @@ bool Create_tmp_table::add_schema_fields(THD *thd, TABLE *table,
for (fieldnr= 0; !defs[fieldnr].end_marker(); fieldnr++)
{
const ST_FIELD_INFO &def= defs[fieldnr];
bool visible= bitmap_is_set(&bitmap, fieldnr);
Record_addr addr(def.nullable());
const Type_handler *h= def.type_handler();
Field *field= h->make_schema_field(&table->mem_root, table,
addr, def, visible);
Field *field= h->make_schema_field(&table->mem_root, table, addr, def);
if (!field)
{
thd->mem_root= mem_root_save;
@ -19192,17 +19187,16 @@ TABLE *create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
TABLE *create_tmp_table_for_schema(THD *thd, TMP_TABLE_PARAM *param,
const ST_SCHEMA_TABLE &schema_table,
const MY_BITMAP &bitmap,
longlong select_options,
const LEX_CSTRING &table_alias,
bool keep_row_order)
bool do_not_open, bool keep_row_order)
{
TABLE *table;
Create_tmp_table maker(param, (ORDER *) NULL, false, false,
select_options, HA_POS_ERROR);
if (!(table= maker.start(thd, param, &table_alias)) ||
maker.add_schema_fields(thd, table, param, schema_table, bitmap) ||
maker.finalize(thd, table, param, false, keep_row_order))
maker.add_schema_fields(thd, table, param, schema_table) ||
maker.finalize(thd, table, param, do_not_open, keep_row_order))
{
maker.cleanup_on_failure(thd, table);
return NULL;
@ -19583,14 +19577,10 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo,
}
}
if (unlikely((error= maria_create(share->path.str,
file_type,
share->keys, &keydef,
(uint) (*recinfo-start_recinfo),
start_recinfo,
share->uniques, &uniquedef,
&create_info,
create_flags))))
if (unlikely((error= maria_create(share->path.str, file_type, share->keys,
&keydef, (uint) (*recinfo-start_recinfo),
start_recinfo, share->uniques, &uniquedef,
&create_info, create_flags))))
{
table->file->print_error(error,MYF(0)); /* purecov: inspected */
table->db_stat=0;