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

Cache segment metadata on the Overlord to speed up segment allocation and other task actions #17653

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kfaraz
Copy link
Contributor

@kfaraz kfaraz commented Jan 22, 2025

NOT READY FOR REVIEW YET

Description

Design

Major changes

  • Add Overlord runtime property druid.manager.segments.useCache (default value false)
  • No change in flow when cache is disabled
  • Add SqlSegmentsMetadataCache to poll committed and pending segments from the Overlord
  • Add DatasourceSegmentsCache to cache committed and pending segments of a single datasource
  • Add SegmentsMetadataTransaction to encapsulate all read/write operations performed within
    a transaction. This allows redirect all read/write operations within a transaction to either the cache
    or to the metadata store itself.
  • Add SqlSegmentsMetadataTransactionFactory that creates either a SqlSegmentsMetadataTransaction
    or a SqlSegmentsMetadataCachedTransaction based on whether the cache is enabled and ready or not
  • Use SegmentsMetadataTransaction to perform all operations in IndexerSQLMetadataStorageCoordinator

Testing

  • Updated IndexerSQLMetadataStorageCoordinatorTest to run both with and without cache

Pending items

  • Add UTs for the cache classes
  • Wire up other existing UTs to use cache
  • Update existing ITs to work with cache

Release note


This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

.map((index, r, ctx) -> {
try {
final PendingSegmentRecord record = PendingSegmentRecord.fromResultSet(r, jsonMapper);
final DateTime createdDate = nullSafeDate(r.getString("created_date"));

Check notice

Code scanning / CodeQL

Unread local variable Note

Variable 'DateTime createdDate' is never read.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant