1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-14 04:40:59 +03:00

Fixes to streaming rollback processing

* Count separately fragments certified and fragments stored in
  streaming context. Storing the fragment may ultimately fail
  due to BF abort even if the fragment was succesfully certified.
  Therefore we need to have separate counter for certified fragments
  to determine if the transaction is streaming and seqnos of fragments
  which have been succesfully stored.
* Provider release is called only after succesful fragment certification
  and fragment store.
* Fixed handling of write sets with rollback flag set in apply_write_set()
This commit is contained in:
Teemu Ollakka
2018-07-16 10:07:46 +03:00
parent 21ae2c849e
commit 9f153be277
5 changed files with 125 additions and 56 deletions

View File

@ -16,6 +16,7 @@
#include <string>
#include <vector>
#include <ostream>
namespace wsrep
{
@ -128,6 +129,16 @@ namespace wsrep
int flags_;
};
static inline
std::ostream& operator<<(std::ostream& os, const wsrep::ws_meta& ws_meta)
{
os << "gtid: " << ws_meta.gtid()
<< " server_id: " << ws_meta.server_id()
<< " client_id: " << ws_meta.client_id()
<< " trx_id: " << ws_meta.transaction_id()
<< " flags: " << ws_meta.flags();
return os;
}
// Abstract interface for provider implementations
class provider

View File

@ -24,7 +24,8 @@ namespace wsrep
};
streaming_context()
: fragments_()
: fragments_certified_()
, fragments_()
, rollback_replicated_for_()
, fragment_unit_()
, fragment_size_()
@ -51,22 +52,33 @@ namespace wsrep
fragment_size_ = 0;
}
void certified(wsrep::seqno seqno, size_t bytes)
void certified(size_t bytes)
{
fragments_.push_back(seqno);
++fragments_certified_;
bytes_certified_ += bytes;
}
void applied(wsrep::seqno seqno)
{
fragments_.push_back(seqno);
}
size_t fragments_certified() const
{
return fragments_certified_;
}
void stored(wsrep::seqno seqno)
{
fragments_.push_back(seqno);
}
size_t fragments_stored() const
{
return fragments_.size();
}
void applied(wsrep::seqno seqno)
{
++fragments_certified_;
fragments_.push_back(seqno);
}
size_t bytes_certified() const
{
return bytes_certified_;
@ -84,22 +96,36 @@ namespace wsrep
wsrep::transaction_id::undefined());
}
size_t unit_counter() const { return unit_counter_; }
size_t unit_counter() const
{
return unit_counter_;
}
void increment_unit_counter(size_t inc)
{ unit_counter_ += inc; }
void reset_unit_counter() { unit_counter_ = 0; }
{
unit_counter_ += inc;
}
void reset_unit_counter()
{
unit_counter_ = 0;
}
const std::vector<wsrep::seqno>& fragments() const
{
return fragments_;
}
void cleanup()
{
fragments_certified_ = 0;
fragments_.clear();
rollback_replicated_for_ = wsrep::transaction_id::undefined();
bytes_certified_ = 0;
unit_counter_ = 0;
}
private:
size_t fragments_certified_;
std::vector<wsrep::seqno> fragments_;
wsrep::transaction_id rollback_replicated_for_;
enum fragment_unit fragment_unit_;