Struct rocksdb::WriteBufferManager

source ·
pub struct WriteBufferManager(/* private fields */);

Implementations§

source§

impl WriteBufferManager

source

pub fn new_write_buffer_manager(buffer_size: size_t, allow_stall: bool) -> Self

https://github.com/facebook/rocksdb/wiki/Write-Buffer-Manager Write buffer manager helps users control the total memory used by memtables across multiple column families and/or DB instances. Users can enable this control by 2 ways:

1- Limit the total memtable usage across multiple column families and DBs under a threshold. 2- Cost the memtable memory usage to block cache so that memory of RocksDB can be capped by the single limit. The usage of a write buffer manager is similar to rate_limiter and sst_file_manager. Users can create one write buffer manager object and pass it to all the options of column families or DBs whose memtable size they want to be controlled by this object.

A memory limit is given when creating the write buffer manager object. RocksDB will try to limit the total memory to under this limit.

a flush will be triggered on one column family of the DB you are inserting to,

If mutable memtable size exceeds about 90% of the limit, If the total memory is over the limit, more aggressive flush may also be triggered only if the mutable memtable size also exceeds 50% of the limit. Both checks are needed because if already more than half memory is being flushed, triggering more flush may not help.

The total memory is counted as total memory allocated in the arena, even if some of that may not yet be used by memtable.

buffer_size: the memory limit in bytes. allow_stall: If set true, it will enable stalling of all writers when memory usage exceeds buffer_size (soft limit). It will wait for flush to complete and memory usage to drop down

source

pub fn new_write_buffer_manager_with_cache( buffer_size: size_t, allow_stall: bool, cache: Cache, ) -> Self

Users can set up RocksDB to cost memory used by memtables to block cache. This can happen no matter whether you enable memtable memory limit or not. This option is added to manage memory (memtables + block cache) under a single limit.

buffer_size: the memory limit in bytes. allow_stall: If set true, it will enable stalling of all writers when memory usage exceeds buffer_size (soft limit). It will wait for flush to complete and memory usage to drop down cache: the block cache instance

source

pub fn get_usage(&self) -> usize

Returns the WriteBufferManager memory usage in bytes.

source

pub fn get_buffer_size(&self) -> usize

Returns the current buffer size in bytes.

source

pub fn set_buffer_size(&self, new_size: usize)

Set the buffer size in bytes.

source

pub fn enabled(&self) -> bool

Returns if WriteBufferManager is enabled.

source

pub fn set_allow_stall(&self, allow_stall: bool)

set the allow_stall flag.

Trait Implementations§

source§

impl Clone for WriteBufferManager

source§

fn clone(&self) -> WriteBufferManager

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. 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§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

§

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>,

§

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>,

§

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.