1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-28 20:02:00 +03:00

Unit tests for SR with two statements, SR rollback.

This commit is contained in:
Teemu Ollakka
2018-06-13 10:18:46 +03:00
parent 292072bf56
commit 265d9b3322
10 changed files with 140 additions and 16 deletions

View File

@ -229,6 +229,12 @@ namespace wsrep
return transaction_.start_transaction(wsh, meta);
}
void adopt_transaction(wsrep::transaction_context& transaction)
{
transaction_.start_transaction(transaction.id());
transaction_.streaming_context_ = transaction.streaming_context_;
}
void enable_streaming(
enum wsrep::transaction_context::streaming_context::fragment_unit fragment_unit,
size_t fragment_size)

View File

@ -30,6 +30,9 @@ namespace wsrep
}
};
class fatal_error : public std::exception
{
};
}

View File

@ -66,6 +66,7 @@
#include <vector>
#include <string>
#include <map>
namespace wsrep
{
@ -74,7 +75,9 @@ namespace wsrep
class ws_meta;
class provider;
class client_context;
class transaction_id;
class transaction_context;
class id;
class gtid;
class view;
class const_buffer;
@ -198,6 +201,23 @@ namespace wsrep
*/
virtual client_context* local_client_context() = 0;
/*!
* Create applier context for streaming transaction.
*
* \param server_id Server id of the origin of the SR transaction.
* \param transaction_id Transaction ID of the SR transaction on the
* origin server.
*/
virtual client_context& streaming_applier_client_context(
const wsrep::id& server_id,
const wsrep::transaction_id& transaction_id
) = 0;
void insert_streaming_applier(
const wsrep::id&,
const wsrep::transaction_id&,
wsrep::client_context* client_context);
/*!
* Load WSRep provider.
*
@ -383,6 +403,7 @@ namespace wsrep
, cond_(cond)
, state_(s_disconnected)
, state_waiters_(n_states_)
, streaming_appliers_()
, provider_()
, name_(name)
, id_(id)
@ -403,6 +424,8 @@ namespace wsrep
wsrep::condition_variable& cond_;
enum state state_;
mutable std::vector<int> state_waiters_;
typedef std::map<std::pair<wsrep::id, wsrep::transaction_id>, wsrep::client_context*> streaming_appliers_map;
streaming_appliers_map streaming_appliers_;
wsrep::provider* provider_;
std::string name_;
std::string id_;

View File

@ -135,6 +135,7 @@ namespace wsrep
void flags(int flags) { flags_ = flags; }
int certify_fragment(wsrep::unique_lock<wsrep::mutex>&);
int certify_commit(wsrep::unique_lock<wsrep::mutex>&);
void streaming_rollback();
void clear_fragments();
void cleanup();
void debug_log_state(const char*) const;