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:
@ -105,14 +105,29 @@ int wsrep::client_context::before_statement()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wsrep::client_context::after_statement()
|
||||
enum wsrep::client_context::after_statement_result
|
||||
wsrep::client_context::after_statement()
|
||||
{
|
||||
// wsrep::unique_lock<wsrep::mutex> lock(mutex_);
|
||||
assert(state() == s_exec);
|
||||
#if 0
|
||||
/*!
|
||||
* \todo Check for replay state, do rollback if requested.
|
||||
*/
|
||||
#endif // 0
|
||||
(void)transaction_.after_statement();
|
||||
int ret(transaction_.after_statement());
|
||||
if (ret)
|
||||
{
|
||||
if (is_autocommit())
|
||||
{
|
||||
return asr_may_retry;
|
||||
}
|
||||
else
|
||||
{
|
||||
return asr_error;
|
||||
}
|
||||
}
|
||||
return asr_success;
|
||||
}
|
||||
|
||||
// Private
|
||||
|
@ -336,6 +336,7 @@ public:
|
||||
return stats_;
|
||||
}
|
||||
private:
|
||||
bool is_autocommit() const override { return false; }
|
||||
bool do_2pc() const override { return false; }
|
||||
int apply(const wsrep::data& data) override
|
||||
{
|
||||
|
@ -22,6 +22,7 @@ namespace wsrep
|
||||
// Note: Mutex is initialized only after passed
|
||||
// to client_context constructor.
|
||||
, mutex_()
|
||||
, is_autocommit_(false)
|
||||
, do_2pc_(do_2pc)
|
||||
, fail_next_applying_()
|
||||
{ }
|
||||
@ -35,6 +36,7 @@ namespace wsrep
|
||||
int apply(const wsrep::data&);
|
||||
int commit();
|
||||
int rollback();
|
||||
bool is_autocommit() const { return is_autocommit_; }
|
||||
bool do_2pc() const { return do_2pc_; }
|
||||
void will_replay(wsrep::transaction_context&) WSREP_OVERRIDE { }
|
||||
int replay(wsrep::transaction_context& tc) WSREP_OVERRIDE
|
||||
@ -61,6 +63,7 @@ namespace wsrep
|
||||
{ fail_next_applying_ = fail_next_applying; }
|
||||
private:
|
||||
wsrep::default_mutex mutex_;
|
||||
bool is_autocommit_;
|
||||
bool do_2pc_;
|
||||
bool fail_next_applying_;
|
||||
};
|
||||
|
Reference in New Issue
Block a user