Merge 10.5 into 10.6

This commit is contained in:
Marko Mäkelä 2025-01-20 09:57:37 +02:00
commit 98dbe3bfaf
142 changed files with 3641 additions and 827 deletions

View file

@ -231,7 +231,7 @@ a
# Start of mysqldump ------
/*M!999999\- enable the sandbox mode */
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CONNECTION='mysql://root@localhost:PORT/test/t1' `TABLE_TYPE`='MYSQL';

View file

@ -46,7 +46,7 @@ int heap_rnext(HP_INFO *info, uchar *record)
&info->last_pos, offsetof(TREE_ELEMENT, left));
}
}
else if (info->last_pos)
else if (info->last_pos && info->key_version == info->s->key_version)
{
/*
We enter this branch for non-DELETE queries after heap_rkey()
@ -72,6 +72,7 @@ int heap_rnext(HP_INFO *info, uchar *record)
*/
pos= tree_search_edge(&keyinfo->rb_tree, info->parents,
&info->last_pos, offsetof(TREE_ELEMENT, left));
info->key_version= info->s->key_version;
}
else
{
@ -87,6 +88,7 @@ int heap_rnext(HP_INFO *info, uchar *record)
info->last_find_flag= HA_READ_KEY_OR_NEXT;
pos = tree_search_key(&keyinfo->rb_tree, info->lastkey, info->parents,
&info->last_pos, info->last_find_flag, &custom_arg);
info->key_version= info->s->key_version;
}
if (pos)
{

View file

@ -46,7 +46,7 @@ int heap_rprev(HP_INFO *info, uchar *record)
&info->last_pos, offsetof(TREE_ELEMENT, right));
}
}
else if (info->last_pos)
else if (info->last_pos && info->key_version == info->s->key_version)
pos = tree_search_next(&keyinfo->rb_tree, &info->last_pos,
offsetof(TREE_ELEMENT, right),
offsetof(TREE_ELEMENT, left));
@ -58,6 +58,7 @@ int heap_rprev(HP_INFO *info, uchar *record)
info->last_find_flag= HA_READ_KEY_OR_PREV;
pos = tree_search_key(&keyinfo->rb_tree, info->lastkey, info->parents,
&info->last_pos, info->last_find_flag, &custom_arg);
info->key_version= info->s->key_version;
}
if (pos)
{

View file

@ -21,7 +21,8 @@
int heap_update(HP_INFO *info, const uchar *old, const uchar *heap_new)
{
HP_KEYDEF *keydef, *end, *p_lastinx;
uchar *pos;
uchar *pos, *recovery_ptr;
struct st_hp_hash_info *recovery_hash_ptr;
my_bool auto_key_changed= 0, key_changed= 0;
HP_SHARE *share= info->s;
DBUG_ENTER("heap_update");
@ -34,6 +35,10 @@ int heap_update(HP_INFO *info, const uchar *old, const uchar *heap_new)
if (--(share->records) < share->blength >> 1) share->blength>>= 1;
share->changed=1;
// Save the cursor position to recover if insert fails.
recovery_ptr= info->current_ptr;
recovery_hash_ptr= info->current_hash_ptr;
p_lastinx= share->keydef + info->lastinx;
for (keydef= share->keydef, end= keydef + share->keys; keydef < end; keydef++)
{
@ -84,6 +89,8 @@ int heap_update(HP_INFO *info, const uchar *old, const uchar *heap_new)
}
keydef--;
}
info->current_ptr= recovery_ptr;
info->current_hash_ptr= recovery_hash_ptr;
}
if (++(share->records) == share->blength)
share->blength+= share->blength;

View file

