mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-05 21:02:58 +00:00
feat: skip wal
This commit is contained in:
@@ -128,6 +128,9 @@ pub struct MitoConfig {
|
||||
/// To align with the old behavior, the default value is 0 (no restrictions).
|
||||
#[serde(with = "humantime_serde")]
|
||||
pub min_compaction_interval: Duration,
|
||||
|
||||
/// Skip wal
|
||||
pub skip_wal: bool,
|
||||
}
|
||||
|
||||
impl Default for MitoConfig {
|
||||
@@ -161,6 +164,7 @@ impl Default for MitoConfig {
|
||||
fulltext_index: FulltextIndexConfig::default(),
|
||||
memtable: MemtableConfig::default(),
|
||||
min_compaction_interval: Duration::from_secs(0),
|
||||
skip_wal: false,
|
||||
};
|
||||
|
||||
// Adjust buffer and cache size according to system memory if we can.
|
||||
|
||||
@@ -79,21 +79,23 @@ impl<S: LogStore> RegionWorkerLoop<S> {
|
||||
region_ctx.set_error(e);
|
||||
}
|
||||
}
|
||||
match wal_writer.write_to_wal().await.map_err(Arc::new) {
|
||||
Ok(response) => {
|
||||
for (region_id, region_ctx) in region_ctxs.iter_mut() {
|
||||
// Safety: the log store implementation ensures that either the `write_to_wal` fails and no
|
||||
// response is returned or the last entry ids for each region do exist.
|
||||
let last_entry_id = response.last_entry_ids.get(region_id).unwrap();
|
||||
region_ctx.set_next_entry_id(last_entry_id + 1);
|
||||
if !self.config.skip_wal {
|
||||
match wal_writer.write_to_wal().await.map_err(Arc::new) {
|
||||
Ok(response) => {
|
||||
for (region_id, region_ctx) in region_ctxs.iter_mut() {
|
||||
// Safety: the log store implementation ensures that either the `write_to_wal` fails and no
|
||||
// response is returned or the last entry ids for each region do exist.
|
||||
let last_entry_id = response.last_entry_ids.get(region_id).unwrap();
|
||||
region_ctx.set_next_entry_id(last_entry_id + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
// Failed to write wal.
|
||||
for mut region_ctx in region_ctxs.into_values() {
|
||||
region_ctx.set_error(e.clone());
|
||||
Err(e) => {
|
||||
// Failed to write wal.
|
||||
for mut region_ctx in region_ctxs.into_values() {
|
||||
region_ctx.set_error(e.clone());
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -897,6 +897,7 @@ sst_write_buffer_size = "8MiB"
|
||||
parallel_scan_channel_size = 32
|
||||
allow_stale_entries = false
|
||||
min_compaction_interval = "0s"
|
||||
skip_wal = false
|
||||
|
||||
[region_engine.mito.index]
|
||||
aux_path = ""
|
||||
|
||||
Reference in New Issue
Block a user