forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Enable Foyer disk based cache for Parquet warm reads #1
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
Open
vishwasgarg18
wants to merge
1
commit into
datafusion
Choose a base branch
from
parquet/foyer-integeration
base: datafusion
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
...orized-exec-spi/src/main/java/org/opensearch/vectorized/execution/jni/PageCacheAware.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| /* | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * The OpenSearch Contributors require contributions made to | ||
| * this file be licensed under the Apache-2.0 license or a | ||
| * compatible open source license. | ||
| */ | ||
|
|
||
| package org.opensearch.vectorized.execution.jni; | ||
|
|
||
| /** | ||
| * Marker interface for plugins that can receive a {@link PageCacheProvider}. | ||
| * <p> | ||
| * Implemented by {@code TieredStoragePlugin} so that {@code Node.java} (in the | ||
| * {@code server} module) can inject a page cache provider without needing | ||
| * a compile-time dependency on the {@code modules/tiered-storage} module. | ||
| * <p> | ||
| * {@code Node.java} discovers plugins implementing this interface and calls | ||
| * {@link #setPageCacheProvider(PageCacheProvider)} after the {@link PageCacheProvider} | ||
| * (e.g., {@code DataFusionPlugin}) has been discovered. | ||
| */ | ||
| public interface PageCacheAware { | ||
|
|
||
| /** | ||
| * Inject the page cache provider. | ||
| * Called by {@code Node.java} during node construction, after the plugin implementing | ||
| * {@link PageCacheProvider} (e.g. {@code DataFusionPlugin}) has been initialized. | ||
| * | ||
| * @param provider the page cache provider, never null when this method is called | ||
| */ | ||
| void setPageCacheProvider(PageCacheProvider provider); | ||
| } | ||
53 changes: 53 additions & 0 deletions
53
...zed-exec-spi/src/main/java/org/opensearch/vectorized/execution/jni/PageCacheProvider.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /* | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * The OpenSearch Contributors require contributions made to | ||
| * this file be licensed under the Apache-2.0 license or a | ||
| * compatible open source license. | ||
| */ | ||
|
|
||
| package org.opensearch.vectorized.execution.jni; | ||
|
|
||
| /** | ||
| * Provider for a byte-range page cache used to serve Parquet file reads on warm indices. | ||
| * <p> | ||
| * Implemented by search-engine plugins (e.g. {@code DataFusionPlugin}) that own an | ||
| * in-process page cache and want to expose it to the tiered-storage module so that | ||
| * {@code CachedParquetCacheStrategy} can serve Parquet column-chunk byte ranges from the | ||
| * cache instead of re-fetching from object storage (S3/GCS/Azure) on every | ||
| * {@code openIndexInput()} call. | ||
| * <p> | ||
| * The cache key is the local filesystem path of the Parquet file (without leading slash) | ||
| * combined with the byte range, e.g. {@code "data/nodes/0/.../parquet/_parquet_0.parquet:4096-8192"}. | ||
| * The exact key format is an implementation detail of the provider. | ||
| */ | ||
| public interface PageCacheProvider { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why we need a page cache provider we have a cache strategy provider correct and for parquet we can have pass through on java and foyer in rust correct |
||
|
|
||
| /** | ||
| * Look up a cached byte range for a Parquet file. | ||
| * | ||
| * @param path the local file path used as cache key (e.g. "data/nodes/0/.../parquet/_parquet_0.parquet") | ||
| * @param start byte range start (inclusive) | ||
| * @param end byte range end (exclusive) | ||
| * @return the cached bytes, or {@code null} on cache miss | ||
| */ | ||
| byte[] getPageRange(String path, int start, int end); | ||
|
|
||
| /** | ||
| * Store a byte range for a Parquet file in the cache. | ||
| * | ||
| * @param path the local file path used as cache key | ||
| * @param start byte range start (inclusive) | ||
| * @param end byte range end (exclusive) | ||
| * @param data the bytes to cache (must have length == end - start) | ||
| */ | ||
| void putPageRange(String path, int start, int end, byte[] data); | ||
|
|
||
| /** | ||
| * Evict all cached byte ranges for a given Parquet file. | ||
| * Called when a file is deleted (merged, compacted, or tiered out). | ||
| * | ||
| * @param path the local file path whose cached ranges should be removed | ||
| */ | ||
| void evictFile(String path); | ||
| } | ||
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Not the right place. Placed here to avoid compilation issue.
Update location post open sourcing Tiered storage.