-
Notifications
You must be signed in to change notification settings - Fork 48
Track the list of inflight keys #432
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
base: fulltext
Are you sure you want to change the base?
Conversation
c723b8d to
e17e975
Compare
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.
This PR assumes that an individual key can only be in the ingestion pipeline once. That's not true. It's quite possible to be currently ingesting a key (i.e., inside of SyncProcessMutation) and have that same key get scheduled again for mutation. In that scenario, this code will fail. I believe that you'll need to keep a count of in-flight entries for each key.
|
I wasn't aware of |
e17e975 to
0d18335
Compare
|
Yes. For multi-exec as well, keys are added to So, I have just added a utility function to check if a key is in-flight or not using |
Today, on a keyspace notification, the client is blocked so any prior mutations, by the same client, were already ingested at query time. Can you elaborate why do we need to know if mutations from other clients on the relevant keys needed to be processed? |
Basically we want to block the ft.search response on conflicting In-Flight keys to guarantee correctness and point in time consistency. Instead of ingesting the key's text data into a temporary text index, evaluating the predicate against it, and then throwing the index away, we can keep the client blocked and wait for the natural background ingestion to continue. This means we need to compare the keys in the response to the in-flight keys and keep the client blocked if there is any overlap. Next time |
src/index_schema.h
Outdated
| virtual void OnLoadingEnded(ValkeyModuleCtx *ctx); | ||
|
|
||
| inline const Stats &GetStats() const { return stats_; } | ||
| bool IsKeyInflight(const InternedStringPtr &key) const { |
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.
Please add ABSL_LOCK_EXCLUDED(mutated_records_mutex_). Otherwise I'm g2g
Signed-off-by: Baswanth Vegunta <[email protected]>
0d18335 to
8b3d904
Compare
|
Added the annotation |
Because the |
Track In-Flight Keys
When we schedule a mutation task for a key on the threadpool, we track
mutation_queue_size_but not which keys are actually in the queue. We'll need to know the in-flight keys so that when we evaluate predicates on the main thread at the end of the FT.SEARCH flow, we need to know if all relevant keys have been indexed or not. These checks will be added in followup PRs.