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

Storages: add DMFile & ColumnFileTiny & Segment inverted index reader #10006

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Lloyd-Pottiger
Copy link
Contributor

@Lloyd-Pottiger Lloyd-Pottiger commented Mar 17, 2025

What problem does this PR solve?

Issue Number: ref #9843

Problem Summary:

What is changed and how it works?

Part 3 of of inverted index, introduce `InvertedIndexReaderFromDMFile`, `InvertedIndexReaderFromColumnFileTiny` and `InvertedIndexReaderFromSegment`.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

None

@ti-chi-bot ti-chi-bot bot added the release-note-none Denotes a PR that doesn't merit a release note. label Mar 17, 2025
Copy link
Contributor

ti-chi-bot bot commented Mar 17, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from lloyd-pottiger, ensuring that each of them provides their approval before proceeding. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Mar 17, 2025
@Lloyd-Pottiger Lloyd-Pottiger force-pushed the add-inverted-index-reader branch from f585ba2 to 9074280 Compare March 17, 2025 02:26
@Lloyd-Pottiger Lloyd-Pottiger changed the title Add inverted index reader Storages: add DMFile & ColumnFileTiny & Segment inverted index reader Mar 17, 2025
@Lloyd-Pottiger Lloyd-Pottiger force-pushed the add-inverted-index-reader branch from 9074280 to 080d1e3 Compare March 24, 2025 02:02
@Lloyd-Pottiger Lloyd-Pottiger force-pushed the add-inverted-index-reader branch from 080d1e3 to 95b3f2e Compare March 24, 2025 08:20
Comment on lines +115 to +118
if ( //
PerfContext::file_cache.fg_download_from_s3 > perf_begin.fg_download_from_s3 || //
PerfContext::file_cache.fg_wait_download_from_s3 > perf_begin.fg_wait_download_from_s3)
has_s3_download = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

This statistical method seems a bit odd, and it might lead to inaccuracies due to concurrency. Why not have the downloadFileForLocalRead function return whether the cache was hit or not?

Copy link
Member

@breezewish breezewish left a comment

Choose a reason for hiding this comment

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

The rest looks good, very similar to Vector's stream and reader.

Comment on lines +94 to +113
// If download file failed, retry a few times.
for (auto i = 3; i > 0; --i)
{
try
{
if (auto file_guard = file_cache->downloadFileForLocalRead(s3_file_name, index_props.file_size());
file_guard)
{
local_index_file_path = file_guard->getLocalFileName();
break; // Successfully downloaded index into local cache
}

throw Exception(ErrorCodes::S3_ERROR, "Failed to download vector index file {}", index_file_path);
}
catch (...)
{
if (i <= 1)
throw;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Encapsulate these retry logics within the file cache.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will refine this in another PR.

Signed-off-by: Lloyd-Pottiger <[email protected]>
Signed-off-by: Lloyd-Pottiger <[email protected]>
Signed-off-by: Lloyd-Pottiger <[email protected]>
Signed-off-by: Lloyd-Pottiger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants