aboutsummaryrefslogtreecommitdiffstats
path: root/log_db/src
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-01-07 00:43:08 +0200
committerJan Tuomi <jan@jantuomi.fi>2025-01-07 00:43:08 +0200
commitbb64bc35beea7e0c46407b42a6240f084ccd137a (patch)
treed938950a895e0b1707c6a14d0f04f0ec675ab848 /log_db/src
parent3e1d169fe822f711bd96278e13cd89e2800c8927 (diff)
Move refresh_indexes out of do_maintenance_tasks, fix benches
Diffstat (limited to 'log_db/src')
-rw-r--r--log_db/src/common.rs2
-rw-r--r--log_db/src/lib.rs6
2 files changed, 4 insertions, 4 deletions
diff --git a/log_db/src/common.rs b/log_db/src/common.rs
index 4f5751d..8bdcd9a 100644
--- a/log_db/src/common.rs
+++ b/log_db/src/common.rs
@@ -216,7 +216,7 @@ impl MetadataHeader {
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum ReadConsistency {
/// Reads by client A are guaranteed to see writes by themselves and any writes by other clients B
- /// that were done before last index refresh.
+ /// that were done before last index refresh. You must call `refresh_indexes()` manually to refresh indexes.
Eventual,
/// Reads by client A are guaranteed to see all writes. This is slower: all reads must first
/// refresh indexes.
diff --git a/log_db/src/lib.rs b/log_db/src/lib.rs
index e9a25c1..4d9b82f 100644
--- a/log_db/src/lib.rs
+++ b/log_db/src/lib.rs
@@ -247,7 +247,9 @@ impl<R: Recordable> DB<R> {
Ok(db)
}
- fn refresh_indexes(&mut self) -> Result<(), DBError> {
+ /// Refresh the in-memory indexes from the log files.
+ /// This needs to only be called if the read consistency is set to `ReadConsistency::Eventual`.
+ pub fn refresh_indexes(&mut self) -> Result<(), DBError> {
let active_symlink_path = self.data_dir.join(ACTIVE_SYMLINK_FILENAME);
let active_target = fs::read_link(active_symlink_path)?;
let active_metadata_path = self.data_dir.join(active_target);
@@ -796,8 +798,6 @@ impl<R: Recordable> DB<R> {
self.active_metadata_file.unlock()?;
- self.refresh_indexes()?;
-
Ok(())
}