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

Test: Mock TiFlash compute service and dispatch MPPTask to single service. #5450

Merged
merged 36 commits into from
Aug 3, 2022

Conversation

ywqzzy
Copy link
Contributor

@ywqzzy ywqzzy commented Jul 22, 2022

What problem does this PR solve?

Issue Number: ref #4609

Problem Summary:

What is changed and how it works?

  1. Add MockComputeServer to serve MPP Requests. Only use single FlashService to serve mock MPP Requests.
  2. Add MockComputeClient to send MPP Requests to FlashService.
  3. Use executorIdColumnsMap to pass input columns into MockTableScan.

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
Member

ti-chi-bot commented Jul 22, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Lloyd-Pottiger
  • 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 do-not-merge/needs-linked-issue 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. labels Jul 22, 2022
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 27, 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 Aug 1, 2022
@ywqzzy ywqzzy requested a review from windtalker August 1, 2022 03:52
@@ -157,7 +157,8 @@ ::grpc::Status FlashService::DispatchMPPTask(
{
CPUAffinityManager::getInstance().bindSelfGrpcThread();
LOG_FMT_DEBUG(log, "Handling mpp dispatch request: {}", request->DebugString());
if (!security_config.checkGrpcContext(grpc_context))
// For MPP test, we don't care about security config.
if (!context.isMPPTest() && !security_config.checkGrpcContext(grpc_context))
Copy link
Contributor

Choose a reason for hiding this comment

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

The security check will fail in mpp test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, because I didn't mock anything related to the security_config.

{
non_test,
mpp_test,
executor_test
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the difference between mpp_test and executor_test?

Copy link
Contributor Author

@ywqzzy ywqzzy Aug 1, 2022

Choose a reason for hiding this comment

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

mpp_test will run FlashService using the actual ExchangeReceiver/Sender to run Tasks.
executor_test only run in local with MockExchangeReceiver/Sender.

{
throw Exception("Exception happens when start grpc server, the flash.service_addr may be invalid, flash.service_addr is " + Debug::LOCAL_HOST, ErrorCodes::IP_ADDRESS_NOT_ALLOWED);
}
LOG_FMT_DEBUG(log, "Flash grpc server listening on [{}]", Debug::LOCAL_HOST);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why can't reuse FlashGrpcServerHolder

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 FlashGrpcServerHolder is in Server.cpp. But Server.cpp is too heavy, and Server.cpp relies on Poco::Util::ServerApplication which can not easily manage the lifetime of Service because it should run in main() function, so I just simplify it in order to get a better management of FlashService.

Copy link
Contributor Author

@ywqzzy ywqzzy Aug 1, 2022

Choose a reason for hiding this comment

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

The FlashGrpcServerHolder is in Server.cpp. But Server.cpp is too heavy, and Server.cpp relies on Poco::Util::ServerApplication which can not easily manage the lifetime of Service because it should run in main() function, so I just simplify it in order to get a better management of FlashService.

In future, we will run multiple services in one gtest, so IMO it's better to simplify it.

@ywqzzy
Copy link
Contributor Author

ywqzzy commented Aug 1, 2022

Blocked, I will split FlashGrpcServerHolder from Server.cpp to an separate file

@SeaRise
Copy link
Contributor

SeaRise commented Aug 1, 2022

/hold

@ti-chi-bot ti-chi-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 1, 2022
@ywqzzy
Copy link
Contributor Author

ywqzzy commented Aug 2, 2022

/unhold

@ti-chi-bot ti-chi-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 2, 2022
@ywqzzy
Copy link
Contributor Author

ywqzzy commented Aug 2, 2022

/run-all-tests

1 similar comment
@ywqzzy
Copy link
Contributor Author

ywqzzy commented Aug 2, 2022

/run-all-tests

@ywqzzy
Copy link
Contributor Author

ywqzzy commented Aug 2, 2022

/run-unit-tests

1 similar comment
@ywqzzy
Copy link
Contributor Author

ywqzzy commented Aug 2, 2022

/run-unit-tests

@sre-bot
Copy link
Collaborator

sre-bot commented Aug 2, 2022

Coverage for changed files

Filename                                           Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Debug/dbgFuncCoprocessor.cpp                           430               320    25.58%          39                27    30.77%         882               601    31.86%         292               220    24.66%
Debug/dbgFuncCoprocessor.h                               1                 0   100.00%           1                 0   100.00%           1                 0   100.00%           0                 0         -
Flash/Coprocessor/DAGContext.cpp                       101                42    58.42%          25                 6    76.00%         173                53    69.36%          68                39    42.65%
Flash/Coprocessor/DAGContext.h                          38                 9    76.32%          29                 7    75.86%          88                22    75.00%          12                 6    50.00%
Flash/Coprocessor/DAGQueryBlockInterpreter.cpp         228                30    86.84%          33                 2    93.94%         605                63    89.59%         150                30    80.00%
Flash/Coprocessor/InterpreterUtils.cpp                  45                 6    86.67%           9                 0   100.00%         139                 9    93.53%          34                 7    79.41%
Flash/Coprocessor/MockSourceStream.h                    21                 2    90.48%           1                 0   100.00%          34                 0   100.00%          14                 2    85.71%
Flash/Coprocessor/TablesRegionsInfo.cpp                 41                38     7.32%           5                 4    20.00%          62                52    16.13%          26                24     7.69%
Flash/CoprocessorHandler.cpp                           163               163     0.00%           5                 5     0.00%         129               129     0.00%          40                40     0.00%
Flash/CoprocessorHandler.h                               1                 1     0.00%           1                 1     0.00%           1                 1     0.00%           0                 0         -
Flash/FlashService.cpp                                 397               319    19.65%          18                11    38.89%         327               249    23.85%         102                86    15.69%
Flash/FlashService.h                                     5                 3    40.00%           4                 2    50.00%          14                 7    50.00%           0                 0         -
Flash/Mpp/MPPTask.cpp                                  496               197    60.28%          27                 8    70.37%         431               161    62.65%         178               113    36.52%
Flash/tests/gtest_aggregation_executor.cpp             115                28    75.65%           7                 0   100.00%         179                 1    99.44%          28                16    42.86%
Flash/tests/gtest_compute_server.cpp                    39                14    64.10%           3                 0   100.00%          69                 0   100.00%          12                 8    33.33%
Interpreters/Context.cpp                               553               323    41.59%         178                87    51.12%        1185               676    42.95%         292               212    27.40%
Interpreters/Context.h                                  13                 5    61.54%          13                 5    61.54%          13                 5    61.54%           0                 0         -
Server/IServer.h                                         1                 1     0.00%           1                 1     0.00%           1                 1     0.00%           0                 0         -
Server/MockComputeClient.h                               4                 1    75.00%           2                 0   100.00%          10                 3    70.00%           2                 1    50.00%
TestUtils/ExecutorTestUtils.cpp                         31                 2    93.55%          13                 1    92.31%         109                 5    95.41%          14                 0   100.00%
TestUtils/ExecutorTestUtils.h                            6                 2    66.67%           3                 0   100.00%          18                 6    66.67%           6                 3    50.00%
TestUtils/MPPTaskTestUtils.h                             2                 0   100.00%           2                 0   100.00%          12                 0   100.00%           0                 0         -
TestUtils/mockExecutor.cpp                              76                 4    94.74%          43                 2    95.35%         276                27    90.22%          38                 2    94.74%
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                 2807              1510    46.21%         462               169    63.42%        4758              2071    56.47%        1308               809    38.15%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
18991      9229             51.40%    214903  94015        56.25%

full coverage report (for internal network access only)

@ywqzzy
Copy link
Contributor Author

ywqzzy commented Aug 2, 2022

/run-integration-test

@ywqzzy ywqzzy requested a review from windtalker August 2, 2022 07:51
@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 Aug 3, 2022
@Lloyd-Pottiger
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

@Lloyd-Pottiger: 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: 78dccd3

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

SeaRise commented Aug 3, 2022

/run-all-tests

@sre-bot
Copy link
Collaborator

sre-bot commented Aug 3, 2022

Coverage for changed files

Filename                                           Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Debug/dbgFuncCoprocessor.cpp                           430               320    25.58%          39                27    30.77%         882               601    31.86%         292               220    24.66%
Debug/dbgFuncCoprocessor.h                               1                 0   100.00%           1                 0   100.00%           1                 0   100.00%           0                 0         -
Flash/Coprocessor/DAGContext.cpp                       101                42    58.42%          25                 6    76.00%         173                53    69.36%          68                39    42.65%
Flash/Coprocessor/DAGContext.h                          38                 9    76.32%          29                 7    75.86%          88                22    75.00%          12                 6    50.00%
Flash/Coprocessor/DAGQueryBlockInterpreter.cpp         228                30    86.84%          33                 2    93.94%         605                63    89.59%         150                30    80.00%
Flash/Coprocessor/InterpreterUtils.cpp                  45                 6    86.67%           9                 0   100.00%         139                 9    93.53%          34                 7    79.41%
Flash/Coprocessor/MockSourceStream.h                    21                 2    90.48%           1                 0   100.00%          34                 0   100.00%          14                 2    85.71%
Flash/Coprocessor/TablesRegionsInfo.cpp                 41                38     7.32%           5                 4    20.00%          62                52    16.13%          26                24     7.69%
Flash/CoprocessorHandler.cpp                           163               163     0.00%           5                 5     0.00%         129               129     0.00%          40                40     0.00%
Flash/CoprocessorHandler.h                               1                 1     0.00%           1                 1     0.00%           1                 1     0.00%           0                 0         -
Flash/FlashService.cpp                                 397               319    19.65%          18                11    38.89%         327               249    23.85%         102                86    15.69%
Flash/FlashService.h                                     5                 3    40.00%           4                 2    50.00%          14                 7    50.00%           0                 0         -
Flash/Mpp/MPPTask.cpp                                  496               197    60.28%          27                 8    70.37%         431               161    62.65%         178               113    36.52%
Flash/tests/gtest_aggregation_executor.cpp             115                28    75.65%           7                 0   100.00%         179                 1    99.44%          28                16    42.86%
Flash/tests/gtest_compute_server.cpp                    39                14    64.10%           3                 0   100.00%          69                 0   100.00%          12                 8    33.33%
Interpreters/Context.cpp                               553               323    41.59%         178                87    51.12%        1185               676    42.95%         292               212    27.40%
Interpreters/Context.h                                  13                 5    61.54%          13                 5    61.54%          13                 5    61.54%           0                 0         -
Server/IServer.h                                         1                 1     0.00%           1                 1     0.00%           1                 1     0.00%           0                 0         -
Server/MockComputeClient.h                               4                 1    75.00%           2                 0   100.00%          10                 3    70.00%           2                 1    50.00%
TestUtils/ExecutorTestUtils.cpp                         31                 2    93.55%          13                 1    92.31%         109                 5    95.41%          14                 0   100.00%
TestUtils/ExecutorTestUtils.h                            6                 2    66.67%           3                 0   100.00%          18                 6    66.67%           6                 3    50.00%
TestUtils/MPPTaskTestUtils.h                             2                 0   100.00%           2                 0   100.00%          12                 0   100.00%           0                 0         -
TestUtils/mockExecutor.cpp                              76                 4    94.74%          43                 2    95.35%         276                27    90.22%          38                 2    94.74%
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                 2807              1510    46.21%         462               169    63.42%        4758              2071    56.47%        1308               809    38.15%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
19015      9233             51.44%    215349  94007        56.35%

full coverage report (for internal network access only)

@ti-chi-bot ti-chi-bot merged commit 3153a3b into pingcap:master Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. 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.

6 participants