Skip to content

Commit

Permalink
feat: skip read-only region when trying to flush on region full (#3966)
Browse files Browse the repository at this point in the history
* feat: skip read-only region when trying to flush on region full

Signed-off-by: Ruihang Xia <[email protected]>

* improve log

Signed-off-by: Ruihang Xia <[email protected]>

* also skip in periodically

Signed-off-by: Ruihang Xia <[email protected]>

---------

Signed-off-by: Ruihang Xia <[email protected]>
  • Loading branch information
waynexia authored May 16, 2024
1 parent 4b03045 commit 5c0a530
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/mito2/src/compaction/twcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ impl TwcsCompactionTask {
compacted_inputs.extend(output.inputs.iter().map(FileHandle::meta));

info!(
"Compaction region {} output [{}]-> {}",
"Compaction region {}. Input [{}] -> output {}",
self.region_id,
output
.inputs
Expand Down
6 changes: 3 additions & 3 deletions src/mito2/src/flush.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use std::collections::HashMap;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;

use common_telemetry::{error, info};
use common_telemetry::{debug, error, info};
use smallvec::SmallVec;
use snafu::ResultExt;
use store_api::storage::RegionId;
Expand Down Expand Up @@ -118,7 +118,7 @@ impl WriteBufferManager for WriteBufferManagerImpl {
fn should_flush_engine(&self) -> bool {
let mutable_memtable_memory_usage = self.memory_active.load(Ordering::Relaxed);
if mutable_memtable_memory_usage > self.mutable_limit {
info!(
debug!(
"Engine should flush (over mutable limit), mutable_usage: {}, memory_usage: {}, mutable_limit: {}, global_limit: {}",
mutable_memtable_memory_usage, self.memory_usage(), self.mutable_limit, self.global_write_buffer_size,
);
Expand All @@ -132,7 +132,7 @@ impl WriteBufferManager for WriteBufferManagerImpl {
if memory_usage >= self.global_write_buffer_size
&& mutable_memtable_memory_usage >= self.global_write_buffer_size / 2
{
info!(
debug!(
"Engine should flush (over total limit), memory_usage: {}, global_write_buffer_size: {}, \
mutable_usage: {}.",
memory_usage,
Expand Down
8 changes: 4 additions & 4 deletions src/mito2/src/worker/handle_flush.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ impl<S> RegionWorkerLoop<S> {
let mut max_mem_region = None;

for region in &regions {
if self.flush_scheduler.is_flush_requested(region.region_id) {
// Already flushing.
if self.flush_scheduler.is_flush_requested(region.region_id) || !region.is_writable() {
// Already flushing or not writable.
continue;
}

Expand Down Expand Up @@ -134,8 +134,8 @@ impl<S> RegionWorkerLoop<S> {
let min_last_flush_time = now - self.config.auto_flush_interval.as_millis() as i64;

for region in &regions {
if self.flush_scheduler.is_flush_requested(region.region_id) {
// Already flushing.
if self.flush_scheduler.is_flush_requested(region.region_id) || !region.is_writable() {
// Already flushing or not writable.
continue;
}

Expand Down

0 comments on commit 5c0a530

Please sign in to comment.