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: Refine SegmentReadTaskPool and SegmentReadTaskScheduler #8237

Merged
merged 8 commits into from
Oct 28, 2023

Conversation

JinheLin
Copy link
Contributor

@JinheLin JinheLin commented Oct 24, 2023

What problem does this PR solve?

Issue Number: ref #6834

What is changed and how it works?

  • This PR mainly refines SegmentReadTaskPool and SegmentReadTaskScheduler preparing for supporting read-thread and data-sharing in disaggregated-mode. The logic of the reading path is still not changed after this PR.

Main changes:

  • Remove DMContext and physical_table_id from SegmentReadTaskPool.
  • Add DMContext to SegmentReadTask.
    • In disaggregated-mode, EstablishDisaggTask can return SegmentReadTasks of different physical tables. So SegmentReadTaskPool needs to support SegmentReadTasks of different physical tables.
    • Move information of physical tables in DMContext into SegmentReadTask .
  • Use GlobalSegmentID to identify a segment in SegmentReadTaskScheduler.
    • In op-mode, physical_table_id + segment_id + segment_epoch can identify a segment. In disaggregated-mode, it also needs to add store_id and keyspace_id.
    • Wrap this information into struct GlobalSegmentID.
  • Enhance the formatter of SegmentReadTaskPtr and remove SegmentReadTask::info.
  • Remove cluster member from RNWorkerFetchPages.
  • Remove RNReadTask since it is redundant.

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
Copy link
Contributor

ti-chi-bot bot commented Oct 24, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 24, 2023
@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 25, 2023
@JinheLin JinheLin marked this pull request as ready for review October 25, 2023 08:39
@JinheLin JinheLin changed the title [WIP]Refine SegmentReadTaskPool Storages: Refine SegmentReadTaskPool and SegmentReadTaskScheduler Oct 25, 2023
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 25, 2023
@JinheLin JinheLin changed the title Storages: Refine SegmentReadTaskPool and SegmentReadTaskScheduler [WIP]Storages: Refine SegmentReadTaskPool and SegmentReadTaskScheduler Oct 25, 2023
@ti-chi-bot ti-chi-bot bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 25, 2023
@JinheLin JinheLin changed the title [WIP]Storages: Refine SegmentReadTaskPool and SegmentReadTaskScheduler Storages: Refine SegmentReadTaskPool and SegmentReadTaskScheduler Oct 25, 2023
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 25, 2023
@JinheLin
Copy link
Contributor Author

/run-all-tests

@JinheLin
Copy link
Contributor Author

/run-all-tests

@JinheLin JinheLin requested a review from JaySon-Huang October 27, 2023 08:48
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.

Rest LGTM

@@ -188,7 +187,7 @@ void RNWorkerFetchPages::doFetchPages(
double total_write_page_cache_sec = 0.0;

pingcap::kv::RpcCall<pingcap::kv::RPC_NAME(FetchDisaggPages)> rpc(
cluster->rpc_client,
seg_task->dm_context->db_context.getTMTContext().getKVCluster()->rpc_client,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like to keep a cluster in RNWorkerFetchPages. Getting it from seg_task->dm_context->db_context.... is too implicit and hard to write tests (if we do write tests later)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The logic of the fetchpages is not pure, it depends on other member from dm_context/db_context. We cannot remove dm_context/db_context from fetchpages easily, so keep cluster member seems not make much sense.

And I think the main logic of fetchpages should be member functions of SegmentReadTask, instead of part the thread workers. The code also needs to be refined later.

If we write tests for it , we'd better to refine functions to accept a cluster argument or set the member of dm_context properly.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK

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.

LGTM

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Oct 27, 2023
@JinheLin
Copy link
Contributor Author

/run-unit-test

1 similar comment
@JaySon-Huang
Copy link
Contributor

/run-unit-test

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Oct 28, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Oct 28, 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
Copy link
Contributor

ti-chi-bot bot commented Oct 28, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-10-27 10:05:37.993442257 +0000 UTC m=+2601935.580552401: ☑️ agreed by JaySon-Huang.
  • 2023-10-28 00:48:16.548265353 +0000 UTC m=+2654894.135375498: ☑️ agreed by Lloyd-Pottiger.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Oct 28, 2023

@JinheLin: 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.

@JinheLin
Copy link
Contributor Author

/run-all-tests

@ti-chi-bot ti-chi-bot bot merged commit 3cc5dca into pingcap:master Oct 28, 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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants