-
Notifications
You must be signed in to change notification settings - Fork 613
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
Bug(storage): StateStore::iter() interface doesn't filter rows correctly #6104
Comments
Hi, I'd like to work on this issue. |
Hi could I ask if we still need to encode table_id as a prefix even if table_id == 0? What does table_id == 0 correspond to? Just seems that table_id == 0 is handled differently to other table_id. Edit: Seems like that is reserved for unit tests? Seems the main function is not to have to include a table_id prefix in the keys so that unit tests are more readable. |
Anw, seems like this issue is mostly an interface issue. Its not ambiguous for a So we are just doing some defensive coding by fixing this. I will add some stronger guarantees about ReadOptions in the interface. |
Yes. The problem is the semantic of the interface. And since our executors in the compute node always read with a risingwave/src/storage/src/keyspace.rs Line 144 in a3fac7f
|
Actually, I don't think the right behaviour should be to add the prefix to the range. If the bound is Included/Excluded, these need to already be prefixed by the table_id. We cannot accept Unbounded bound, this should have been converted to e.g. Included([table_id]). Hence, I suggest instead to throw an error on We can also do a sanity check that the table_id will serialize to the first 4 bytes of included/excluded bounds. Not sure if you think we should put these checks only in debug mode as debug_assertions |
Just prepending |
#6130 is working on a full key refactor proposed in #5960. After this refactor, the key passed in will not be prefixed with table id, and all read will be enforced to be performed under the specified table id. #6005 has proposed to remove all the |
Ok makes sense. Should we close this issue? |
I will add tests related to multiple tables. |
Describe the bug
Although we specify the
table_id
field inReadOptions
, it may still read kv pairs belonging to other tables. Because thetable_id
isn't used as a prefix to filter the kv pairs in a SST file.To Reproduce
If the SST file contains kv pairs of multiple tables, this iterator will scan all kvs in the file.
Expected behavior
Since we have set the
table_id
field inReadOptions
, the iterator should only scan kv pairs of the specified table.Additional context
No response
The text was updated successfully, but these errors were encountered: