Skip to content

Commit

Permalink
feat: remove memtable builder from freeze
Browse files Browse the repository at this point in the history
  • Loading branch information
evenyag committed Feb 4, 2024
1 parent bb7ce4e commit edaa8ee
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
11 changes: 3 additions & 8 deletions src/mito2/src/flush.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ use crate::config::MitoConfig;
use crate::error::{
Error, FlushRegionSnafu, RegionClosedSnafu, RegionDroppedSnafu, RegionTruncatedSnafu, Result,
};
use crate::memtable::MemtableBuilderRef;
use crate::metrics::{FLUSH_BYTES_TOTAL, FLUSH_ELAPSED, FLUSH_ERRORS_TOTAL, FLUSH_REQUESTS_TOTAL};
use crate::read::Source;
use crate::region::version::{VersionControlData, VersionControlRef, VersionRef};
Expand Down Expand Up @@ -197,7 +196,6 @@ pub(crate) struct RegionFlushTask {
pub(crate) request_sender: mpsc::Sender<WorkerRequest>,

pub(crate) access_layer: AccessLayerRef,
pub(crate) memtable_builder: MemtableBuilderRef,
pub(crate) file_purger: FilePurgerRef,
pub(crate) listener: WorkerListener,
pub(crate) engine_config: Arc<MitoConfig>,
Expand Down Expand Up @@ -461,11 +459,9 @@ impl FlushScheduler {
}

// Now we can flush the region directly.
version_control
.freeze_mutable(&task.memtable_builder)
.inspect(|e| {
error!(e; "Failed to freeze the mutable memtable for region {}", region_id);
})?;
version_control.freeze_mutable().inspect(|e| {
error!(e; "Failed to freeze the mutable memtable for region {}", region_id);
})?;
// Submit a flush job.
let job = task.into_flush_job(version_control);
if let Err(e) = self.scheduler.schedule(job) {
Expand Down Expand Up @@ -764,7 +760,6 @@ mod tests {
senders: Vec::new(),
request_sender: tx,
access_layer: env.access_layer.clone(),
memtable_builder: builder.memtable_builder(),
file_purger: builder.file_purger(),
listener: WorkerListener::default(),
engine_config: Arc::new(MitoConfig::default()),
Expand Down
2 changes: 1 addition & 1 deletion src/mito2/src/region/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl VersionControl {
}

/// Freezes the mutable memtable if it is not empty.
pub(crate) fn freeze_mutable(&self, _builder: &MemtableBuilderRef) -> Result<()> {
pub(crate) fn freeze_mutable(&self) -> Result<()> {
let version = self.current().version;
if version.memtables.mutable.is_empty() {
return Ok(());
Expand Down
1 change: 0 additions & 1 deletion src/mito2/src/worker/handle_flush.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ impl<S> RegionWorkerLoop<S> {
senders: Vec::new(),
request_sender: self.sender.clone(),
access_layer: region.access_layer.clone(),
memtable_builder: self.memtable_builder.clone(),
file_purger: region.file_purger.clone(),
listener: self.listener.clone(),
engine_config,
Expand Down

0 comments on commit edaa8ee

Please sign in to comment.