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

support PartitionTableScan in TiFlash #3876

Merged
merged 9 commits into from
Mar 14, 2022

Conversation

windtalker
Copy link
Contributor

@windtalker windtalker commented Jan 17, 2022

What problem does this PR solve?

Issue Number: close #3873

Problem Summary:
As the issue described.

What is changed and how it works?

This is the TiFlash part of #3873, the main changes include

  • introduce TiDBTableScan to hide the different of TableScan and PartitionTableScan
  • support PartitionTableScan in DAGStorageInterpreter
  • support generate PartitionTableScan in dbgFunctionCoprocessor

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

support `PartitionTableScan` in TiFlash

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jan 17, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • JaySon-Huang
  • SeaRise

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jan 17, 2022
@windtalker windtalker force-pushed the mpp_partition_table branch 2 times, most recently from f8e52b6 to 568b6a0 Compare January 27, 2022 07:44
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 27, 2022
@windtalker windtalker force-pushed the mpp_partition_table branch 2 times, most recently from ab82cce to d621cd6 Compare February 8, 2022 07:52
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 13, 2022
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 14, 2022
@windtalker
Copy link
Contributor Author

/run-all-tests

@sre-bot
Copy link
Collaborator

sre-bot commented Feb 14, 2022

Coverage for changed files

Filename                                           Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Common/TiFlashMetrics.h                                 18                 0   100.00%          11                 0   100.00%          47                 1    97.87%           8                 0   100.00%
Debug/dbgFuncCoprocessor.cpp                           921               627    31.92%          97                56    42.27%        2180              1490    31.65%         794               548    30.98%
Flash/Coprocessor/DAGContext.cpp                        88                67    23.86%          23                16    30.43%         189               155    17.99%          62                54    12.90%
Flash/Coprocessor/DAGContext.h                          26                 8    69.23%          19                 7    63.16%          57                15    73.68%           8                 3    62.50%
Flash/Coprocessor/DAGDriver.cpp                        112               112     0.00%           5                 5     0.00%         150               150     0.00%          46                46     0.00%
Flash/Coprocessor/DAGQueryBlock.cpp                    110                70    36.36%           4                 1    75.00%         148               105    29.05%          76                49    35.53%
Flash/Coprocessor/DAGQueryBlock.h                        5                 4    20.00%           3                 2    33.33%           5                 2    60.00%           4                 4     0.00%
Flash/Coprocessor/DAGQueryBlockInterpreter.cpp         371               371     0.00%          44                44     0.00%         854               854     0.00%         300               300     0.00%
Flash/Coprocessor/DAGQueryBlockInterpreter.h             3                 3     0.00%           3                 3     0.00%           3                 3     0.00%           0                 0         -
Flash/Coprocessor/DAGStorageInterpreter.cpp            341               341     0.00%          18                18     0.00%         675               675     0.00%         230               230     0.00%
Flash/Coprocessor/DAGStorageInterpreter.h               31                31     0.00%           8                 8     0.00%          61                61     0.00%          20                20     0.00%
Flash/Coprocessor/TablesRegionsInfo.cpp                 41                41     0.00%           5                 5     0.00%          61                61     0.00%          26                26     0.00%
Flash/Coprocessor/TablesRegionsInfo.h                   14                13     7.14%           8                 7    12.50%          27                26     3.70%           6                 6     0.00%
Flash/Coprocessor/collectOutputFieldTypes.cpp           50                44    12.00%          11                 7    36.36%         125               107    14.40%          50                39    22.00%
Flash/CoprocessorHandler.cpp                           138               138     0.00%           5                 5     0.00%         123               123     0.00%          54                54     0.00%
Flash/CoprocessorHandler.h                               1                 1     0.00%           1                 1     0.00%           1                 1     0.00%           0                 0         -
Flash/Mpp/MPPTask.cpp                                  315               315     0.00%          15                15     0.00%         282               282     0.00%         144               144     0.00%
Flash/Statistics/TableScanImpl.h                         4                 4     0.00%           2                 2     0.00%           4                 4     0.00%           4                 4     0.00%
Flash/Statistics/traverseExecutors.cpp                  15                15     0.00%           1                 1     0.00%          31                31     0.00%          28                28     0.00%
Interpreters/InterpreterSelectQuery.cpp                522               522     0.00%          52                52     0.00%         919               919     0.00%         436               436     0.00%
Storages/RegionQueryInfo.h                               2                 1    50.00%           2                 1    50.00%           7                 6    14.29%           0                 0         -
Storages/Transaction/LearnerRead.cpp                   199               199     0.00%          23                23     0.00%         559               559     0.00%         116               116     0.00%
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                 3327              2927    12.02%         360               279    22.50%        6508              5630    13.49%        2412              2107    12.65%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
16410      9751             40.58%    180254  98989        45.08%

