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

@ -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

View File

@ -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
{

View File

@ -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_;
};