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

Merge branch '10.6' into 10.11

This commit is contained in:
Oleksandr Byelkin
2024-01-30 08:17:58 +01:00
185 changed files with 6011 additions and 1647 deletions

View File

@ -49,6 +49,7 @@
#ifdef WITH_WSREP
#include "wsrep_schema.h"
#endif
#include "log_event.h" // MAX_TABLE_MAP_ID
/* For MySQL 5.7 virtual fields */
#define MYSQL57_GENERATED_FIELD 128
@ -108,7 +109,7 @@ LEX_CSTRING MYSQL_PROC_NAME= {STRING_WITH_LEN("proc")};
*/
static LEX_CSTRING parse_vcol_keyword= { STRING_WITH_LEN("PARSE_VCOL_EXPR ") };
static std::atomic<ulong> last_table_id;
static std::atomic<ulonglong> last_table_id;
/* Functions defined in this file */
@ -384,17 +385,20 @@ TABLE_SHARE *alloc_table_share(const char *db, const char *table_name,
DBUG_EXECUTE_IF("simulate_big_table_id",
if (last_table_id < UINT_MAX32)
last_table_id= UINT_MAX32 - 1;);
last_table_id= UINT_MAX32-1;);
/*
There is one reserved number that cannot be used. Remember to
change this when 6-byte global table id's are introduced.
Replication is using 6 bytes as table_map_id. Ensure that
the 6 lowest bytes are not 0.
We also have to ensure that we do not use the special value
UINT_MAX32 as this is used to mark a dummy event row event. See
comments in Rows_log_event::Rows_log_event().
*/
do
{
share->table_map_id=
last_table_id.fetch_add(1, std::memory_order_relaxed);
} while (unlikely(share->table_map_id == ~0UL ||
share->table_map_id == 0));
} while (unlikely((share->table_map_id & MAX_TABLE_MAP_ID) == 0) ||
unlikely((share->table_map_id & MAX_TABLE_MAP_ID) == UINT_MAX32));
}
DBUG_RETURN(share);
}
@ -457,7 +461,7 @@ void init_tmp_table_share(THD *thd, TABLE_SHARE *share, const char *key,
table_map_id is also used for MERGE tables to suppress repeated
compatibility checks.
*/
share->table_map_id= (ulong) thd->query_id;
share->table_map_id= (ulonglong) thd->query_id;
DBUG_VOID_RETURN;
}
@ -1286,12 +1290,11 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
if (keypart->key_part_flag & HA_PART_KEY_SEG)
{
int length= keypart->length/keypart->field->charset()->mbmaxlen;
Field *kpf= table->field[keypart->field->field_index];
list_item= new (mem_root) Item_func_left(thd,
new (mem_root) Item_field(thd, keypart->field),
new (mem_root) Item_field(thd, kpf),
new (mem_root) Item_int(thd, length));
list_item->fix_fields(thd, NULL);
keypart->field->vcol_info=
table->field[keypart->field->field_index]->vcol_info;
}
else
list_item= new (mem_root) Item_field(thd, keypart->field);