MySQL 9.1.0
Source Code Documentation
|
Logical timestamp generator for logical timestamping binlog transactions. More...
#include <rpl_trx_tracking.h>
Public Member Functions | |
Logical_clock () | |
Logical_clock (const Logical_clock &other) | |
int64 | step () |
Steps the absolute value of the clock (state) to return an updated value. More... | |
int64 | set_if_greater (int64 new_val) |
To try setting the clock forward. More... | |
int64 | get_timestamp () |
Atomically fetch the current state. More... | |
int64 | get_offset () |
void | update_offset (int64 new_offset) |
~Logical_clock ()=default | |
Private Attributes | |
std::atomic< int64 > | state |
int64 | offset |
Logical timestamp generator for logical timestamping binlog transactions.
A transaction is associated with two sequence numbers see Transaction_ctx::last_committed
and Transaction_ctx::sequence_number
. The class provides necessary interfaces including that of generating a next consecutive value for the latter.
Logical_clock::Logical_clock | ( | ) |
|
inline |
|
default |
|
inline |
|
inline |
Atomically fetch the current state.
To try setting the clock forward.
The clock does not change when the new value is in the past which is reflected by the new value and by offset. In other words the function main effects is described as state= max(state, new_value). Offset that exceeds the new value indicates the binary log rotation to render such new value useless.
new_val | a new value (offset included) |
|
inline |
Steps the absolute value of the clock (state) to return an updated value.
The caller must be sure to call the method in no concurrent execution context so either offset and state can't change.
|
inline |
|
private |
|
private |