Skip to main content

GroupCommitMaster

Struct GroupCommitMaster 

Source
pub struct GroupCommitMaster { /* private fields */ }
Expand description

Group-commit implementation for the Master role.

When a transaction arrives it is added to a pending queue. A leader thread waits for up to interval_ms milliseconds (or until max_count transactions are queued) before issuing a single fsync. After the fsync the queued transactions are acknowledged.

§Threshold semantics

buffer_commit() returns false (caller must fsync) every max_count calls — the count-based threshold. The caller (Txn::commit_with_durability) treats a false return as a signal to call LogManager::flush_sync(), which then handles the time-based coalescing via FSyncManager. This correctly separates concerns: GroupCommit enforces the batch-size policy; FSyncManager enforces the time-window and leader/waiter coalescing.

Implementations§

Source§

impl GroupCommitMaster

Source

pub fn new(max_count: usize, interval_ms: u64) -> Self

Creates a new GroupCommitMaster.

§Arguments
  • max_count — maximum batch size.
  • interval_ms — batch window in milliseconds MASTER_GROUP_COMMIT_INTERVAL).
Source

pub fn interval_ms(&self) -> u64

Returns the batch window in milliseconds.

Source

pub fn flush_count(&self) -> usize

Returns the number of times the count threshold has fired.

Used in tests to verify durability threshold enforcement.

Trait Implementations§

Source§

impl Default for GroupCommitMaster

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl GroupCommit for GroupCommitMaster

Source§

fn buffer_commit(&self, _commit_vlsn: i64) -> bool

Buffer a commit and enforce the count-based threshold.

Returns false (caller must fsync) on every max_countth call. Returns true (commit is buffered, skip fsync) otherwise.

Count-threshold path. The time-window threshold is handled by FSyncManager when the caller proceeds to LogManager::flush_sync() on a false return.

Source§

fn is_enabled(&self) -> bool

Returns true if group commit is currently enabled.
Source§

fn shutdown(&self)

Shuts down the group-commit background machinery. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.