Skip to main content

CompactConfig

Struct CompactConfig 

Source
pub struct CompactConfig {
    pub max_space_amplification_percent: u16,
    pub min_bottom_merge_bytes: u64,
    pub max_files_above_bottom: usize,
    pub size_ratio_percent: u16,
    pub rewrite_per_fresh_byte: f32,
    pub max_merge_jobs: usize,
}
Expand description

Configuration for the compaction algorithm.

Fields§

§max_space_amplification_percent: u16

A shard is merged into a new bottom run when the files above its bottom run are larger than this percentage of the bottom run. E.g. 50 merges a shard with a 100MB bottom run once more than 50MB are above it. 0 merges every shard that has files above its bottom run.

§min_bottom_merge_bytes: u64

A shard is only merged into a new bottom run when at least this many bytes are above its bottom run. This is to avoid tiny families that always rewrite everything doing constant full merges and starving other work.

§max_files_above_bottom: usize

The files above the bottom run of a shard are merged when there are more than this many (at least one, since merging a single file would only move it).

§size_ratio_percent: u16

An intermediate merge takes the newest file above the bottom run, and then each next older one that is at most this percentage larger than the files taken so far, but at least the two newest. E.g. with 100, a file joins while it’s at most twice the size of the newer files combined. This is the size ratio of RocksDB’s universal compaction.

§rewrite_per_fresh_byte: f32

Bottom merges of a family are scheduled until they rewrote this many bytes per byte of its fresh files; the last one may go past it, and the first one always runs. E.g. with 3.0, after commits wrote 10MB to a family, no more bottom merges are scheduled once they rewrote 30MB, except for shards far behind.

§max_merge_jobs: usize

The maximum number of merge jobs in a compaction, across all families. Merge jobs run in parallel, so this bounds the work of a compaction. It doesn’t limit the number of files merged by a job.

Implementations§

Source§

impl CompactConfig

Source

pub fn full() -> Self

A config that merges every shard with files above its bottom run into a new bottom run.

Trait Implementations§

Source§

impl Clone for CompactConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for CompactConfig

Source§

impl Debug for CompactConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CompactConfig

Source§

fn default() -> Self

Returns the “default value” for a type. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more