Merge 10.6 into 10.11

This commit is contained in:
Marko Mäkelä 2025-03-27 08:01:47 +02:00
commit ab0f2a00b6
463 changed files with 4273 additions and 1953 deletions

View file

@ -92,11 +92,11 @@ void CntEndDB(PGLOBAL g)
free(dbuserp);
if (trace(1))
htrc("CntEndDB: Freeing Dup\n");
if (trace(1))
htrc("CntEndDB: Freeing Dup\n");
g->Activityp->Aptr = NULL;
} // endif dbuserp
g->Activityp->Aptr = NULL; // Free PlgGetUser() data
} // endif dbuserp
} // end of CntEndDB

View file

@ -101,9 +101,6 @@ bool user_connect::user_init()
PACTIVITY ap= NULL;
PDBUSER dup= NULL;
// Areasize= 64M because of VEC tables. Should be parameterisable
//g= PlugInit(NULL, 67108864);
//g= PlugInit(NULL, 134217728); // 128M was because of old embedded tests
g= PlugInit(NULL, (size_t)worksize);
// Check whether the initialization is complete
@ -113,12 +110,13 @@ bool user_connect::user_init()
printf("%s\n", g->Message);
(void) PlugExit(g);
g= 0;
if (dup)
free(dup);
if (dup)
free(dup);
return true;
} // endif g->
} // endif g->
dup->Catalog= new MYCAT(NULL);
@ -128,17 +126,16 @@ bool user_connect::user_init()
g->Activityp= ap;
g->Activityp->Aptr= dup;
pthread_mutex_lock(&usrmut);
pthread_mutex_lock(&usrmut);
next= to_users;
to_users= this;
if (next)
next->previous= this;
count = 1;
pthread_mutex_unlock(&usrmut);
last_query_id= thdp->query_id;
count = 1;
pthread_mutex_unlock(&usrmut);
last_query_id= thdp->query_id;
return false;
} // end of user_init

View file

@ -3929,10 +3929,9 @@ database_corrupted_compressed:
if (err == DB_PAGE_CORRUPTED || err == DB_DECRYPTION_FAILED)
{
release_page:
if (node.space->full_crc32() && node.space->crypt_data &&
recv_recovery_is_on() &&
recv_sys.dblwr.find_encrypted_page(node, id().page_no(),
const_cast<byte*>(read_frame)))
if (node.space->full_crc32() && recv_recovery_is_on() &&
recv_sys.dblwr.find_deferred_page(node, id().page_no(),
const_cast<byte*>(read_frame)))
{
/* Recover from doublewrite buffer */
err= DB_SUCCESS;

View file

@ -374,7 +374,7 @@ void buf_dblwr_t::recover() noexcept
srv_page_size));
byte *const buf= read_buf + srv_page_size;
std::deque<byte*> encrypted_pages;
std::deque<byte*> deferred_pages;
for (recv_dblwr_t::list::iterator i= recv_sys.dblwr.pages.begin();
i != recv_sys.dblwr.pages.end(); ++i, ++page_no_dblwr)
{
@ -393,11 +393,12 @@ void buf_dblwr_t::recover() noexcept
{
/* These pages does not appear to belong to any tablespace.
There is a possibility that this page could be
encrypted using full_crc32 format. If innodb encounters
any corrupted encrypted page during recovery then
InnoDB should use this page to find the valid page.
See find_encrypted_page() */
encrypted_pages.push_back(*i);
encrypted/compressed using full_crc32 format.
If innodb encounters any corrupted encrypted/compressed
page during recovery then InnoDB should use this page to
find the valid page.
See find_encrypted_page()/find_page_compressed() */
deferred_pages.push_back(*i);
continue;
}
@ -478,7 +479,7 @@ next_page:
}
recv_sys.dblwr.pages.clear();
for (byte *page : encrypted_pages)
for (byte *page : deferred_pages)
recv_sys.dblwr.pages.push_back(page);
fil_flush_file_spaces();
aligned_free(read_buf);

View file

