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

After statement result enum, is_autocommit() virtual method.

This commit is contained in:
Teemu Ollakka
2018-06-09 20:01:46 +03:00
parent 15f483ca7f
commit 2cecb3defe
5 changed files with 175 additions and 3 deletions

View File

@ -190,6 +190,21 @@ namespace wsrep
*/
int before_statement();
/*!
* Return values for after_statement() method.
*/
enum after_statement_result
{
/*! Statement was executed succesfully */
asr_success,
/*! Statement execution encountered an error, the transaction
* was rolled back */
asr_error,
/*! Statement execution encountered an error, the transaction
was rolled back. However the statement was self contained
(e.g. autocommit statement) so it can be retried. */
asr_may_retry
};
/*!
* After statement execution operations.
*
@ -199,7 +214,7 @@ namespace wsrep
* If overridden by the implementation, base class method
* should be called after any implementation specific operations.
*/
void after_statement();
enum after_statement_result after_statement();
int start_transaction()
{
@ -386,6 +401,7 @@ namespace wsrep
*/
void state(wsrep::unique_lock<wsrep::mutex>& lock, enum state state);
virtual bool is_autocommit() const = 0;
/*!
* Virtual method to return true if the client operates
* in two phase commit mode.

View File

@ -0,0 +1,137 @@
//
// Copyright (C) 2018 Codership Oy <info@codership.com>
//
/*! \file client_service.hpp
*
* This file will define a `callback` abstract interface for a
* DBMS client session service. The interface will define methods
* which will be called by the wsrep-lib under certain circumstances,
* for example when a transaction rollback is required by internal
* wsrep-lib operation or applier client needs to apply a write set.
*
* \todo Figure out better name for this interface.
*/
namespace wsrep
{
class client_service
{
public:
virtual bool is_autocommit() const = 0;
/*!
* Return true if two pahase commit is required for transaction
* to commit.
*/
virtual bool do_2pc() const = 0;
/*!
* Return true if the current transaction has been interrupted.
*/
virtual bool interrupted() const = 0;
/*!
* Reset possible global or thread local parameters associated
* to the thread.
*/
virtual void reset_globals() = 0;
/*!
* Store possible global or thread local parameters associated
* to the thread.
*/
virtual void store_globals() = 0;
/*!
* Set up a data for replication.
*/
virtual int prepare_data_for_replication(wsrep::data& data) = 0;
/*!
* Apply a write set.
*/
virtual int apply() = 0;
/*!
* Prepare a transaction for commit.
*/
virtual int prepare() = 0;
/*!
* Commit transaction.
*/
virtual int commit() = 0;
/*!
* Roll back transaction.
*/
virtual int rollback() = 0;
/*!
* Forcefully shut down the DBMS process or replication system.
* This may be called in situations where
* the process may encounter a situation where data integrity
* may not be guaranteed or other unrecoverable condition is
* encontered.
*/
virtual void emergency_shutdown() = 0;
// Replaying
/*!
* Notify that the client will replay.
*
* \todo This should not be visible to DBMS level, should be
* handled internally by wsrep-lib.
*/
virtual void will_replay() = 0;
/*!
* Replay the current transaction. The implementation must put
* the caller Client Context into applying mode and call
* client_context::replay().
*
* \todo This should not be visible to DBMS level, should be
* handled internally by wsrep-lib.
*/
virtual int replay() = 0;
/*!
* Wait until all replaying transactions have been finished
* replaying.
*
* \todo This should not be visible to DBMS level, should be
* handled internally by wsrep-lib.
*/
virtual void wait_for_replayers() = 0;
// Streaming replication
/*!
* Append a write set fragment into fragment storage.
*/
virtual int append_fragment() = 0;
};
/*!
* Debug callback methods. These methods are called only in
* builds that have WITH_DEBUG defined.
*/
class client_debug_callback
{
public:
/*!
* Enter debug sync point.
*
* @params sync_point Name of the debug sync point.
*/
void debug_sync(const char* sync_point) = 0;
/*!
* Forcefully kill the process if the suicide_point has
* been enabled.
*/
void debug_suicide(const char* suicide_point) = 0;
};
}