-
Notifications
You must be signed in to change notification settings - Fork 454
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
persist-txn: unblock_read
may incorrectly write to unregistered shards
#27088
Comments
I have a PoC for a fix of this (https://github.com/MaterializeInc/materialize/pull/27268/files), but there's a potential issue. Currently we have an invariant that calling materialize/src/persist-txn/src/txn_cache.rs Lines 1342 to 1355 in d2e3033
materialize/src/persist-txn/src/txns.rs Lines 1444 to 1462 in d2e3033
However, fixing this issue removes that guarantee for unregistered shards. Calling Perhaps the right approach is that part of the contract for |
What version of Materialize are you using?
v0.99.0.dev
What is the issue?
DataSnapshot::unblock_read
logically takes in three pieces of input:as_of
.as_of
,latest_write
.empty_to
(Noteempty_to > as_of
).These are encapsulated in the
DataSnapshot
struct.materialize/src/persist-txn/src/txn_read.rs
Lines 40 to 58 in 63bce95
unblock_read
allows a reader to read the data shard directly atas_of
, by taking the following steps:latest_write
.empty_to
.materialize/src/persist-txn/src/txn_read.rs
Lines 61 to 142 in 63bce95
The problem is that
unblock_read
never checks to see if the data shard is registered within the range[latest_write, empty_to)
. If it is unregistered, then it should not be writing to that shard. It's likely that there is some other process writing to the shard, which may be internally tracking the upper. It will then be surprised (panicked even) to see that the upper has moved out from under it.The text was updated successfully, but these errors were encountered: