mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-31 18:24:25 +03:00
Fixes for XA transactions with streaming enabled
Changes mostly related to handling of XA PREPARE fragments
This commit is contained in:
committed by
Daniele Sciascia
parent
54b0eeee45
commit
36346beab4
@ -359,7 +359,7 @@ static int apply_write_set(wsrep::server_state& server_state,
|
||||
ws_meta,
|
||||
data);
|
||||
}
|
||||
else if (ws_meta.flags() == 0)
|
||||
else if (ws_meta.flags() == 0 || wsrep::prepares_transaction(ws_meta.flags()))
|
||||
{
|
||||
wsrep::high_priority_service* sa(
|
||||
server_state.find_streaming_applier(
|
||||
@ -380,8 +380,8 @@ static int apply_write_set(wsrep::server_state& server_state,
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = apply_fragment(server_state,
|
||||
high_priority_service,
|
||||
sa->next_fragment(ws_meta);
|
||||
ret = apply_fragment(high_priority_service,
|
||||
sa,
|
||||
ws_handle,
|
||||
ws_meta,
|
||||
@ -421,6 +421,7 @@ static int apply_write_set(wsrep::server_state& server_state,
|
||||
else
|
||||
{
|
||||
// Commit fragment consumes sa
|
||||
sa->next_fragment(ws_meta);
|
||||
ret = commit_fragment(server_state,
|
||||
high_priority_service,
|
||||
sa,
|
||||
|
@ -176,6 +176,16 @@ int wsrep::transaction::start_transaction(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wsrep::transaction::next_fragment(
|
||||
const wsrep::ws_meta& ws_meta)
|
||||
{
|
||||
debug_log_state("next_fragment enter");
|
||||
ws_meta_ = ws_meta;
|
||||
debug_log_state("next_fragment leave");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void wsrep::transaction::adopt(const wsrep::transaction& transaction)
|
||||
{
|
||||
debug_log_state("adopt enter");
|
||||
@ -1151,12 +1161,12 @@ int wsrep::transaction::streaming_step(wsrep::unique_lock<wsrep::mutex>& lock)
|
||||
break;
|
||||
}
|
||||
|
||||
if (streaming_context_.fragment_size_exceeded())
|
||||
if (streaming_context_.fragment_size_exceeded() || client_service_.is_xa_prepare())
|
||||
{
|
||||
// Some statements have no effect. Do not atttempt to
|
||||
// replicate a fragment if no data has been generated
|
||||
// since last fragment replication.
|
||||
if (bytes_to_replicate <= 0)
|
||||
// since last fragment replication, and statement is not XA PREPARE.
|
||||
if (bytes_to_replicate <= 0 && !client_service_.is_xa_prepare())
|
||||
{
|
||||
assert(bytes_to_replicate == 0);
|
||||
return ret;
|
||||
@ -1414,6 +1424,7 @@ int wsrep::transaction::certify_commit(
|
||||
}
|
||||
|
||||
flags(flags() | wsrep::provider::flag::commit);
|
||||
flags(flags() & ~wsrep::provider::flag::prepare);
|
||||
|
||||
if (client_service_.prepare_data_for_replication())
|
||||
{
|
||||
|
Reference in New Issue
Block a user