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

Count fragments certified for a statement.

The counter counts fragments which were succesfully certified since
the object construction or last after_statement() call.
This commit is contained in:
Teemu Ollakka
2019-02-14 23:50:41 +02:00
parent af8383daf0
commit 9c387ef82f
2 changed files with 20 additions and 2 deletions

View File

@ -89,7 +89,7 @@ namespace wsrep
bool ordered() const bool ordered() const
{ return (ws_meta_.seqno().is_undefined() == false); } { return (ws_meta_.seqno().is_undefined() == false); }
/*! /**
* Return true if any fragments have been succesfully certified * Return true if any fragments have been succesfully certified
* for the transaction. * for the transaction.
*/ */
@ -98,6 +98,20 @@ namespace wsrep
return (streaming_context_.fragments_certified() > 0); return (streaming_context_.fragments_certified() > 0);
} }
/**
* Return number of fragments certified for current statement.
*
* This counts fragments which have been succesfully certified
* since the construction of object or last after_statement()
* call.
*
* @return Number of fragments certified for current statement.
*/
size_t fragments_certified_for_statement() const
{
return fragments_certified_for_statement_;
}
/** /**
* Return true if transaction has not generated any changes. * Return true if transaction has not generated any changes.
*/ */
@ -210,6 +224,7 @@ namespace wsrep
bool pa_unsafe_; bool pa_unsafe_;
bool implicit_deps_; bool implicit_deps_;
bool certified_; bool certified_;
size_t fragments_certified_for_statement_;
wsrep::streaming_context streaming_context_; wsrep::streaming_context streaming_context_;
wsrep::sr_key_set sr_keys_; wsrep::sr_key_set sr_keys_;
}; };

View File

@ -104,6 +104,7 @@ wsrep::transaction::transaction(
, pa_unsafe_(false) , pa_unsafe_(false)
, implicit_deps_(false) , implicit_deps_(false)
, certified_(false) , certified_(false)
, fragments_certified_for_statement_()
, streaming_context_() , streaming_context_()
, sr_keys_() , sr_keys_()
{ } { }
@ -760,7 +761,7 @@ int wsrep::transaction::after_statement()
{ {
cleanup(); cleanup();
} }
fragments_certified_for_statement_ = 0;
debug_log_state("after_statement_leave"); debug_log_state("after_statement_leave");
assert(ret == 0 || state() == s_aborted); assert(ret == 0 || state() == s_aborted);
return ret; return ret;
@ -1143,6 +1144,7 @@ int wsrep::transaction::certify_fragment(
switch (cert_ret) switch (cert_ret)
{ {
case wsrep::provider::success: case wsrep::provider::success:
++fragments_certified_for_statement_;
assert(sr_ws_meta.seqno().is_undefined() == false); assert(sr_ws_meta.seqno().is_undefined() == false);
streaming_context_.certified(data.size()); streaming_context_.certified(data.size());
if (storage_service.update_fragment_meta(sr_ws_meta)) if (storage_service.update_fragment_meta(sr_ws_meta))
@ -1329,6 +1331,7 @@ int wsrep::transaction::certify_commit(
case wsrep::provider::success: case wsrep::provider::success:
assert(ordered()); assert(ordered());
certified_ = true; certified_ = true;
++fragments_certified_for_statement_;
switch (state()) switch (state())
{ {
case s_certifying: case s_certifying: