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

Remove tracking of log_position

This patch removes log_position from streaming_context. The
log_position was meant for keeping track of the database specific
position corresponding to the changes that have been already
replicated by a streaming transaction. In reality, things may be more
complex in the DBMS side and a size_t may be unsufficient to keep
track of the progress of a streaming transaction. For example, in
MariaDB, it may be necessary to keep track of positions in both
transaction and statement caches. Suggesting that the responsibility
of tracking these position(s) should be delegated to client_service.
The log_position was also used to do sanity checks in
streaming_step(). Those sanity checks are preserved by simply keeping
track of the number of bytes that were certified by the streaming
transaction.
This commit is contained in:
Daniele Sciascia
2023-11-10 10:00:26 +01:00
parent a5d95f0175
commit 096b5c5c7a
6 changed files with 31 additions and 44 deletions

View File

@ -88,17 +88,13 @@ namespace wsrep
/**
* Prepare a buffer containing data for the next fragment to replicate.
* The caller may set log_position to record the database specific
* position corresponding to changes contained in the buffer.
* When the call returns, the log_position will be available to read
* from streaming_context::log_position().
*
* @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& buffer,
size_t& log_position) = 0;
virtual int
prepare_fragment_for_replication(wsrep::mutable_buffer& buffer) = 0;
/**
* Remove fragments from the storage within current transaction.

View File

@ -42,12 +42,12 @@ namespace wsrep
streaming_context()
: fragments_certified_()
, bytes_certified_()
, fragments_()
, rollback_replicated_for_()
, fragment_unit_()
, fragment_size_()
, unit_counter_()
, log_position_()
{ }
/**
@ -78,10 +78,14 @@ namespace wsrep
/** Disable streaming replication. */
void disable();
/** Increment counter for certified fragments. */
void certified()
/**
* Increment counter for certified fragments and total
* number of bytes.
*/
void certified(size_t bytes)
{
++fragments_certified_;
bytes_certified_ += bytes;
}
/** Return number of certified fragments. */
@ -90,6 +94,12 @@ namespace wsrep
return fragments_certified_;
}
/** Return total number of bytes replicated. */
size_t bytes_certified() const
{
return bytes_certified_;
}
/** Mark fragment with seqno as stored in fragment store. */
void stored(wsrep::seqno seqno);
@ -137,18 +147,6 @@ namespace wsrep
unit_counter_ = 0;
}
/** Return current log position. */
size_t log_position() const
{
return log_position_;
}
/** Set log position. */
void set_log_position(size_t position)
{
log_position_ = position;
}
/** Return vector of stored fragments. */
const std::vector<wsrep::seqno>& fragments() const
{
@ -168,12 +166,12 @@ namespace wsrep
void check_fragment_seqno(wsrep::seqno seqno);
size_t fragments_certified_;
size_t bytes_certified_;
std::vector<wsrep::seqno> fragments_;
wsrep::transaction_id rollback_replicated_for_;
enum fragment_unit fragment_unit_;
size_t fragment_size_;
size_t unit_counter_;
size_t log_position_;
};
}