Closed
Conversation
Signed-off-by: Christoph Schulze <christoph.schulze@polygon.io>
…rtex-datafusion-segment-cache Signed-off-by: Christoph Schulze <christoph.schulze@polygon.io>
Signed-off-by: Christoph Schulze <christoph.schulze@polygon.io>
Signed-off-by: Christoph Schulze <christoph.schulze@polygon.io>
Signed-off-by: Christoph Schulze <christoph.schulze@polygon.io>
Collaborator
Author
|
Closing this as we need to merge into vortex 0.65.0 and this one is way ahead. Switched to new PR: #5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
VortexSource had no way to share segment bytes across queries. Every DataFusion query re-read the same zone-map and data segments from object storage, even though for an unchanged file those bytes are identical. This change adds a cross-query, cross-file segment cache, plumbed end-to-end from VortexSource down to VortexOpenOptions.
The naive approach of passing one
Arc<dyn SegmentCache>for all files is unsafe:SegmentIdis a file-localu32index, e.g., segment 5 from file A and segment 5 from file B would alias to the same cache entry and silently serve wrong data.This PR introduces a SegmentCacheBuilder indirection that namespaces per-file caches by a
FileIdentity(path + content version) so a single shared cache is correct across many files.The
SegmentCacheBuilderbuilder hands out per-fileSegmentCacheviews from one shared backing store, namespaced byFileIdentity(path + etag/size-mtime).VortexSource::with_segment_cache_builder(...)wires it through. Build oneNamespacedMokaSegmentCacheBuilderper process, reuse for every query — file-safe, overwrite-safe, cross-query reuse.The
InstrumentedSegmentCacheBuilderdecorator SegmentCacheBuilder — it wraps another builder and adds hit/miss/store metrics to every per-file cache that builder produces.Usage