1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

Merge branch '10.6' into 10.11

This commit is contained in:
Sergei Golubchik
2024-04-22 11:00:03 +02:00
418 changed files with 7074 additions and 2930 deletions

View File

@@ -1617,6 +1617,29 @@ ha_check_and_coalesce_trx_read_only(THD *thd, Ha_trx_info *ha_list,
return rw_ha_count;
}
#ifdef WITH_WSREP
/**
Check if transaction contains storage engine not supporting
two-phase commit and transaction is read-write.
@retval
true Transaction contains storage engine not supporting
two phase commit and transaction is read-write
@retval
false otherwise
*/
static bool wsrep_have_no2pc_rw_ha(Ha_trx_info* ha_list)
{
for (Ha_trx_info *ha_info=ha_list; ha_info; ha_info= ha_info->next())
{
handlerton *ht= ha_info->ht();
// Transaction is read-write and handler does not support 2pc
if (ha_info->is_trx_read_write() && ht->prepare==0)
return true;
}
return false;
}
#endif /* WITH_WSREP */
/**
@retval
@@ -1829,14 +1852,18 @@ int ha_commit_trans(THD *thd, bool all)
*/
if (run_wsrep_hooks)
{
// This commit involves more than one storage engine and requires
// two phases, but some engines don't support it.
// Issue a message to the client and roll back the transaction.
if (trans->no_2pc && rw_ha_count > 1)
// This commit involves storage engines that do not support two phases.
// We allow read only transactions to such storage engines but not
// read write transactions.
if (trans->no_2pc && rw_ha_count > 1 && wsrep_have_no2pc_rw_ha(trans->ha_list))
{
// REPLACE|INSERT INTO ... SELECT uses TOI for MyISAM|Aria
if (WSREP(thd) && thd->wsrep_cs().mode() != wsrep::client_state::m_toi)
{
// This commit involves more than one storage engine and requires
// two phases, but some engines don't support it.
// Issue a message to the client and roll back the transaction.
// REPLACE|INSERT INTO ... SELECT uses TOI for MyISAM|Aria
if (WSREP(thd) && thd->wsrep_cs().mode() != wsrep::client_state::m_toi)
{
my_message(ER_ERROR_DURING_COMMIT, "Transactional commit not supported "
"by involved engine(s)", MYF(0));
error= 1;
@@ -5565,8 +5592,6 @@ handler::ha_create_partitioning_metadata(const char *name,
DBUG_ASSERT(m_lock_type == F_UNLCK ||
(!old_name && strcmp(name, table_share->path.str)));
mark_trx_read_write();
return create_partitioning_metadata(name, old_name, action_flag);
}
@@ -7648,7 +7673,16 @@ int handler::ha_write_row(const uchar *buf)
m_lock_type == F_WRLCK);
DBUG_ENTER("handler::ha_write_row");
DEBUG_SYNC_C("ha_write_row_start");
#ifdef WITH_WSREP
DBUG_EXECUTE_IF("wsrep_ha_write_row",
{
const char act[]=
"now "
"SIGNAL wsrep_ha_write_row_reached "
"WAIT_FOR wsrep_ha_write_row_continue";
DBUG_ASSERT(!debug_sync_set_action(ha_thd(), STRING_WITH_LEN(act)));
});
#endif /* WITH_WSREP */
if ((error= ha_check_overlaps(NULL, buf)))
DBUG_RETURN(error);