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(log_store): introduce the CollectionTask #4530

Merged
merged 9 commits into from
Aug 19, 2024

Conversation

WenyXu
Copy link
Member

@WenyXu WenyXu commented Aug 8, 2024

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

#4385

What's changed and what's your intention?

Introduce the CollectionTask, it performs two main operations:

  • Persists the WAL index to the specified path at every dump_index_interval.
  • Updates the latest index ID for each WAL provider at every checkpoint_interval.

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR requires documentation updates.

Summary by CodeRabbit

  • New Features

    • Introduced enhanced configuration options for indexing, including new parameters for index creation and intervals.
    • Added a new GlobalIndexCollector for better index management in the data node.
    • Expanded public API with new exports like default_index_file and GlobalIndexCollector.
  • Bug Fixes

    • Improved error handling with more specific error messages for different operations.
  • Chores

    • Updated dependency configurations to support new data handling and processing features.

Copy link
Contributor

coderabbitai bot commented Aug 8, 2024

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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 Aug 8, 2024
@WenyXu WenyXu force-pushed the feat/collect-region-entry_ids-part2 branch from 9a86dff to 3adb382 Compare August 13, 2024 07:48
@WenyXu
Copy link
Member Author

WenyXu commented Aug 13, 2024

@coderabbitai summary

Copy link
Contributor

coderabbitai bot commented Aug 13, 2024

Actions performed

Summary regeneration triggered.

Copy link
Contributor

coderabbitai bot commented Aug 13, 2024

Walkthrough

The recent changes enhance the configuration and functionality of the data node and log store systems. Key improvements include the introduction of new indexing capabilities, modifications to error handling, and refinements in object store management. These updates promote better organization, flexibility, and performance, ultimately leading to a more robust system architecture.

Changes

Files Change Summary
src/common/wal/src/config.rs, src/common/wal/src/config/kafka/datanode.rs Added default values to datanode_wal_config and new indexing fields to DatanodeKafkaConfig.
src/datanode/src/datanode.rs Enhanced DatanodeBuilder to manage global indexing with new methods and configurations.
src/datanode/src/store.rs Refactored object store creation methods, introducing caching and retry mechanisms.
src/log-store/Cargo.toml Added dependencies for improved data processing and storage capabilities.
src/log-store/src/error.rs Expanded the Error enum with more specific variants for better error handling.
src/log-store/src/kafka.rs, src/log-store/src/kafka/client_manager.rs Updated ClientManager for global index collector integration, enhancing its flexibility.
src/log-store/src/kafka/index.rs, src/log-store/src/kafka/index/collector.rs Introduced CollectionTask for managing background index operations and improved index encoding.
src/log-store/src/kafka/index/encoder.rs Implemented encoding for region indexes, enhancing storage efficiency.
src/log-store/src/kafka/log_store.rs Updated KafkaLogStore to optionally use a global index collector during initialization.
src/object-store/src/lib.rs Added Access type to enhance object store's access control features.

Sequence Diagram(s)

sequenceDiagram
    participant ClientManager
    participant KafkaLogStore
    participant GlobalIndexCollector
    participant DatanodeBuilder

    ClientManager->>KafkaLogStore: try_new(config, global_index_collector)
    KafkaLogStore->>GlobalIndexCollector: Initialize with optional collector
    KafkaLogStore->>DatanodeBuilder: Build with indexing config
    DatanodeBuilder->>GlobalIndexCollector: Manage indexing operations
Loading

🐰 "In the meadow, changes bloom,
New indexes and structures to assume.
With each hop, we refine our space,
Enhancing the log store's pace.
A dance of code, swift and bright,
In the rabbit’s burrow, all feels right!" 🐇


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@WenyXu WenyXu force-pushed the feat/collect-region-entry_ids-part2 branch from 8977c62 to 8d7bcc9 Compare August 13, 2024 08:09
@WenyXu WenyXu marked this pull request as ready for review August 13, 2024 08:27
@WenyXu WenyXu requested review from v0y4g3r, evenyag, waynexia and a team as code owners August 13, 2024 08:27
@WenyXu WenyXu requested a review from fengjiachun August 13, 2024 08:27
Copy link

codecov bot commented Aug 13, 2024

Codecov Report

Attention: Patch coverage is 85.53846% with 47 lines in your changes missing coverage. Please review.

Project coverage is 84.63%. Comparing base (c8de8b8) to head (23aa13f).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4530      +/-   ##
==========================================
- Coverage   84.88%   84.63%   -0.25%     
==========================================
  Files        1094     1096       +2     
  Lines      196364   196628     +264     
==========================================
- Hits       166674   166410     -264     
- Misses      29690    30218     +528     

src/common/wal/src/config/kafka/datanode.rs Outdated Show resolved Hide resolved
src/log-store/src/kafka/index/collector.rs Outdated Show resolved Hide resolved
src/log-store/src/kafka/index/collector.rs Outdated Show resolved Hide resolved
@WenyXu WenyXu force-pushed the feat/collect-region-entry_ids-part2 branch from 660bff0 to 392c314 Compare August 14, 2024 03:14
@WenyXu
Copy link
Member Author

WenyXu commented Aug 14, 2024

@fengjiachun @v0y4g3r PTAL

@WenyXu WenyXu force-pushed the feat/collect-region-entry_ids-part2 branch from 73ac3b1 to 1f47698 Compare August 14, 2024 06:31
src/datanode/src/datanode.rs Show resolved Hide resolved
@fengjiachun
Copy link
Collaborator

@WenyXu CI failed

Copy link
Contributor

@v0y4g3r v0y4g3r left a comment

Choose a reason for hiding this comment

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

LGTM

@v0y4g3r v0y4g3r added this pull request to the merge queue Aug 19, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 19, 2024
@WenyXu WenyXu enabled auto-merge August 19, 2024 03:23
@WenyXu WenyXu added this pull request to the merge queue Aug 19, 2024
Merged via the queue into GreptimeTeam:main with commit 76dc906 Aug 19, 2024
40 checks passed
@WenyXu WenyXu deleted the feat/collect-region-entry_ids-part2 branch August 19, 2024 04:14
CookiePieWw pushed a commit to CookiePieWw/greptimedb that referenced this pull request Sep 17, 2024
* feat: introduce the `CollectionTask`

* feat: add config of index collector

* chore: remove unused code

* feat: truncate indexes

* chore: apply suggestions from CR

* chore: update config examples

* refactor: retrieve latest offset while dumping indexes

* chore: print warn
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.

3 participants