@ -504,10 +504,10 @@ rtr_pcur_move_to_next(
rtr_rec_t rec;
rec = rtr_info->matches->matched_recs->back();
rtr_info->matches->matched_recs->pop_back();
cursor->btr_cur.page_cur.block = rtr_info->matches->block;
mysql_mutex_unlock(&rtr_info->matches->rtr_match_mutex);
cursor->btr_cur.page_cur.rec = rec.r_rec;
cursor->btr_cur.page_cur.block = rtr_info->matches->block;
DEBUG_SYNC_C("rtr_pcur_move_to_next_return");
return(true);
@ -1565,7 +1565,10 @@ rtr_check_discard_page(
if (auto matches = rtr_info->matches) {
mysql_mutex_lock(&matches->rtr_match_mutex);
if (matches->block->page.id() == id) {
/* matches->block could be nullptr when cursor
encounters empty table */
if (rtr_info->matches->block
&& matches->block->page.id() == id) {
matches->matched_recs->clear();
matches->valid = false;
}
@ -2201,6 +2204,15 @@ rtr_cur_search_with_match(
ut_ad(orig_mode
!= PAGE_CUR_RTREE_LOCATE);
/* Collect matched records on page */
offsets = rec_get_offsets(
rec, index, offsets,
index->n_fields,
ULINT_UNDEFINED, &heap);
mysql_mutex_lock(
&rtr_info->matches->rtr_match_mutex);
if (!match_init) {
rtr_init_match(
rtr_info->matches,
@ -2208,14 +2220,12 @@ rtr_cur_search_with_match(
match_init = true;
}
/* Collect matched records on page */
offsets = rec_get_offsets(
rec, index, offsets,
index->n_fields,
ULINT_UNDEFINED, &heap);
rtr_leaf_push_match_rec(
rec, rtr_info, offsets,
page_is_comp(page));
mysql_mutex_unlock(
&rtr_info->matches->rtr_match_mutex);
}
last_match_rec = rec;

View file

@ -15922,28 +15922,37 @@ ha_innobase::extra(
break;
case HA_EXTRA_END_ALTER_COPY:
trx = check_trx_exists(ha_thd());
if (m_prebuilt->table->skip_alter_undo) {
if (dberr_t err= trx->bulk_insert_apply()) {
m_prebuilt->table->skip_alter_undo = 0;
return convert_error_code_to_mysql(
err,
m_prebuilt->table->flags,
trx->mysql_thd);
}
trx->end_bulk_insert(*m_prebuilt->table);
trx->bulk_insert = false;
/* During copy alter operation, InnoDB
updates the stats only for non-persistent
tables. */
if (!m_prebuilt->table->stats_is_persistent()) {
dict_stats_update_if_needed(
m_prebuilt->table, *trx);
}
if (!m_prebuilt->table->skip_alter_undo) {
/* This could be invoked inside INSERT...SELECT.
We do not want any extra log writes, because
they could cause a severe performance regression. */
break;
}
m_prebuilt->table->skip_alter_undo = 0;
if (dberr_t err= trx->bulk_insert_apply()) {
m_prebuilt->table->skip_alter_undo = 0;
return convert_error_code_to_mysql(
err, m_prebuilt->table->flags,
trx->mysql_thd);
}
trx->end_bulk_insert(*m_prebuilt->table);
trx->bulk_insert = false;
if (!m_prebuilt->table->is_temporary()
&& !high_level_read_only) {
/* During copy_data_between_tables(), InnoDB only
updates transient statistics. */
if (!m_prebuilt->table->stats_is_persistent()) {
dict_stats_update_if_needed(m_prebuilt->table,
*trx);
}
/* The extra log write is necessary for
ALTER TABLE...ALGORITHM=COPY, because
a normal transaction commit would be a no-op
because no undo log records were generated.
This log write will also be unnecessarily executed
during CREATE...SELECT, which is the other caller of
handler::extra(HA_EXTRA_BEGIN_ALTER_COPY). */
log_buffer_flush_to_disk();
}
break;

View file

@ -2241,6 +2241,12 @@ ha_innobase::check_if_supported_inplace_alter(
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}
if (ha_alter_info->create_info->used_fields
& HA_CREATE_USED_SEQUENCE) {
ha_alter_info->unsupported_reason = "SEQUENCE";
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}
update_thd();
if (!m_prebuilt->table->space) {
@ -6512,6 +6518,8 @@ prepare_inplace_alter_table_dict(
DBUG_ASSERT(!ctx->add_index);
DBUG_ASSERT(!ctx->add_key_numbers);
DBUG_ASSERT(!ctx->num_to_add_index);
DBUG_ASSERT(!(ha_alter_info->create_info->used_fields
& HA_CREATE_USED_SEQUENCE));
user_table = ctx->new_table;

View file

@ -118,15 +118,17 @@ struct recv_dblwr_t
const fil_space_t *space= nullptr,
byte *tmp_buf= nullptr) const noexcept;
/** Find the doublewrite copy of an encrypted page with the
smallest FIL_PAGE_LSN that is large enough for recovery.
/** Find the doublewrite copy of an encrypted/page_compressed
page with the smallest FIL_PAGE_LSN that is large enough for
recovery.
@param space tablespace object
@param page_no page number to find
@param buf buffer for unencrypted page
@param buf buffer for unencrypted/uncompressed page
@return buf
@retval nullptr if the page was not found in doublewrite buffer */
byte *find_encrypted_page(const fil_node_t &space, uint32_t page_no,
byte *buf) noexcept;
ATTRIBUTE_COLD byte *find_deferred_page(const fil_node_t &space,
uint32_t page_no,
byte *buf) noexcept;
/** Restore the first page of the given tablespace from
doublewrite buffer.

View file

@ -4884,28 +4884,43 @@ bool recv_dblwr_t::validate_page(const page_id_t page_id, lsn_t max_lsn,
goto check_if_corrupted;
}
byte *recv_dblwr_t::find_encrypted_page(const fil_node_t &node,
uint32_t page_no,
byte *buf) noexcept
ATTRIBUTE_COLD
byte *recv_dblwr_t::find_deferred_page(const fil_node_t &node,
uint32_t page_no,
byte *buf) noexcept
{
ut_ad(node.space->crypt_data);
ut_ad(node.space->full_crc32());
mysql_mutex_lock(&recv_sys.mutex);
byte *result_page= nullptr;
bool is_encrypted= node.space->crypt_data &&
node.space->crypt_data->is_encrypted();
for (list::iterator page_it= pages.begin(); page_it != pages.end();
page_it++)
{
if (page_get_page_no(*page_it) != page_no ||
buf_page_is_corrupted(true, *page_it, node.space->flags))
continue;
if (is_encrypted &&
!mach_read_from_4(*page_it + FIL_PAGE_FCRC32_KEY_VERSION))
continue;
memcpy(buf, *page_it, node.space->physical_size());
buf_tmp_buffer_t *slot= buf_pool.io_buf_reserve(false);
ut_a(slot);
slot->allocate();
bool invalidate=
!fil_space_decrypt(node.space, slot->crypt_buf, buf) ||
(node.space->is_compressed() &&
!fil_page_decompress(slot->crypt_buf, buf, node.space->flags));
bool invalidate= false;
if (is_encrypted)
{
invalidate= !fil_space_decrypt(node.space, slot->crypt_buf, buf);
if (!invalidate && node.space->is_compressed())
goto decompress;
}
else
decompress:
invalidate= !fil_page_decompress(slot->crypt_buf, buf,
node.space->flags);
slot->release();
if (invalidate ||

View file

@ -4065,14 +4065,7 @@ void UndorecApplier::log_update(const dtuple_t &tuple,
if (!(this->cmpl_info & UPD_NODE_NO_ORD_CHANGE))
{
for (ulint i = 0; i < dict_table_get_n_v_cols(table); i++)
dfield_get_type(
dtuple_get_nth_v_field(row, i))->mtype = DATA_MISSING;
}
if (is_update)
{
old_row= dtuple_copy(row, heap);
row_upd_replace(old_row, &old_ext, clust_index, update, heap);
dfield_get_type(dtuple_get_nth_v_field(row, i))->mtype = DATA_MISSING;
}
if (table->n_v_cols)
@ -4080,6 +4073,12 @@ void UndorecApplier::log_update(const dtuple_t &tuple,
(cmpl_info & UPD_NODE_NO_ORD_CHANGE)
? nullptr : undo_rec);
if (is_update)
{
old_row= dtuple_copy(row, heap);
row_upd_replace(old_row, &old_ext, clust_index, update, heap);
}
bool success= true;
dict_index_t *index= dict_table_get_next_index(clust_index);
while (index)

View file

@ -452,7 +452,7 @@ void trx_t::free()
/** Transition to committed state, to release implicit locks. */
TRANSACTIONAL_INLINE inline void trx_t::commit_state()
{
ut_d(auto trx_state{state});
ut_d(auto trx_state= state);
ut_ad(trx_state == TRX_STATE_PREPARED ||
trx_state == TRX_STATE_PREPARED_RECOVERED ||
trx_state == TRX_STATE_ACTIVE);

View file

@ -276,7 +276,7 @@ CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing,
int open_flags)
{
uchar buffer[CF_MAX_SIZE];
char name[FN_REFLEN], errmsg_buff[256];
char name[FN_REFLEN], errmsg_buff[512];
const char *errmsg, *lock_failed_errmsg= "Could not get an exclusive lock;"
" file is probably in use by another process";
uint new_cf_create_time_size, new_cf_changeable_size, new_block_size;
@ -399,10 +399,14 @@ CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing,
if (new_cf_create_time_size < CF_MIN_CREATE_TIME_TOTAL_SIZE ||
new_cf_changeable_size < CF_MIN_CHANGEABLE_TOTAL_SIZE ||
new_cf_create_time_size + new_cf_changeable_size != file_size)
new_cf_create_time_size + new_cf_changeable_size > file_size)
{
error= CONTROL_FILE_INCONSISTENT_INFORMATION;
errmsg= "Sizes stored in control file are inconsistent";
sprintf(errmsg_buff,
"Sizes stored in control file are inconsistent. "
"create_time_size: %u changeable_size: %u file_size: %llu",
new_cf_create_time_size, new_cf_changeable_size, (ulonglong) file_size);
errmsg= errmsg_buff;
goto err;
}
@ -622,6 +626,20 @@ my_bool ma_control_file_inited(void)
return (control_file_fd >= 0);
}
static int check_zerofill(uchar *buffer, ulonglong offset, ulonglong length)
{
uchar *pos= buffer + offset, *end= buffer+length;
while (pos < end)
{
if (*pos++)
return 1;
}
return 0;
}
/**
Print content of aria_log_control file
*/
@ -629,6 +647,7 @@ my_bool ma_control_file_inited(void)
my_bool print_aria_log_control()
{
uchar buffer[CF_MAX_SIZE];
char errmsg_buff[512];
char name[FN_REFLEN], uuid_str[MY_UUID_STRING_LENGTH+1];
const char *errmsg;
uint new_cf_create_time_size, new_cf_changeable_size;
@ -705,10 +724,14 @@ my_bool print_aria_log_control()
if (new_cf_create_time_size < CF_MIN_CREATE_TIME_TOTAL_SIZE ||
new_cf_changeable_size < CF_MIN_CHANGEABLE_TOTAL_SIZE ||
new_cf_create_time_size + new_cf_changeable_size != file_size)
new_cf_create_time_size + new_cf_changeable_size > file_size)
{
error= CONTROL_FILE_INCONSISTENT_INFORMATION;
errmsg= "Sizes stored in control file are inconsistent";
sprintf(errmsg_buff,
"Sizes stored in control file are inconsistent. "
"create_time_size: %u changeable_size: %u file_size: %llu",
new_cf_create_time_size, new_cf_changeable_size, (ulonglong) file_size);
errmsg= errmsg_buff;
goto err;
}
checkpoint_lsn= lsn_korr(buffer + new_cf_create_time_size +
@ -732,6 +755,18 @@ my_bool print_aria_log_control()
(buffer + new_cf_create_time_size + CF_RECOV_FAIL_OFFSET)[0];
printf("recovery_failures: %u\n", recovery_fails);
}
if (check_zerofill(buffer, new_cf_create_time_size + new_cf_changeable_size, file_size))
{
printf("Warning: %s file_size is %llu (should be %llu) and contains unknown data.\n"
"It will still work but should be examined.\n",
name, (ulonglong) file_size,
(ulonglong) (new_cf_create_time_size + new_cf_changeable_size));
}
else if (new_cf_create_time_size + new_cf_changeable_size < file_size)
printf("Note: file_size (%llu) is bigger than the expected file size %llu.\n"
"This is unexpected but will not cause any issues.\n",
(ulonglong) file_size,
(ulonglong) (new_cf_create_time_size + new_cf_changeable_size));
mysql_file_close(file, MYF(0));
DBUG_RETURN(0);

View file

@ -139,6 +139,8 @@ ha_checksum _ma_unique_hash(MARIA_UNIQUEDEF *def, const uchar *record)
{
uint tmp_length= _ma_calc_blob_length(keyseg->bit_start,pos);
memcpy((void*) &pos,pos+keyseg->bit_start,sizeof(char*));
if (!pos)
pos= (const uchar*) ""; /* hash_sort does not support NULL ptr */
if (!length || length > tmp_length)
length=tmp_length; /* The whole blob */
}
@ -236,6 +238,10 @@ my_bool _ma_unique_comp(MARIA_UNIQUEDEF *def, const uchar *a, const uchar *b,
}
memcpy((void*) &pos_a, pos_a+keyseg->bit_start, sizeof(char*));
memcpy((void*) &pos_b, pos_b+keyseg->bit_start, sizeof(char*));
if (pos_a == 0)
pos_a= (const uchar *) ""; /* Avoid UBSAN nullptr-with-offset */
if (pos_b == 0)
pos_b= (const uchar *) ""; /* Avoid UBSAN nullptr-with-offset */
}
if (type == HA_KEYTYPE_TEXT/* the CHAR data type*/)
{

View file

@ -115,6 +115,8 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const uchar *record)
{
uint tmp_length=_mi_calc_blob_length(keyseg->bit_start,pos);
memcpy((char**) &pos, pos+keyseg->bit_start, sizeof(char*));
if (!pos)
pos= (const uchar*) ""; /* hash_sort does not support NULL ptr */
if (!length || length > tmp_length)
length=tmp_length; /* The whole blob */
}
@ -211,6 +213,10 @@ int mi_unique_comp(MI_UNIQUEDEF *def, const uchar *a, const uchar *b,
}
memcpy((char**) &pos_a, pos_a+keyseg->bit_start, sizeof(char*));
memcpy((char**) &pos_b, pos_b+keyseg->bit_start, sizeof(char*));
if (pos_a == 0)
pos_a= (const uchar *) ""; /* Avoid UBSAN nullptr-with-offset */
if (pos_b == 0)
pos_b= (const uchar *) ""; /* Avoid UBSAN nullptr-with-offset */
}
if (type == HA_KEYTYPE_TEXT/*The CHAR data type*/)
{

View file

@ -0,0 +1,16 @@
#
# MDEV-35807 Spider wrapper name is case sensitive
#
for master_1
for child2
for child3
set spider_same_server_link= 1;
CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
SELECT spider_direct_sql ('SELECT 1','','SRV "srv"');
spider_direct_sql ('SELECT 1','','SRV "srv"')
1
drop server srv;
for master_1
for child2
for child3

View file

@ -0,0 +1,50 @@
#
# MDEV-35874 Unexpected error 1264 'Out of Range Value for Column' when inserting into ... select ... from a spider table
#
for master_1
for child2
for child3
set spider_same_server_link= 1;
CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t1 (c6 decimal(6,0)) ENGINE=InnoDB;
CREATE TABLE t1_s (c6 decimal(6,0))
ENGINE=SPIDER COMMENT='wrapper "mariadb", srv "srv", table "t1"' ;
CREATE TABLE t2 (c8 decimal(8,0), c6 decimal(6,0)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (123456), (654321);
/* 1 */ SELECT 12345678, c6 FROM t1_s GROUP BY c6;
12345678 c6
12345678 123456
12345678 654321
/* 2 */ INSERT INTO t2 (c8, c6) SELECT 12345678, c6 FROM t1_s GROUP BY c6;
set spider_quick_mode= 2;
/* 3 */ SELECT 12345678, c6 FROM t1_s GROUP BY c6;
12345678 c6
12345678 123456
12345678 654321
/* 4 */ INSERT INTO t2 (c8, c6) SELECT 12345678, c6 FROM t1_s GROUP BY c6;
set spider_quick_mode= 3;
set spider_quick_page_size= 1;
INSERT INTO t1 VALUES (777777);
/* 5 */ SELECT 12345678, c6 FROM t1_s GROUP BY c6;
12345678 c6
12345678 123456
12345678 654321
12345678 777777
/* 6 */ INSERT INTO t2 (c8, c6) SELECT 12345678, c6 FROM t1_s GROUP BY c6;
set spider_quick_mode= 0;
set spider_quick_page_size= 1024;
CREATE OR REPLACE TABLE t1_s (c6 decimal(6,0) key)
ENGINE=SPIDER COMMENT='wrapper "mariadb", srv "srv", table "t1"' ;
/* 7 */ SELECT MAX(c6), SUM(c6) FROM t1_s;
MAX(c6) SUM(c6)
777777 1555554
set spider_select_column_mode= 0;
/* 8 */ SELECT MAX(c6), SUM(c6) FROM t1_s;
MAX(c6) SUM(c6)
777777 1555554
drop table t2, t1_s, t1;
drop server srv;
for master_1
for child2
for child3

View file

@ -0,0 +1,25 @@
#
# MDEV-35959 Assertion `*str != '\0'' failed in my_message_sql after a Spider error
#
for master_1
for child2
for child3
SET spider_same_server_link=ON, spider_net_read_timeout=1;
CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t_remote (a INT);
CREATE TABLE t (a INT) ENGINE=SPIDER COMMENT = 'wrapper "mysql", srv "srv", table "t_remote"';
CREATE OR REPLACE TABLE t_remote LIKE t;
ERROR 08S01: Got timeout reading communication packets
SHOW WARNINGS;
Level Code Message
Error 1159 Got timeout reading communication packets
Error 1159 Got timeout reading communication packets
Error 1159 Got timeout reading communication packets
Error 1159 Got timeout reading communication packets
Error 1159 Got timeout reading communication packets
drop table t;
drop server srv;
for master_1
for child2
for child3

View file

@ -0,0 +1,21 @@
--echo #
--echo # MDEV-35807 Spider wrapper name is case sensitive
--echo #
--disable_query_log
--disable_result_log
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
set spider_same_server_link= 1;
evalp CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
SELECT spider_direct_sql ('SELECT 1','','SRV "srv"');
drop server srv;
--disable_query_log
--disable_result_log
--source ../../t/test_deinit.inc
--enable_result_log
--enable_query_log

View file

@ -0,0 +1,52 @@
--echo #
--echo # MDEV-35874 Unexpected error 1264 'Out of Range Value for Column' when inserting into ... select ... from a spider table
--echo #
--disable_query_log
--disable_result_log
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
--source include/have_innodb.inc
set spider_same_server_link= 1;
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t1 (c6 decimal(6,0)) ENGINE=InnoDB;
CREATE TABLE t1_s (c6 decimal(6,0))
ENGINE=SPIDER COMMENT='wrapper "mariadb", srv "srv", table "t1"' ;
CREATE TABLE t2 (c8 decimal(8,0), c6 decimal(6,0)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (123456), (654321);
/* 1 */ SELECT 12345678, c6 FROM t1_s GROUP BY c6;
/* 2 */ INSERT INTO t2 (c8, c6) SELECT 12345678, c6 FROM t1_s GROUP BY c6;
set spider_quick_mode= 2;
/* 3 */ SELECT 12345678, c6 FROM t1_s GROUP BY c6;
/* 4 */ INSERT INTO t2 (c8, c6) SELECT 12345678, c6 FROM t1_s GROUP BY c6;
set spider_quick_mode= 3;
set spider_quick_page_size= 1;
INSERT INTO t1 VALUES (777777);
/* 5 */ SELECT 12345678, c6 FROM t1_s GROUP BY c6;
/* 6 */ INSERT INTO t2 (c8, c6) SELECT 12345678, c6 FROM t1_s GROUP BY c6;
set spider_quick_mode= 0;
set spider_quick_page_size= 1024;
CREATE OR REPLACE TABLE t1_s (c6 decimal(6,0) key)
ENGINE=SPIDER COMMENT='wrapper "mariadb", srv "srv", table "t1"' ;
/* 7 */ SELECT MAX(c6), SUM(c6) FROM t1_s;
set spider_select_column_mode= 0;
/* 8 */ SELECT MAX(c6), SUM(c6) FROM t1_s;
drop table t2, t1_s, t1;
drop server srv;
--disable_query_log
--disable_result_log
--source ../../t/test_deinit.inc
--enable_result_log
--enable_query_log

View file

@ -0,0 +1,30 @@
--echo #
--echo # MDEV-35959 Assertion `*str != '\0'' failed in my_message_sql after a Spider error
--echo #
--disable_query_log
--disable_result_log
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
SET spider_same_server_link=ON, spider_net_read_timeout=1;
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t_remote (a INT);
CREATE TABLE t (a INT) ENGINE=SPIDER COMMENT = 'wrapper "mysql", srv "srv", table "t_remote"';
--disable_ps_protocol
--error ER_NET_READ_INTERRUPTED
CREATE OR REPLACE TABLE t_remote LIKE t;
--enable_ps_protocol
SHOW WARNINGS;
drop table t;
drop server srv;
--disable_query_log
--disable_result_log
--source ../../t/test_deinit.inc
--enable_result_log
--enable_query_log

View file

@ -2365,7 +2365,7 @@ int spider_db_fetch_table(
if (result_list->quick_mode == 0)
{
SPIDER_DB_RESULT *result = current->result;
if (!(row = result->fetch_row()))
if (!(row = result->fetch_row(result_list->skips)))
{
table->status = STATUS_NOT_FOUND;
DBUG_RETURN(HA_ERR_END_OF_FILE);
@ -2481,7 +2481,7 @@ int spider_db_fetch_key(
if (result_list->quick_mode == 0)
{
SPIDER_DB_RESULT *result = current->result;
if (!(row = result->fetch_row()))
if (!(row = result->fetch_row(result_list->skips)))
{
table->status = STATUS_NOT_FOUND;
DBUG_RETURN(HA_ERR_END_OF_FILE);
@ -2588,7 +2588,7 @@ int spider_db_fetch_minimum_columns(
if (result_list->quick_mode == 0)
{
SPIDER_DB_RESULT *result = current->result;
if (!(row = result->fetch_row()))
if (!(row = result->fetch_row(result_list->skips)))
{
table->status = STATUS_NOT_FOUND;
DBUG_RETURN(HA_ERR_END_OF_FILE);
@ -3346,7 +3346,7 @@ int spider_db_store_result(
}
position++;
roop_count++;
row = current->result->fetch_row();
row = current->result->fetch_row(result_list->skips);
}
} else {
do {
@ -3368,7 +3368,7 @@ int spider_db_store_result(
}
} while (
page_size > roop_count &&
(row = current->result->fetch_row())
(row = current->result->fetch_row(result_list->skips))
);
}
if (
@ -3412,7 +3412,7 @@ int spider_db_store_result(
roop_count++;
} while (
result_list->limit_num > roop_count &&
(row = current->result->fetch_row())
(row = current->result->fetch_row(result_list->skips))
);
tmp_tbl->file->ha_end_bulk_insert();
page_size = result_list->limit_num;
@ -3631,7 +3631,7 @@ int spider_db_store_result_for_reuse_cursor(
}
current->dbton_id = current->result->dbton_id;
SPIDER_DB_ROW *row;
if (!(row = current->result->fetch_row()))
if (!(row = current->result->fetch_row(result_list->skips)))
{
error_num = current->result->get_errno();
DBUG_PRINT("info",("spider set finish_flg point 3"));
@ -3707,7 +3707,7 @@ int spider_db_store_result_for_reuse_cursor(
}
position++;
roop_count++;
row = current->result->fetch_row();
row = current->result->fetch_row(result_list->skips);
}
} else {
do {
@ -3729,7 +3729,7 @@ int spider_db_store_result_for_reuse_cursor(
}
} while (
page_size > roop_count &&
(row = current->result->fetch_row())
(row = current->result->fetch_row(result_list->skips))
);
}
if (
@ -3773,7 +3773,7 @@ int spider_db_store_result_for_reuse_cursor(
roop_count++;
} while (
result_list->limit_num > roop_count &&
(row = current->result->fetch_row())
(row = current->result->fetch_row(result_list->skips))
);
tmp_tbl->file->ha_end_bulk_insert();
page_size = result_list->limit_num;
@ -4316,9 +4316,8 @@ int spider_db_seek_next(
}
}
}
DBUG_RETURN(spider_db_fetch(buf, spider, table));
} else
DBUG_RETURN(spider_db_fetch(buf, spider, table));
}
DBUG_RETURN(spider_db_fetch(buf, spider, table));
}
int spider_db_seek_last(

View file

@ -194,7 +194,7 @@ int spider_udf_direct_sql_create_conn_key(
spider_dbton[roop_count2].wrapper : "NULL"));
if (
spider_dbton[roop_count2].wrapper &&
!strcmp(direct_sql->tgt_wrapper, spider_dbton[roop_count2].wrapper)
!strcasecmp(direct_sql->tgt_wrapper, spider_dbton[roop_count2].wrapper)
) {
if (spider_dbton[roop_count2].db_access_type ==
SPIDER_DB_ACCESS_TYPE_SQL)
@ -1031,7 +1031,7 @@ int spider_udf_set_direct_sql_param_default(
spider_dbton[roop_count].wrapper : "NULL"));
if (
spider_dbton[roop_count].wrapper &&
!strcmp(direct_sql->tgt_wrapper,
!strcasecmp(direct_sql->tgt_wrapper,
spider_dbton[roop_count].wrapper)
) {
if (spider_dbton[roop_count].db_access_type ==

View file

@ -3550,7 +3550,7 @@ int spider_set_connect_info_default(
spider_dbton[roop_count2].wrapper : "NULL"));
if (
spider_dbton[roop_count2].wrapper &&
!strcmp(share->tgt_wrappers[roop_count],
!strcasecmp(share->tgt_wrappers[roop_count],
spider_dbton[roop_count2].wrapper)
) {
if (spider_dbton[roop_count2].db_access_type ==
@ -3832,7 +3832,7 @@ int spider_set_connect_info_default_db_table(
spider_dbton[roop_count2].wrapper : "NULL"));
if (
spider_dbton[roop_count2].wrapper &&
!strcmp(share->tgt_wrappers[roop_count],
!strcasecmp(share->tgt_wrappers[roop_count],
spider_dbton[roop_count2].wrapper)
) {
if (spider_dbton[roop_count2].db_access_type ==

View file

@ -844,225 +844,6 @@ error_alloc_alter_table:
DBUG_RETURN(error_num);
}
bool spider_cmp_trx_alter_table(
SPIDER_ALTER_TABLE *cmp1,
SPIDER_ALTER_TABLE *cmp2
) {
int roop_count;
DBUG_ENTER("spider_cmp_trx_alter_table");
if (
cmp1->tmp_priority != cmp2->tmp_priority ||
cmp1->link_count != cmp2->link_count ||
cmp1->all_link_count != cmp2->all_link_count
)
DBUG_RETURN(TRUE);
for (roop_count = 0; roop_count < (int) cmp1->all_link_count; roop_count++)
{
if (
(
cmp1->tmp_server_names[roop_count] !=
cmp2->tmp_server_names[roop_count] &&
(
!cmp1->tmp_server_names[roop_count] ||
!cmp2->tmp_server_names[roop_count] ||
strcmp(cmp1->tmp_server_names[roop_count],
cmp2->tmp_server_names[roop_count])
)
) ||
(
cmp1->tmp_tgt_table_names[roop_count] !=
cmp2->tmp_tgt_table_names[roop_count] &&
(
!cmp1->tmp_tgt_table_names[roop_count] ||
!cmp2->tmp_tgt_table_names[roop_count] ||
strcmp(cmp1->tmp_tgt_table_names[roop_count],
cmp2->tmp_tgt_table_names[roop_count])
)
) ||
(
cmp1->tmp_tgt_dbs[roop_count] !=
cmp2->tmp_tgt_dbs[roop_count] &&
(
!cmp1->tmp_tgt_dbs[roop_count] ||
!cmp2->tmp_tgt_dbs[roop_count] ||
strcmp(cmp1->tmp_tgt_dbs[roop_count],
cmp2->tmp_tgt_dbs[roop_count])
)
) ||
(
cmp1->tmp_tgt_hosts[roop_count] !=
cmp2->tmp_tgt_hosts[roop_count] &&
(
!cmp1->tmp_tgt_hosts[roop_count] ||
!cmp2->tmp_tgt_hosts[roop_count] ||
strcmp(cmp1->tmp_tgt_hosts[roop_count],
cmp2->tmp_tgt_hosts[roop_count])
)
) ||
(
cmp1->tmp_tgt_usernames[roop_count] !=
cmp2->tmp_tgt_usernames[roop_count] &&
(
!cmp1->tmp_tgt_usernames[roop_count] ||
!cmp2->tmp_tgt_usernames[roop_count] ||
strcmp(cmp1->tmp_tgt_usernames[roop_count],
cmp2->tmp_tgt_usernames[roop_count])
)
) ||
(
cmp1->tmp_tgt_passwords[roop_count] !=
cmp2->tmp_tgt_passwords[roop_count] &&
(
!cmp1->tmp_tgt_passwords[roop_count] ||
!cmp2->tmp_tgt_passwords[roop_count] ||
strcmp(cmp1->tmp_tgt_passwords[roop_count],
cmp2->tmp_tgt_passwords[roop_count])
)
) ||
(
cmp1->tmp_tgt_sockets[roop_count] !=
cmp2->tmp_tgt_sockets[roop_count] &&
(
!cmp1->tmp_tgt_sockets[roop_count] ||
!cmp2->tmp_tgt_sockets[roop_count] ||
strcmp(cmp1->tmp_tgt_sockets[roop_count],
cmp2->tmp_tgt_sockets[roop_count])
)
) ||
(
cmp1->tmp_tgt_wrappers[roop_count] !=
cmp2->tmp_tgt_wrappers[roop_count] &&
(
!cmp1->tmp_tgt_wrappers[roop_count] ||
!cmp2->tmp_tgt_wrappers[roop_count] ||
strcmp(cmp1->tmp_tgt_wrappers[roop_count],
cmp2->tmp_tgt_wrappers[roop_count])
)
) ||
(
cmp1->tmp_tgt_ssl_cas[roop_count] !=
cmp2->tmp_tgt_ssl_cas[roop_count] &&
(
!cmp1->tmp_tgt_ssl_cas[roop_count] ||
!cmp2->tmp_tgt_ssl_cas[roop_count] ||
strcmp(cmp1->tmp_tgt_ssl_cas[roop_count],
cmp2->tmp_tgt_ssl_cas[roop_count])
)
) ||
(
cmp1->tmp_tgt_ssl_capaths[roop_count] !=
cmp2->tmp_tgt_ssl_capaths[roop_count] &&
(
!cmp1->tmp_tgt_ssl_capaths[roop_count] ||
!cmp2->tmp_tgt_ssl_capaths[roop_count] ||
strcmp(cmp1->tmp_tgt_ssl_capaths[roop_count],
cmp2->tmp_tgt_ssl_capaths[roop_count])
)
) ||
(
cmp1->tmp_tgt_ssl_certs[roop_count] !=
cmp2->tmp_tgt_ssl_certs[roop_count] &&
(
!cmp1->tmp_tgt_ssl_certs[roop_count] ||
!cmp2->tmp_tgt_ssl_certs[roop_count] ||
strcmp(cmp1->tmp_tgt_ssl_certs[roop_count],
cmp2->tmp_tgt_ssl_certs[roop_count])
)
) ||
(
cmp1->tmp_tgt_ssl_ciphers[roop_count] !=
cmp2->tmp_tgt_ssl_ciphers[roop_count] &&
(
!cmp1->tmp_tgt_ssl_ciphers[roop_count] ||
!cmp2->tmp_tgt_ssl_ciphers[roop_count] ||
strcmp(cmp1->tmp_tgt_ssl_ciphers[roop_count],
cmp2->tmp_tgt_ssl_ciphers[roop_count])
)
) ||
(
cmp1->tmp_tgt_ssl_keys[roop_count] !=
cmp2->tmp_tgt_ssl_keys[roop_count] &&
(
!cmp1->tmp_tgt_ssl_keys[roop_count] ||
!cmp2->tmp_tgt_ssl_keys[roop_count] ||
strcmp(cmp1->tmp_tgt_ssl_keys[roop_count],
cmp2->tmp_tgt_ssl_keys[roop_count])
)
) ||
(
cmp1->tmp_tgt_default_files[roop_count] !=
cmp2->tmp_tgt_default_files[roop_count] &&
(
!cmp1->tmp_tgt_default_files[roop_count] ||
!cmp2->tmp_tgt_default_files[roop_count] ||
strcmp(cmp1->tmp_tgt_default_files[roop_count],
cmp2->tmp_tgt_default_files[roop_count])
)
) ||
(
cmp1->tmp_tgt_default_groups[roop_count] !=
cmp2->tmp_tgt_default_groups[roop_count] &&
(
!cmp1->tmp_tgt_default_groups[roop_count] ||
!cmp2->tmp_tgt_default_groups[roop_count] ||
strcmp(cmp1->tmp_tgt_default_groups[roop_count],
cmp2->tmp_tgt_default_groups[roop_count])
)
) ||
(
cmp1->tmp_tgt_dsns[roop_count] !=
cmp2->tmp_tgt_dsns[roop_count] &&
(
!cmp1->tmp_tgt_dsns[roop_count] ||
!cmp2->tmp_tgt_dsns[roop_count] ||
strcmp(cmp1->tmp_tgt_dsns[roop_count],
cmp2->tmp_tgt_dsns[roop_count])
)
) ||
(
cmp1->tmp_tgt_filedsns[roop_count] !=
cmp2->tmp_tgt_filedsns[roop_count] &&
(
!cmp1->tmp_tgt_filedsns[roop_count] ||
!cmp2->tmp_tgt_filedsns[roop_count] ||
strcmp(cmp1->tmp_tgt_filedsns[roop_count],
cmp2->tmp_tgt_filedsns[roop_count])
)
) ||
(
cmp1->tmp_tgt_drivers[roop_count] !=
cmp2->tmp_tgt_drivers[roop_count] &&
(
!cmp1->tmp_tgt_drivers[roop_count] ||
!cmp2->tmp_tgt_drivers[roop_count] ||
strcmp(cmp1->tmp_tgt_drivers[roop_count],
cmp2->tmp_tgt_drivers[roop_count])
)
) ||
(
cmp1->tmp_static_link_ids[roop_count] !=
cmp2->tmp_static_link_ids[roop_count] &&
(
!cmp1->tmp_static_link_ids[roop_count] ||
!cmp2->tmp_static_link_ids[roop_count] ||
strcmp(cmp1->tmp_static_link_ids[roop_count],
cmp2->tmp_static_link_ids[roop_count])
)
) ||
cmp1->tmp_tgt_ports[roop_count] != cmp2->tmp_tgt_ports[roop_count] ||
cmp1->tmp_tgt_ssl_vscs[roop_count] !=
cmp2->tmp_tgt_ssl_vscs[roop_count] ||
cmp1->tmp_monitoring_binlog_pos_at_failing[roop_count] !=
cmp2->tmp_monitoring_binlog_pos_at_failing[roop_count] ||
cmp1->tmp_link_statuses[roop_count] !=
cmp2->tmp_link_statuses[roop_count]
)
DBUG_RETURN(TRUE);
}
DBUG_RETURN(FALSE);
}
int spider_free_trx_alloc(
SPIDER_TRX *trx
) {

View file

@ -67,11 +67,6 @@ int spider_create_trx_alter_table(
bool now_create
);
bool spider_cmp_trx_alter_table(
SPIDER_ALTER_TABLE *cmp1,
SPIDER_ALTER_TABLE *cmp2
);
SPIDER_TRX *spider_get_trx(
THD *thd,
bool regist_allocated_thds,