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

Add new items in scan context #7841

Merged
merged 17 commits into from
Aug 2, 2023

Conversation

hongyunyan
Copy link
Contributor

@hongyunyan hongyunyan commented Jul 25, 2023

What problem does this PR solve?

Issue Number: ref #5926

Problem Summary:

What is changed and how it works?

Add more information in Scan Context:

  1. time cost of wait index
  2. read size from s3 and cache

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 do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed do-not-merge/needs-linked-issue labels Jul 25, 2023
dbms/src/Storages/DeltaMerge/ScanContext.h Outdated Show resolved Hide resolved
dbms/src/Storages/DeltaMerge/ScanContext.h Outdated Show resolved Hide resolved
dbms/src/Storages/S3/S3RandomAccessFile.cpp Outdated Show resolved Hide resolved
@JaySon-Huang
Copy link
Contributor

And there are some ColumnFile in the DeltaValueSpace read from local cache or fetch from remote write nodes. We should add them to total_disagg_read_cache_hit_size/total_disagg_read_cache_miss_size

RNLocalPageCache::OccupySpaceResult blockingOccupySpaceForTask(const RNReadSegmentTaskPtr & seg_task)
{
std::vector<PageOID> cf_tiny_oids;
{
cf_tiny_oids.reserve(seg_task->meta.delta_tinycf_page_ids.size());
for (const auto & page_id : seg_task->meta.delta_tinycf_page_ids)
{
auto page_oid = PageOID{
.store_id = seg_task->meta.store_id,
.ks_table_id = {seg_task->meta.keyspace_id, seg_task->meta.physical_table_id},
.page_id = page_id,
};
cf_tiny_oids.emplace_back(page_oid);
}
}
// Note: We must occupySpace segment by segment, because we need to read
// at least the complete data of one segment in order to drive everything forward.
// Currently we call occupySpace for each FetchPagesRequest, which is fine,
// because we send one request each seg_task. If we want to split
// FetchPagesRequest into multiples in future, then we need to change
// the moment of calling `occupySpace`.
auto page_cache = seg_task->meta.dm_context->db_context.getSharedContextDisagg()->rn_page_cache;
Stopwatch w_occupy;
auto occupy_result = page_cache->occupySpace(cf_tiny_oids, seg_task->meta.delta_tinycf_page_sizes);
// This metric is per-segment.
GET_METRIC(tiflash_disaggregated_breakdown_duration_seconds, type_cache_occupy).Observe(w_occupy.elapsedSeconds());
return occupy_result;
}

@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 25, 2023
const auto check_results = filter->roughCheck(0, pack_count, param);
std::transform(use_packs.begin(), use_packs.end(), check_results.begin(), use_packs.begin(), [](UInt8 a, RSResult b) { return (static_cast<bool>(a)) && (b != None); });
scan_context->total_dmfile_rough_set_index_load_time_ns += watch.elapsed();
Copy link
Contributor

Choose a reason for hiding this comment

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

rename to total_dmfile_rough_set_index_check_time_ns ?

Copy link
Contributor

@JaySon-Huang JaySon-Huang Aug 2, 2023

Choose a reason for hiding this comment

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

yes, we can distinguish the loading time and checking time of rough set index

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does this mean that we need to use two indicators separately for statistics?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the sum is enough.

Copy link
Contributor

@JaySon-Huang JaySon-Huang 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 LGTM

@hongyunyan
Copy link
Contributor Author

/run-all-tests

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Aug 2, 2023
@JaySon-Huang
Copy link
Contributor

/run-all-tests

@ti-chi-bot ti-chi-bot bot added the lgtm label Aug 2, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Aug 2, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JaySon-Huang, Lloyd-Pottiger

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

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [JaySon-Huang,Lloyd-Pottiger]

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 removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Aug 2, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Aug 2, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-08-02 09:03:50.404491048 +0000 UTC m=+262514.346839579: ☑️ agreed by JaySon-Huang.
  • 2023-08-02 09:06:07.469104072 +0000 UTC m=+262651.411452603: ☑️ agreed by Lloyd-Pottiger.

@hongyunyan
Copy link
Contributor Author

/run-all-tests

@hongyunyan
Copy link
Contributor Author

/run-all-tests

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Aug 2, 2023

@hongyunyan: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

trigger some heavy tests which will not run always when PR updated.

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot bot merged commit ef6ff95 into pingcap:master Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants