Skip to content

Commit

Permalink
mvfs: Check changelog instead of last_version
Browse files Browse the repository at this point in the history
  • Loading branch information
losfair committed Sep 10, 2022
1 parent b3c4e6d commit d297635
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions mvfs/src/vfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,25 +551,26 @@ impl Connection {
CommitOutput::Committed(result) => {
self.last_known_write_version = Some(result.version.clone());
let changelog = result.changelog.get(ns_key);
if result.last_version > read_version {
// Invalidate page cache
if let Some(changelog) = changelog {

// Invalidate page cache
if let Some(changelog) = changelog {
if !changelog.is_empty() {
for &index in changelog {
self.leaf_page_cache.pop_entry(&index);
self.high_priority_page_cache.pop_entry(&index);
}
tracing::info!(
count = changelog.len(),
"non-local concurrent transaction detected, performed partial cache flush"
);
} else {
// Changelog is not available - do a full flush
self.leaf_page_cache.clear();
self.high_priority_page_cache.clear();
tracing::warn!(
"non-local concurrent transaction detected, invalidating cache"
count = changelog.len(),
"non-local concurrent transaction detected, performed partial cache flush"
);
}
} else {
// Changelog is not available - do a full flush
self.leaf_page_cache.clear();
self.high_priority_page_cache.clear();
tracing::warn!(
"non-local concurrent transaction detected, invalidating cache"
);
}

self.txn = Some(
Expand All @@ -582,7 +583,6 @@ impl Connection {
duration = ?result.duration,
num_pages = result.num_pages,
read_version,
last_version = result.last_version,
"transaction committed");
}
CommitOutput::Conflict => {
Expand Down

0 comments on commit d297635

Please sign in to comment.