diff --git a/include/wsrep/transaction.hpp b/include/wsrep/transaction.hpp index 2c71c28..eb31a0d 100644 --- a/include/wsrep/transaction.hpp +++ b/include/wsrep/transaction.hpp @@ -89,7 +89,7 @@ namespace wsrep bool ordered() const { return (ws_meta_.seqno().is_undefined() == false); } - /*! + /** * Return true if any fragments have been succesfully certified * for the transaction. */ @@ -98,6 +98,20 @@ namespace wsrep 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. */ @@ -210,6 +224,7 @@ namespace wsrep bool pa_unsafe_; bool implicit_deps_; bool certified_; + size_t fragments_certified_for_statement_; wsrep::streaming_context streaming_context_; wsrep::sr_key_set sr_keys_; }; diff --git a/src/transaction.cpp b/src/transaction.cpp index 003fd84..cb34682 100644 --- a/src/transaction.cpp +++ b/src/transaction.cpp @@ -104,6 +104,7 @@ wsrep::transaction::transaction( , pa_unsafe_(false) , implicit_deps_(false) , certified_(false) + , fragments_certified_for_statement_() , streaming_context_() , sr_keys_() { } @@ -760,7 +761,7 @@ int wsrep::transaction::after_statement() { cleanup(); } - + fragments_certified_for_statement_ = 0; debug_log_state("after_statement_leave"); assert(ret == 0 || state() == s_aborted); return ret; @@ -1143,6 +1144,7 @@ int wsrep::transaction::certify_fragment( switch (cert_ret) { case wsrep::provider::success: + ++fragments_certified_for_statement_; assert(sr_ws_meta.seqno().is_undefined() == false); streaming_context_.certified(data.size()); if (storage_service.update_fragment_meta(sr_ws_meta)) @@ -1329,6 +1331,7 @@ int wsrep::transaction::certify_commit( case wsrep::provider::success: assert(ordered()); certified_ = true; + ++fragments_certified_for_statement_; switch (state()) { case s_certifying: