risingwave
risingwave copied to clipboard
feat(storage): remove FilterKeyExtractor trait for MultiFilterKeyExtractor
Is your feature request related to a problem? Please describe.
Currently, MultiFilterKeyExtractor is a struct that impletement FilterKeyExtractor trait. We can provide a nested structure with this implementation, but this is not safe. We want FilterKeyExtractor to be stateless, but now MultiFilterKeyExtractor needs to hold mutable self in order to maintain state. (For borrow checker, we use need a Mutex even if it wont be competing).
(https://github.com/singularity-data/risingwave/blob/main/src/storage/hummock_sdk/src/filter_key_extractor.rs) simple conclusion:
FilterKeyExtractorto be statelessFilterKeyExtractorno needs to hold mutable self for maintaining state
Describe the solution you'd like
- use a new struct
FilterKeyExtractorContextto replaceMultiFilterKeyExtractorwhich maintain state. - remove MultiFilterKeyExtractor for avoiding nested structure that it's uncontrollable
- cached the
last_filter_key_extractor_statefor query optimization. - use separate
FilterKeyExtractorContextfor every compaction task split (Copy)
May I take a look? I may be able to submit a PR next week...👀 Won't be fast...
May I take a look? I may be able to submit a PR next week...👀 Won't be fast...
Thanks, you can self-assign
- FilterKeyExtractor to be stateless
- FilterKeyExtractor no needs to hold mutable self for maintaining state
wait...? a stateless structure but need to maintain state?🤯