pub struct RegionWriterConfig {Show 16 fields
pub region_id: Uuid,
pub region_spec_id: u32,
pub durable_write: bool,
pub sync_indexed_write: bool,
pub max_wal_buffer_size: usize,
pub max_wal_flush_interval: Option<Duration>,
pub max_memtable_size: usize,
pub max_memtable_rows: usize,
pub max_memtable_batches: usize,
pub ivf_index_partition_capacity_safety_factor: usize,
pub manifest_scan_batch_size: usize,
pub max_unflushed_memtable_bytes: usize,
pub backpressure_log_interval: Duration,
pub async_index_buffer_rows: usize,
pub async_index_interval: Duration,
pub stats_log_interval: Option<Duration>,
}Expand description
Configuration for a region writer.
Fields§
§region_id: UuidUnique identifier for this region (UUID v4).
region_spec_id: u32Region spec ID this region was created with. A value of 0 indicates a manually-created region not governed by any spec.
durable_write: boolWhether to wait for WAL flush before returning from writes.
When true (durable writes):
- Each write waits for WAL persistence before returning
- Guarantees no data loss on crash
- Higher latency due to object storage writes
When false (non-durable writes):
- Writes return immediately after buffering in memory
- Potential data loss if process crashes before flush
- Lower latency, batched S3 operations
sync_indexed_write: boolWhether to update indexes synchronously on each write.
When true:
- Newly written data is immediately searchable via indexes
- Higher latency due to index update overhead
When false:
- Index updates are deferred
- New data may not appear in index-accelerated queries immediately
max_wal_buffer_size: usizeMaximum WAL buffer size in bytes before triggering a flush.
This is a soft threshold - write batches are atomic and won’t be split.
WAL flushes when buffer exceeds this size OR when max_wal_flush_interval elapses.
Default: 10MB
max_wal_flush_interval: Option<Duration>Time-based WAL flush interval.
WAL buffer will be flushed after this duration even if size threshold hasn’t been reached. This ensures bounded data loss window in non-durable mode and prevents accumulating too much data before flushing to object storage. Default: 100ms
max_memtable_size: usizeMaximum MemTable size in bytes before triggering a flush to storage.
MemTable size is checked every max_wal_flush_interval (during WAL flush ticks).
Default: 256MB
max_memtable_rows: usizeMaximum number of rows in a MemTable.
Used to pre-allocate index storage (e.g., IVF-PQ partition capacity). When a partition reaches capacity, memtable will be flushed. Default: 100,000 rows
max_memtable_batches: usizeMaximum number of batches in a MemTable.
Used to pre-allocate batch storage. When this limit is reached, memtable will be flushed. Sized for typical ML workloads with 1024-dim vectors (~82KB per 20-row batch). Default: 8,000 batches
ivf_index_partition_capacity_safety_factor: usizeSafety factor for IVF-PQ index partition capacity calculation.
Accounts for non-uniform distribution of vectors across partitions. Higher values use more memory but reduce overflow risk. Partition capacity = min((max_rows / num_partitions) * safety_factor, max_rows) Default: 8
manifest_scan_batch_size: usizeBatch size for parallel HEAD requests when scanning for manifest versions.
Higher values scan faster but use more parallel requests. Default: 2
max_unflushed_memtable_bytes: usizeMaximum unflushed bytes before applying backpressure.
When total unflushed data (active memtable + frozen memtables) exceeds this, new writes will block until some data is flushed to storage. This prevents unbounded memory growth during write spikes.
Default: 1GB
backpressure_log_interval: DurationInterval for logging warnings when writes are blocked by backpressure.
When a write is blocked waiting for WAL flush, memtable flush, or index updates to complete, a warning is logged after this duration. The write will continue waiting indefinitely (it never fails due to backpressure), but warnings are logged at this interval to help diagnose slow flushes.
Default: 30 seconds
async_index_buffer_rows: usizeMaximum rows to buffer before flushing to async indexes.
Only applies when sync_indexed_write is false. Larger values enable
better vectorization (especially for IVF-PQ) but increase memory usage
and latency before data becomes searchable.
Default: 10,000 rows
async_index_interval: DurationMaximum time to buffer before flushing to async indexes.
Only applies when sync_indexed_write is false. Ensures bounded latency
for data to become searchable even during low write throughput.
Default: 1 second
stats_log_interval: Option<Duration>Interval for periodic stats logging.
Stats (write throughput, backpressure events, memtable size) are logged at this interval. Set to None to disable periodic stats logging.
Default: 60 seconds
Implementations§
Source§impl RegionWriterConfig
impl RegionWriterConfig
Sourcepub fn with_region_spec_id(self, spec_id: u32) -> Self
pub fn with_region_spec_id(self, spec_id: u32) -> Self
Set the region spec ID.
Sourcepub fn with_durable_write(self, durable: bool) -> Self
pub fn with_durable_write(self, durable: bool) -> Self
Set durable writes mode.
Sourcepub fn with_sync_indexed_write(self, indexed: bool) -> Self
pub fn with_sync_indexed_write(self, indexed: bool) -> Self
Set indexed writes mode.
Sourcepub fn with_max_wal_buffer_size(self, size: usize) -> Self
pub fn with_max_wal_buffer_size(self, size: usize) -> Self
Set maximum WAL buffer size.
Sourcepub fn with_max_wal_flush_interval(self, interval: Duration) -> Self
pub fn with_max_wal_flush_interval(self, interval: Duration) -> Self
Set maximum flush interval.
Sourcepub fn with_max_memtable_size(self, size: usize) -> Self
pub fn with_max_memtable_size(self, size: usize) -> Self
Set maximum MemTable size.
Sourcepub fn with_max_memtable_rows(self, rows: usize) -> Self
pub fn with_max_memtable_rows(self, rows: usize) -> Self
Set maximum MemTable rows for index pre-allocation.
Sourcepub fn with_max_memtable_batches(self, batches: usize) -> Self
pub fn with_max_memtable_batches(self, batches: usize) -> Self
Set maximum MemTable batches for batch store pre-allocation.
Sourcepub fn with_ivf_index_partition_capacity_safety_factor(
self,
factor: usize,
) -> Self
pub fn with_ivf_index_partition_capacity_safety_factor( self, factor: usize, ) -> Self
Set partition capacity safety factor for IVF-PQ indexes.
Sourcepub fn with_manifest_scan_batch_size(self, size: usize) -> Self
pub fn with_manifest_scan_batch_size(self, size: usize) -> Self
Set manifest scan batch size.
Sourcepub fn with_max_unflushed_memtable_bytes(self, size: usize) -> Self
pub fn with_max_unflushed_memtable_bytes(self, size: usize) -> Self
Set maximum unflushed bytes for backpressure.
Sourcepub fn with_backpressure_log_interval(self, interval: Duration) -> Self
pub fn with_backpressure_log_interval(self, interval: Duration) -> Self
Set backpressure log interval.
Sourcepub fn with_async_index_buffer_rows(self, rows: usize) -> Self
pub fn with_async_index_buffer_rows(self, rows: usize) -> Self
Set async index buffer rows.
Sourcepub fn with_async_index_interval(self, interval: Duration) -> Self
pub fn with_async_index_interval(self, interval: Duration) -> Self
Set async index interval.
Sourcepub fn with_stats_log_interval(self, interval: Option<Duration>) -> Self
pub fn with_stats_log_interval(self, interval: Option<Duration>) -> Self
Set stats logging interval. Use None to disable periodic stats logging.
Trait Implementations§
Source§impl Clone for RegionWriterConfig
impl Clone for RegionWriterConfig
Source§fn clone(&self) -> RegionWriterConfig
fn clone(&self) -> RegionWriterConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RegionWriterConfig
impl Debug for RegionWriterConfig
Auto Trait Implementations§
impl Freeze for RegionWriterConfig
impl RefUnwindSafe for RegionWriterConfig
impl Send for RegionWriterConfig
impl Sync for RegionWriterConfig
impl Unpin for RegionWriterConfig
impl UnsafeUnpin for RegionWriterConfig
impl UnwindSafe for RegionWriterConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.