pingcap / tiflash

The analytical engine for TiDB and TiDB Cloud. Try free: https://tidbcloud.com/free-trial
https://docs.pingcap.com/tidb/stable/tiflash-overview
Apache License 2.0
944 stars 410 forks source link

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

Open JaySon-Huang opened 3 months ago

JaySon-Huang commented 3 months ago

What problem does this PR solve?

Issue Number: ref https://github.com/pingcap/tiflash/issues/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?

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

Side effects

Documentation

Release note

None
ti-chi-bot[bot] commented 3 months ago

[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: - **[OWNERS](https://github.com/pingcap/tiflash/blob/master/OWNERS)** 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[bot] commented 3 months ago

@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 dc52cf9e7b4a78c9e005e4476ddf866d75a34f60 link true /test pull-integration-test

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).