mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-28 20:02:00 +03:00
Fix attempt to replicate empty fragments
* Adds method wsrep::transaction::streaming_step() so that there is a single place where streaming context unit counter is udpated. The method also checks that some data has been generated before attempting fragment replication. * Emit a warning if there is an attempt to replicate a fragment and there is no data to replicate.
This commit is contained in:
@ -86,8 +86,22 @@ namespace wsrep
|
||||
* otherwise false.
|
||||
*/
|
||||
virtual bool statement_allowed_for_streaming() const = 0;
|
||||
|
||||
/**
|
||||
* Return the total number of bytes generated by the transaction
|
||||
* context.
|
||||
*/
|
||||
virtual size_t bytes_generated() const = 0;
|
||||
|
||||
/**
|
||||
* Prepare a buffer containing data for the next fragment to replicate.
|
||||
*
|
||||
* @return Zero in case of success, non-zero on failure.
|
||||
* If there is no data to replicate, the method shall return
|
||||
* zero and leave the buffer empty.
|
||||
*/
|
||||
virtual int prepare_fragment_for_replication(wsrep::mutable_buffer&) = 0;
|
||||
|
||||
/**
|
||||
* Remove fragments from the storage within current transaction.
|
||||
* Fragment removal will be committed once the current transaction
|
||||
@ -115,7 +129,6 @@ namespace wsrep
|
||||
//
|
||||
// Interface to global server state
|
||||
//
|
||||
|
||||
/**
|
||||
* Forcefully shut down the DBMS process or replication system.
|
||||
* This may be called in situations where
|
||||
|
@ -118,6 +118,11 @@ namespace wsrep
|
||||
return unit_counter_;
|
||||
}
|
||||
|
||||
void set_unit_counter(size_t count)
|
||||
{
|
||||
unit_counter_ = count;
|
||||
}
|
||||
|
||||
void increment_unit_counter(size_t inc)
|
||||
{
|
||||
unit_counter_ += inc;
|
||||
@ -133,6 +138,11 @@ namespace wsrep
|
||||
return fragments_;
|
||||
}
|
||||
|
||||
bool fragment_size_exceeded() const
|
||||
{
|
||||
return unit_counter_ >= fragment_size_;
|
||||
}
|
||||
|
||||
void cleanup()
|
||||
{
|
||||
fragments_certified_ = 0;
|
||||
|
@ -183,6 +183,7 @@ namespace wsrep
|
||||
|
||||
wsrep::provider& provider();
|
||||
void flags(int flags) { flags_ = flags; }
|
||||
int streaming_step(wsrep::unique_lock<wsrep::mutex>&);
|
||||
int certify_fragment(wsrep::unique_lock<wsrep::mutex>&);
|
||||
int certify_commit(wsrep::unique_lock<wsrep::mutex>&);
|
||||
int append_sr_keys_for_commit();
|
||||
|
Reference in New Issue
Block a user