Skip to content
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

feat: unify puffin name passed to stager #5564

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

zhongzc
Copy link
Contributor

@zhongzc zhongzc commented Feb 18, 2025

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

What's changed and what's your intention?

  1. Change puffin_file_name to handle in a series of traits related to Puffin Manager, and introduce an associated type FileHandle.
  2. Instance FileHandle as FileId in mito2.
  3. Add a member path_provider to ObjectStorePuffinFileAccessor to generate a file path using path_provider when constructing a reader or writer based on FileId
  4. Fulltext applier utilizes write cache, metadata cache, and file hint to accelerate queries

PR Checklist

Please convert it to a draft if some of the following conditions are not met.

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR requires documentation updates.
  • API changes are backward compatible.
  • Schema or data changes are backward compatible.

@zhongzc zhongzc requested review from evenyag, v0y4g3r, waynexia and a team as code owners February 18, 2025 11:37
Copy link
Contributor

coderabbitai bot commented Feb 18, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the docs-not-required This change does not impact docs. label Feb 18, 2025
@zhongzc zhongzc marked this pull request as draft February 18, 2025 13:50
Base automatically changed from zhongzc/purge-stager to main February 19, 2025 09:18
@zhongzc zhongzc force-pushed the zhongzc/unify-name-stager branch from a63e11f to cf171a9 Compare February 19, 2025 19:19
@zhongzc zhongzc marked this pull request as ready for review February 19, 2025 19:24
@waynexia waynexia requested a review from Copilot February 19, 2025 23:07

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 27 out of 27 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (3)

src/mito2/src/sst/parquet/reader.rs:390

  • Using 'index_file_size' as the file size hint for both the fulltext and bloom filter index operations replaces the previously distinct inverted_index_size and bloom_filter_index_size. Please double‐check that this change is intentional and that it correctly reflects the size for all index types.
let file_size_hint = self.file_handle.meta_ref().index_file_size();

src/mito2/src/sst/index/puffin_manager.rs:84

  • [nitpick] The introduction of the new 'path_provider' parameter unifies file path handling for Puffin operations. Ensure that its interface conforms to the FilePathProvider trait and that all references in calling code are updated consistently.
pub(crate) fn build(

src/mito2/src/sst/index/fulltext_index/creator.rs:496

  • [nitpick] The removal of the 'file_path' variable in favor of using 'FileId' directly improves clarity. Verify that all related documentation and tests have been updated accordingly to reflect this change.
let file_path = location::index_file_path(&region_dir, sst_file_id);
Comment on lines +38 to +40
where
S: Stager,
W: AsyncWrite + Unpin + Send,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking: It only requires the Stager trait bound.

Suggested change
where
S: Stager,
W: AsyncWrite + Unpin + Send,
where
S: Stager,

Comment on lines +56 to +58
where
S: Stager,
W: AsyncWrite + Unpin + Send,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
where
S: Stager,
W: AsyncWrite + Unpin + Send,
where
S: Stager,

@@ -169,7 +174,7 @@ impl Stager for BoundedStager {
notifier.on_load_blob(timer.elapsed());
}
let guard = Arc::new(FsBlobGuard {
puffin_file_name: puffin_file_name.to_string(),
handle: handle_str.to_string(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move the handle_str?

Suggested change
handle: handle_str.to_string(),
handle: handle_str,

pub(crate) fn build(
&self,
store: ObjectStore,
path_provider: impl FilePathProvider + 'static,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we pass Arc<dyn FilePathProvider>? So we don't need to make this method generic.

Suggested change
path_provider: impl FilePathProvider + 'static,
path_provider: Arc<dyn FilePathProvider>,

Comment on lines +154 to +159
if file_cache.get(index_key).await.is_some() {
puffin_manager = Some(self.puffin_manager_factory.build(
file_cache.local_store(),
WriteCachePathProvider::new(self.region_id, file_cache.clone()),
));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache may remove the file before we get the dir. We may need to fallback to remote reader if we can't get the dir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required This change does not impact docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants