Skip to content

Commit 671c3dc

Browse files
authored
Only use provisional values from the same revision (#1019)
1 parent 76e65b1 commit 671c3dc

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

src/function/fetch.rs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -195,26 +195,24 @@ where
195195
// existing provisional memo if it exists
196196
let memo_guard = self.get_memo_from_table_for(zalsa, id, memo_ingredient_index);
197197
if let Some(memo) = memo_guard {
198-
if memo.value.is_some() && memo.revisions.cycle_heads().contains(&database_key_index) {
199-
let can_shallow_update = self.shallow_verify_memo(zalsa, database_key_index, memo);
200-
if can_shallow_update.yes() {
201-
self.update_shallow(zalsa, database_key_index, memo, can_shallow_update);
202-
203-
if C::CYCLE_STRATEGY == CycleRecoveryStrategy::Fixpoint {
204-
memo.revisions
205-
.cycle_heads()
206-
.remove_all_except(database_key_index);
207-
}
198+
if memo.verified_at.load() == zalsa.current_revision()
199+
&& memo.value.is_some()
200+
&& memo.revisions.cycle_heads().contains(&database_key_index)
201+
{
202+
if C::CYCLE_STRATEGY == CycleRecoveryStrategy::Fixpoint {
203+
memo.revisions
204+
.cycle_heads()
205+
.remove_all_except(database_key_index);
206+
}
208207

209-
crate::tracing::debug!(
210-
"hit cycle at {database_key_index:#?}, \
208+
crate::tracing::debug!(
209+
"hit cycle at {database_key_index:#?}, \
211210
returning last provisional value: {:#?}",
212-
memo.revisions
213-
);
211+
memo.revisions
212+
);
214213

215-
// SAFETY: memo is present in memo_map.
216-
return unsafe { self.extend_memo_lifetime(memo) };
217-
}
214+
// SAFETY: memo is present in memo_map.
215+
return unsafe { self.extend_memo_lifetime(memo) };
218216
}
219217
}
220218

0 commit comments

Comments
 (0)