full coverage report (for internal network access only)

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 19, 2022
@ti-chi-bot ti-chi-bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Feb 22, 2022
@fuzhe1989 fuzhe1989 self-requested a review February 27, 2022 12:30
@SeaRise SeaRise self-requested a review February 27, 2022 13:12
@SeaRise SeaRise mentioned this pull request Feb 28, 2022
12 tasks
@ti-chi-bot ti-chi-bot added do-not-merge/needs-linked-issue and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. do-not-merge/needs-linked-issue labels Mar 1, 2022
@SeaRise SeaRise self-requested a review March 1, 2022 03:19
dbms/src/Debug/dbgFuncCoprocessor.cpp Outdated Show resolved Hide resolved
dbms/src/Debug/dbgFuncCoprocessor.cpp Outdated Show resolved Hide resolved
dbms/src/Flash/Mpp/MPPTask.cpp Outdated Show resolved Hide resolved
dbms/src/Flash/Coprocessor/TiDBTableScan.cpp Show resolved Hide resolved
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 14, 2022
retry_regions.emplace_back(RegionInfo(r.region_id(), r.region_epoch().version(), r.region_epoch().conf_ver(), CoprocessorHandler::GenCopKeyRange(r.ranges()), nullptr));
}
}
TablesRegionsInfo tables_regions_info = TablesRegionsInfo::create(cop_request->regions(), cop_request->table_regions(), cop_context.db_context.getTMTContext());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
TablesRegionsInfo tables_regions_info = TablesRegionsInfo::create(cop_request->regions(), cop_request->table_regions(), cop_context.db_context.getTMTContext());
auto tables_regions_info = TablesRegionsInfo::create(cop_request->regions(), cop_request->table_regions(), cop_context.db_context.getTMTContext());

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

bool has_enforce_encode_type = dag_req.has_force_encode_type() && dag_req.force_encode_type();

assert(!remote_requests.empty());
DAGSchema & schema = remote_requests[0].schema;
Copy link
Contributor

Choose a reason for hiding this comment

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

how about check all schemas the same under debug mode?

}
for (auto & p : ret)
{
p.second.mvcc_query_info->concurrent = p.second.mvcc_query_info->regions_query_info.size() > 1 ? 1.0 : 0.0;
Copy link
Contributor

Choose a reason for hiding this comment

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

add a todo?

const tipb::Executor * table_scan;
bool is_partition_table_scan;
const google::protobuf::RepeatedPtrField<tipb::ColumnInfo> & columns;
std::vector<Int64> physical_table_ids;
Copy link
Contributor

Choose a reason for hiding this comment

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

got it. btw I found tidb_table_ids and tiflash_table_ids are more readable to me.

const tipb::Executor * table_scan;
bool is_partition_table_scan;
const google::protobuf::RepeatedPtrField<tipb::ColumnInfo> & columns;
std::vector<Int64> physical_table_ids;
Copy link
Contributor

Choose a reason for hiding this comment

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

what will happen if tidb mistakenly sent duplicated ids to tiflash? use set and check it?

@windtalker
Copy link
Contributor Author

/cancel hold

@windtalker windtalker removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 14, 2022
@windtalker
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

@windtalker: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and 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.

If you have any questions about the PR merge process, please refer to pr process.

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

This pull request has been accepted and is ready to merge.

Commit hash: f7065bf

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 14, 2022
@SchrodingerZhu
Copy link
Contributor

/run-all-tests

@SchrodingerZhu
Copy link
Contributor

/rebuild

1 similar comment
@windtalker
Copy link
Contributor Author

/rebuild

@SchrodingerZhu
Copy link
Contributor

/run-integration-tests

@sre-bot
Copy link
Collaborator

sre-bot commented Mar 14, 2022

Coverage for changed files

too many lines from llvm-cov, please refer to full report instead

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
16890      9485             43.84%    190236  96236        49.41%

full coverage report (for internal network access only)

@ti-chi-bot ti-chi-bot merged commit 2b14421 into pingcap:master Mar 14, 2022
@windtalker windtalker deleted the mpp_partition_table branch March 14, 2022 11:22
ywqzzy pushed a commit to ywqzzy/tiflash_1 that referenced this pull request Mar 14, 2022
ywqzzy added a commit to ywqzzy/tiflash_1 that referenced this pull request Mar 14, 2022
Signed-off-by: ywqzzy <[email protected]>

update.

Signed-off-by: ywqzzy <[email protected]>

update.

Signed-off-by: ywqzzy <[email protected]>

Split write and ingest throughput (pingcap#4245)

close pingcap#4243

Signed-off-by: ywqzzy <[email protected]>

fix the problem that expired data was not recycled timely due to slow gc speed (pingcap#4224)

close pingcap#4146

Signed-off-by: ywqzzy <[email protected]>

PageStorage: Fix some bugs (pingcap#4212)

ref pingcap#3594

Signed-off-by: ywqzzy <[email protected]>

Make test of CreateTables using affected opts (pingcap#4239)

close pingcap#4235

Signed-off-by: ywqzzy <[email protected]>

BlobStore: remove the old_ids, not need recycle the blob id. (pingcap#4247)

ref pingcap#3594

Signed-off-by: ywqzzy <[email protected]>

support `PartitionTableScan` in TiFlash (pingcap#3876)

close pingcap#3873

Signed-off-by: ywqzzy <[email protected]>

update.

Signed-off-by: ywqzzy <[email protected]>

update.

Signed-off-by: ywqzzy <[email protected]>

support last_day and dayofmonth pushdown to tiflash (pingcap#4183)

close pingcap#4149

Signed-off-by: ywqzzy <[email protected]>
JaySon-Huang pushed a commit to JaySon-Huang/tiflash that referenced this pull request Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

new implementation of partition table support in MPP/BatchCoprocessor
7 participants