Niko Matsakis
563334da17
fix comments
2021-11-13 12:02:25 -05:00
Niko Matsakis
ff71d77a24
avoid overloading the term "participant"
2021-11-13 11:58:18 -05:00
Niko Matsakis
7081fe428c
move the RFC contents to salsa book
2021-11-12 19:16:04 -05:00
Niko Matsakis
db2daf03e3
describe implementation in RFC
2021-11-12 09:02:40 -05:00
Niko Matsakis
5ebd2211a5
don't recover when not a participant
...
When a query Q invokes a cycle Q1...Q1 but Q is not a
participant in that cycle, Q should not recover! Test that.
2021-11-12 05:50:06 -05:00
Niko Matsakis
b8f628d664
improve RFC guide description
2021-11-11 09:07:45 -05:00
Niko Matsakis
cb658b9b89
enable partial recovery across threads
...
Including the corner case where the active thread does not have
recovery.
2021-11-11 09:07:45 -05:00
Niko Matsakis
93ee78e73f
factor out a helper to unblock a given runtime
2021-11-11 06:54:52 -05:00
Niko Matsakis
92b5c0261b
introduce a condvar per thread, instead of one
...
The previous version had a lot of spurious wakeups, but it
also resisted the refactoring I'm about to do. =)
2021-11-11 06:54:52 -05:00
Niko Matsakis
bfa74bc865
spread parallel tests into their own files
...
I was finding the parallel test setup hard to read,
so everything relating to one test is now in a single
file, with shorter names.
2021-11-11 06:54:52 -05:00
Niko Matsakis
45434cfa93
rework cycle to permit partial recovery (wip)
...
This is "wip" because it does not yet handle cross-thread recovery
correctly. That is coming in a later commit.
2021-11-11 06:54:32 -05:00
Niko Matsakis
c14a3d47ea
remove memo
from PanicGuard
...
`PanicGuard` used to own the memo so that, in the case of panic,
we could reinstall the old value -- but there's no reason for us to
do that. It's just as good to clear the slot in that case and recompute
it later. Also, it makes the code nicer to remove it, since
it allows us to have more precision about where we know the memo is
not null.
My motivation though is to work towards "partial cycle recovery".
We need a clean and easy way to cancel the ongoing execution and reset
the slot to "not computed" (turns out we used that in
`maybe_changed_since` too!).
2021-11-10 21:01:00 -05:00
Niko Matsakis
961599aa39
unwind from "block on" for panic/cancellation
...
We still record the same dependencies (or else the tests fail,
so +1 for test coverage).
This has the immediate advantage that we don't invoke the fallback
function twice for the repeated node in the cycle.
Also, fix a bug where revalidating cycles could lead to a
CycleParticipant error that is not caught (added a test for it).
2021-11-08 08:07:45 -05:00
Niko Matsakis
7c02d1910b
add cycle recovery
2021-11-06 07:59:20 -04:00
Niko Matsakis
b9d748a2ae
move content from rfc into book,d ocs
2021-11-06 05:29:31 -04:00
Niko Matsakis
cc2f8870c1
Cleanup edges, panics for diagram
2021-11-04 05:35:55 -04:00
Niko Matsakis
accde0ad70
doc "maybe changed since" and terminology
2021-11-04 05:29:43 -04:00
Niko Matsakis
7d66224319
start expanding the book (wip!)
2021-11-03 10:53:39 -04:00
Niko Matsakis
2f5e1d15d7
add diagram of derived query reads
...
Created in draw.io, should be editable from there.
2021-11-03 07:49:08 -04:00
Niko Matsakis
072184f486
FetchMaybeChanged.drawio
2021-11-03 04:23:37 -04:00
Niko Matsakis
33d47cc747
throw Cycle value directly
...
Do not wrap in Cancelled.
2021-11-02 12:45:42 -04:00
Niko Matsakis
ff7f5b60b0
first RFC draft
2021-11-02 07:07:22 -04:00
Niko Matsakis
eb307e4868
rename and incorporate new test
2021-11-02 06:23:48 -04:00
Niko Matsakis
62e2fabab9
on fallback, get deps from all cycle participants
...
We used to store a changed-at/durability that reflected only
the current frame in a cycle -- but really we are dependent
across the entire cycle, so we now store the max changed-at and
min durability from the entire thing.
2021-11-02 06:18:58 -04:00
Niko Matsakis
7dbacbcf2b
rotate the participants in the cycle once
...
Rotate the participants in the cycle when the cycle is created
rather than doing it "on the fly" each time they are iterated.
2021-11-02 06:13:18 -04:00
Niko Matsakis
1011274c9c
repeat test configuration
...
The default made tests harder to read.
2021-11-02 06:13:18 -04:00
Niko Matsakis
187de0f280
rename fn: query may be in same thread
2021-11-02 06:13:18 -04:00
Niko Matsakis
006848a8cc
matklad nikomatsakis
2021-11-02 06:13:18 -04:00
Niko Matsakis
83b2f40ca2
apply cargo fmt
2021-11-02 05:06:26 -04:00
Niko Matsakis
c096f714b5
fix clippy warnings
2021-11-01 13:42:03 -04:00
Niko Matsakis
3f95c0b4a0
panic when recovering from a cycle
...
It turns out this is necessary, as this test reveals!
If we don't panic, you might encounter further cycles
that aren't supposed to have executed. (Prior to these changes,
this test was panicking from the second cycle.)
2021-11-01 10:10:50 -04:00
Niko Matsakis
1027342468
introduce QueryRevisions and use everywhere
...
`QueryRevisions` is a shared struct that contains
"everything a query read thus far" -- it is roughly
the old `MemoRevisions` but without `verified_at`.
This change is useful because when a cycle occurs it
allows us to isolate out "inputs thus far" more easily.
2021-11-01 06:10:07 -04:00
Niko Matsakis
891a866653
refactor Memo
to just be parameterized over V
2021-10-31 09:47:15 -04:00
Niko Matsakis
75ee3edd2e
introduce Cycle type and use in recovery, errors
...
The Cycle type gives more structured information and ensures
deterministic ordering of participants within any particular
execution.
2021-10-31 07:21:07 -04:00
Niko Matsakis
3caf965533
limit visibility of CycleError
2021-10-31 06:41:05 -04:00
Niko Matsakis
ea6eedd9a3
test cycles with mixed recovery
2021-10-31 06:35:55 -04:00
Niko Matsakis
61599cc81a
report unexpected cycles using Cancelled
...
The `Cancelled` struct now reflects multiple potential reasons
for a query execution to be cancelled, including unexpected cycles.
It also gives information about the participants that lacked
recovery information.
2021-10-31 06:18:50 -04:00
Niko Matsakis
4a1dffe7bc
cleanup: move cycle recovery into try_block_on
...
This is just a refactoring.
2021-10-31 05:39:15 -04:00
Niko Matsakis
f659e1d2dd
docs: improve diagram, split gen. code and runtime
2021-10-31 04:30:11 -04:00
Niko Matsakis
5fe48246a9
take take take, that's all you do
2021-10-31 04:14:55 -04:00
Niko Matsakis
d8a792ce60
use RefCell::take
2021-10-31 04:13:42 -04:00
Niko Matsakis
cb00077ebc
silence clippy warnings
...
cargo clippy --fix ftw
2021-10-30 17:20:32 -04:00
Niko Matsakis
a53b1c53f1
put queries on the stack when validating
2021-10-30 11:46:37 -04:00
Niko Matsakis
b0eaa59139
make execute_query take active_query argument
2021-10-30 11:46:37 -04:00
Niko Matsakis
0af2a9fba7
add helper for pushing queries
...
This permits us to separate pushing on the query stack
from executing the query.
2021-10-30 11:46:30 -04:00
Niko Matsakis
54277d4ad1
remove silly duration parameter
2021-10-30 11:45:18 -04:00
Niko Matsakis
293e103c09
make "maybe changed since" share code with read
...
It is still *slightly* different from `read`.
This seems to have fixed various bugs.
2021-10-30 11:45:12 -04:00
Niko Matsakis
5adb3c9ab3
add debug methods that carry db
2021-10-30 11:39:50 -04:00
Niko Matsakis
d0c74935c9
break out a helper for executing queries
...
we're going to use it from maybe_changed_since soon
2021-10-30 11:38:29 -04:00
Niko Matsakis
91ed93a4d4
distinguish no-value from not computed at all
...
In the case of no-value, we track the revision where
the value was last changed, which will be useful for
maybe-changed-since.
2021-10-30 11:38:29 -04:00