Fix shard loading on t activation, speed up BQ cache loading #4977
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit combines three changes:
It now forces loading of a shard when a tenant is deactivated. This happens in the background, but it is triggered immediately. Previoulsy this was delayed (by lazy shard-loading) until the actual request came in. This however defeated the purpose of activating the tenant beforehand, as it was not ready to go when the request came.
If the flat index is used with BQ-caching, this commit speeds up the preloading time considerably. Previously we would dynamically grow the index as we read through the cursor. This lead to a lot of unnecessary copying. By growing just once, I could improve the startup time from 1.3s to 0.3s for a flat index with 1.25M BQ vectors
In addition it is now possible to change the bq.cache setting for the flat index. Note that changes will not take effect until there is a restart/reload of the shard. This is by design to prevent 1,000s of active tenant shards from suddenly hammering disks because of a config change.
What's being changed:
Review checklist