-
Notifications
You must be signed in to change notification settings - Fork 201
allow reuse of cached provisional memos within the same cycle iteration during maybe_changed_after
#954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
MichaReiser
merged 14 commits into
salsa-rs:master
from
MichaReiser:micha/runaway-maybe-changed-after
Aug 5, 2025
Merged
allow reuse of cached provisional memos within the same cycle iteration during maybe_changed_after
#954
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5515cb8
Allow `validate_same_iteration` slow path for `maybe_changed_after`
MichaReiser 35a0782
Add logging to cycle_panic test and enable output capture for debugging
MichaReiser fb62733
Add RUST_LOG=trace to CI for detailed tracing output
MichaReiser af87215
Possible fix
MichaReiser 66056eb
Discard changes to .github/workflows/test.yml
MichaReiser 0497594
Delete logs/.eb4cbc62113c2d27a93f1a2e33d842313ed0aa05-audit.json
MichaReiser de885f1
Delete logs/mcp-puppeteer-2025-08-02.log
MichaReiser 336237a
docs
MichaReiser c67b154
Add regression test
MichaReiser 7d499a7
Discard changes to tests/parallel/cycle_panic.rs
MichaReiser 439c884
Discard changes to Cargo.toml
MichaReiser c2f4827
Fix comment
MichaReiser e355c2e
Discard changes to Cargo.toml
MichaReiser 3c06ee4
Update src/function/maybe_changed_after.rs
MichaReiser File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1025,3 +1025,42 @@ fn repeat_provisional_query() { | |
| "salsa_event(WillExecute { database_key: min_panic(Id(2)) })", | ||
| ]"#]]); | ||
| } | ||
|
|
||
| #[test] | ||
| fn repeat_provisional_query_incremental() { | ||
| let mut db = ExecuteValidateLoggerDatabase::default(); | ||
| let a_in = Inputs::new(&db, vec![]); | ||
| let b_in = Inputs::new(&db, vec![]); | ||
| let c_in = Inputs::new(&db, vec![]); | ||
| let a = Input::MinIterate(a_in); | ||
| let b = Input::MinPanic(b_in); | ||
| let c = Input::MinPanic(c_in); | ||
| a_in.set_inputs(&mut db).to(vec![value(59), b.clone()]); | ||
| b_in.set_inputs(&mut db) | ||
| .to(vec![value(60), c.clone(), c.clone(), c]); | ||
| c_in.set_inputs(&mut db).to(vec![a.clone()]); | ||
|
|
||
| a.assert_value(&db, 59); | ||
|
|
||
| db.clear_logs(); | ||
|
|
||
| c_in.set_inputs(&mut db).to(vec![a.clone()]); | ||
|
|
||
| a.assert_value(&db, 59); | ||
|
|
||
| // `min_panic(Id(2)) should only twice: | ||
| // * Once before iterating | ||
| // * Once as part of iterating | ||
| // | ||
| // If it runs more than once before iterating, than this suggests that | ||
| // `validate_same_iteration` incorrectly returns `false`. | ||
| db.assert_logs(expect![[r#" | ||
| [ | ||
| "salsa_event(WillExecute { database_key: min_panic(Id(2)) })", | ||
| "salsa_event(WillExecute { database_key: min_panic(Id(1)) })", | ||
| "salsa_event(WillExecute { database_key: min_iterate(Id(0)) })", | ||
| "salsa_event(WillIterateCycle { database_key: min_iterate(Id(0)), iteration_count: IterationCount(1), fell_back: false })", | ||
| "salsa_event(WillExecute { database_key: min_panic(Id(1)) })", | ||
| "salsa_event(WillExecute { database_key: min_panic(Id(2)) })", | ||
| ]"#]]); | ||
|
Comment on lines
+1057
to
+1065
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The output before the fix: |
||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to remember why I explicitly added
is_cycle_with_other__threadin30f6eb4(#882)It suggests that it is to fix a panic but there's no failing test :( Maybe it only failed on CI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, it reproduces on CI (but why only on CI?)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially restricted the logic here to only apply when this leads to a cross-thread cycle because the
cycle_panictest started to hang on Github actions.Restricting this logic to multi-threaded cycle does fix the test-hang but it's over restrictive. The alternative fix that I added now (the if below the huge comment) accomplishes the same without making any assumptions about on how many threads the cycle runs.
An alternative fix is to change
maybe_changed_afterto push the current query indeep_verify_memo. While I think that this would have the nice added benefit that our query stack traces are more accurate (they also show queries running `maybe_changed_after), it does have the significant downside that pushing a new query isn't free and we would have to pay that cost for all queries, not just queries participating in cycles.That's why I opted for this fix instead.