@ -1536,8 +1536,8 @@ bool os_file_set_size(const char *name, os_file_t file, os_offset_t size,
if (is_sparse) {
bool success = !ftruncate(file, size);
if (!success) {
sql_print_error("InnoDB: ftruncate of file %s"
" to %llu bytes failed with error %d",
sql_print_error("InnoDB: ftruncate of file %s to %"
PRIu64 " bytes failed with error %d",
name, size, errno);
}
return success;
@ -1575,7 +1575,7 @@ bool os_file_set_size(const char *name, os_file_t file, os_offset_t size,
case 0:
return true;
default:
sql_print_error("InnoDB: preallocating %llu"
sql_print_error("InnoDB: preallocating %" PRIu64
" bytes for file %s failed with error %d",
size, name, err);
/* fall through */

View file

@ -211,6 +211,14 @@ row_mysql_read_blob_ref(
*len = mach_read_from_n_little_endian(ref, col_len - 8);
if (!*len) {
/* Field_blob::store() if (!length) would encode both
the length and the pointer in the same area. An empty
string must be a valid (nonnull) pointer in the
collation functions that cmp_data() may invoke. */
return ref;
}
memcpy(&data, ref + col_len - 8, sizeof data);
return(data);

View file

@ -3429,9 +3429,9 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
{
if (!searching)
mi_check_print_info(param,
"Found block with impossible length %u at %s; Skipped",
block_info.block_len+ (uint) (block_info.filepos-pos),
llstr(pos,llbuff));
"Found block with impossible length %lu at %s; Skipped",
block_info.block_len + (unsigned long) (block_info.filepos-pos),
llstr(pos, llbuff));
if (found_record)
goto try_next;
searching=1;

View file

@ -0,0 +1,14 @@
for master_1
for child2
for child3
CREATE TABLE t (c INT) ENGINE=Spider;
CREATE PROCEDURE p() CONTAINS SQL READS SQL DATA SELECT * FROM t INTO OUTFILE 'foo.txt';
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL p();
ERROR HY000: Unable to connect to foreign data source: localhost
drop procedure p;
drop table t;
for master_1
for child2
for child3

View file

@ -0,0 +1,23 @@
--disable_query_log
--disable_result_log
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
let $MYSQLD_DATADIR= `select @@datadir`;
CREATE TABLE t (c INT) ENGINE=Spider;
--disable_ps_protocol
CREATE PROCEDURE p() CONTAINS SQL READS SQL DATA SELECT * FROM t INTO OUTFILE 'foo.txt';
--enable_ps_protocol
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
CALL p();
remove_file $MYSQLD_DATADIR/test/foo.txt;
drop procedure p;
drop table t;
--disable_query_log
--disable_result_log
--source ../../t/test_deinit.inc
--enable_result_log
--enable_query_log

View file

@ -714,8 +714,8 @@ int spider_udf_bg_copy_exec_sql(
long long spider_copy_tables_body(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error
unsigned char *is_null,
unsigned char *error
) {
int error_num, roop_count, all_link_cnt = 0, use_table_charset;
SPIDER_COPY_TABLES *copy_tables = NULL;

View file

@ -1297,8 +1297,8 @@ void spider_udf_free_direct_sql_alloc(
long long spider_direct_sql_body(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error,
unsigned char *is_null,
unsigned char *error,
my_bool bg
) {
int error_num, roop_count;

View file

@ -1071,8 +1071,8 @@ int spider_ping_table_cache_compare(
long long spider_ping_table_body(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error
unsigned char *is_null,
unsigned char *error
) {
int error_num = 0, link_idx, flags, full_mon_count, current_mon_count,
success_count, fault_count, tmp_error_num = 0;

View file

@ -22,8 +22,8 @@ extern "C" {
long long spider_direct_sql(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error
unsigned char *is_null,
unsigned char *error
) {
return spider_direct_sql_body(initid, args, is_null, error, FALSE);
}
@ -46,8 +46,8 @@ void spider_direct_sql_deinit(
long long spider_bg_direct_sql(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error
unsigned char *is_null,
unsigned char *error
) {
return spider_direct_sql_bg_end(initid);
}
@ -68,8 +68,8 @@ void spider_bg_direct_sql_deinit(
void spider_bg_direct_sql_clear(
UDF_INIT *initid,
char *is_null,
char *error
unsigned char *is_null,
unsigned char *error
) {
spider_direct_sql_bg_start(initid);
}
@ -77,8 +77,8 @@ void spider_bg_direct_sql_clear(
void spider_bg_direct_sql_add(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error
unsigned char *is_null,
unsigned char *error
) {
spider_direct_sql_body(initid, args, is_null, error, TRUE);
}
@ -87,8 +87,8 @@ void spider_bg_direct_sql_add(
long long spider_ping_table(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error
unsigned char *is_null,
unsigned char *error
) {
return spider_ping_table_body(initid, args, is_null, error);
}
@ -110,8 +110,8 @@ void spider_ping_table_deinit(
long long spider_flush_table_mon_cache(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error
unsigned char *is_null,
unsigned char *error
) {
return spider_flush_table_mon_cache_body();
}
@ -132,8 +132,8 @@ void spider_flush_table_mon_cache_deinit(
long long spider_copy_tables(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error
unsigned char *is_null,
unsigned char *error
) {
return spider_copy_tables_body(initid, args, is_null, error);
}

View file

@ -16,8 +16,8 @@
long long spider_direct_sql_body(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error,
unsigned char *is_null,
unsigned char *error,
my_bool bg
);
@ -45,8 +45,8 @@ long long spider_direct_sql_bg_end(
long long spider_ping_table_body(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error
unsigned char *is_null,
unsigned char *error
);
my_bool spider_ping_table_init_body(
@ -64,8 +64,8 @@ long long spider_flush_table_mon_cache_body();
long long spider_copy_tables_body(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error
unsigned char *is_null,
unsigned char *error
);
my_bool spider_copy_tables_init_body(