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

KVStore: Refine parallel prehandle snapshot (part-3) #9198

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

JaySon-Huang
Copy link
Contributor

@JaySon-Huang JaySon-Huang commented Jul 8, 2024

What problem does this PR solve?

Issue Number: ref #8081

Problem Summary:
In the previous implementation, the code is kind of messy. We will create a SSTFilesToBlockInputStream, then resetSoftLimit a soft limit to the input stream.

What is changed and how it works?


  • Introduce SnapshotSSTReader to simplify the code. The following methods moved from SSTFilesToBlockInputStream to the new class:
    • getApproxBytes
    • findSplitKeys
    • maybeSkipBySoftLimit
    • maybeStopBySoftLimit
    • checkFinishedState
  • Create SnapshotSSTReader with given SoftLimit, then use the "SnapshotSSTReader with soft limit" to create "SSTFilesToBlockInputStream"
struct SnapshotSSTReader
{
    SnapshotSSTReader(
        const SSTViewVec & snaps,
        const TiFlashRaftProxyHelper * proxy_helper,
        RegionID region_id,
        UInt64 snapshot_index,
        const ImutRegionRangePtr & region_range,
        std::optional<SSTScanSoftLimit> && soft_limit,
        const String & log_prefix);

    // Currently it only takes effect if using tablet sst reader which is usually a raftstore v2 case.
    // Otherwise will return zero.
    size_t getApproxBytes() const;
    std::vector<std::string> findSplitKeys(size_t splits_count) const;

    using SSTReaderPtr = std::unique_ptr<SSTReader>;
    SSTReaderPtr write_cf_reader;
    SSTReaderPtr default_cf_reader;
    SSTReaderPtr lock_cf_reader;
};

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 Jul 8, 2024
Copy link
Contributor

ti-chi-bot bot commented Jul 8, 2024

[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 jayson-huang, 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 Jul 8, 2024
Copy link
Contributor

ti-chi-bot bot commented Jul 8, 2024

@JaySon-Huang: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-integration-test dc52cf9 link true /test pull-integration-test

Full PR test history. Your PR dashboard.

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 kubernetes/test-infra repository. I understand the commands that are listed here.

@JaySon-Huang JaySon-Huang marked this pull request as draft July 8, 2024 12:03
@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 Jul 8, 2024
@ti-chi-bot ti-chi-bot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 25, 2024
@ti-chi-bot ti-chi-bot bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant