Skip to content

Remove TxnMergeTree from the Raft layer#3563

Merged
ti-chi-bot merged 7 commits intopingcap:masterfrom
JaySon-Huang:remove_merge_tree_1
Nov 30, 2021
Merged

Remove TxnMergeTree from the Raft layer#3563
ti-chi-bot merged 7 commits intopingcap:masterfrom
JaySon-Huang:remove_merge_tree_1

Conversation

@JaySon-Huang
Copy link
Contributor

What problem does this PR solve?

Issue Number: a part of #3481

Problem Summary:

What is changed and how it works?

  • Move BackgroundProcessingPool into Storages level
  • Do NOT generate TxnMergeTree in the Raft layer
  • Remove codes for optimizing TxnMergeTree table

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

Signed-off-by: JaySon-Huang <jayson.hjs@gmail.com>
Signed-off-by: JaySon-Huang <jayson.hjs@gmail.com>
Signed-off-by: JaySon-Huang <jayson.hjs@gmail.com>
Signed-off-by: JaySon-Huang <jayson.hjs@gmail.com>
Signed-off-by: JaySon-Huang <jayson.hjs@gmail.com>
@JaySon-Huang JaySon-Huang added the type/code-quality-improvement PR that can improve the code quality label Nov 29, 2021
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Nov 29, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • SchrodingerZhu

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.

Details

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-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 29, 2021
Signed-off-by: JaySon-Huang <jayson.hjs@gmail.com>
@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

Signed-off-by: JaySon-Huang <jayson.hjs@gmail.com>
@sre-bot
Copy link
Collaborator

sre-bot commented Nov 29, 2021

Coverage detail: https://ci-internal.pingcap.net/job/tics_ghpr_unit_test/212/cobertura/
(Coverage detail url is limited office network access)

lines: 37.5% (44401 out of 118427)
branches: 5.5% (67153 out of 1215349)

@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

@JaySon-Huang JaySon-Huang mentioned this pull request Nov 29, 2021
12 tasks
@sre-bot
Copy link
Collaborator

sre-bot commented Nov 29, 2021

Coverage detail: https://ci-internal.pingcap.net/job/tics_ghpr_unit_test/213/cobertura/
(Coverage detail url is limited office network access)

lines: 37.6% (44488 out of 118427)
branches: 5.5% (67238 out of 1215349)

Copy link
Contributor

@SchrodingerZhu SchrodingerZhu left a comment

Choose a reason for hiding this comment

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

large change. but LGTM.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 30, 2021
@JaySon-Huang
Copy link
Contributor Author

/cc @solotzg @fuzhe1989

@JaySon-Huang JaySon-Huang mentioned this pull request Nov 30, 2021
6 tasks
Copy link
Contributor Author

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

The main changes are listed below:

{
switch (storage->engineType())
{
case TiDB::StorageEngine::TMT:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

.

Comment on lines -293 to -298
if (auto & tmt = context->getTMTContext(); !tmt.isBgFlushDisabled())
{
/// All regions of this table is removed, the storage maybe drop or pd
/// move it to another node, we can optimize outdated data.
table_to_optimize.insert(table_id);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

.

Comment on lines -949 to -962
if (table_info.engine_type == TiDB::StorageEngine::TMT)
{
writeString(") Engine = TxnMergeTree((", stmt_buf);
for (size_t i = 0; i < pks.size(); i++)
{
if (i > 0)
writeString(", ", stmt_buf);
writeBackQuotedString(pks[i], stmt_buf);
}
writeString("), 8192, '", stmt_buf);
writeEscapedString(table_info.serialize(), stmt_buf);
writeString("')", stmt_buf);
}
else if (table_info.engine_type == TiDB::StorageEngine::DT)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

.

Comment on lines -33 to -39
// if all regions of table is removed, try to optimize data.
if (auto table_id = region_table.popOneTableToOptimize(); table_id != InvalidTableID)
{
LOG_INFO(log, "try to final optimize table " << table_id);
tryOptimizeStorageFinal(tmt.getContext(), table_id);
LOG_INFO(log, "finish final optimize table " << table_id);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

.

Copy link
Contributor

@solotzg solotzg left a comment

Choose a reason for hiding this comment

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

lgtm

@JaySon-Huang
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

@JaySon-Huang: 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.

Details

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.

DetailsCommit hash: 2d12323

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 30, 2021
@ti-chi-bot ti-chi-bot merged commit aa23342 into pingcap:master Nov 30, 2021
@JaySon-Huang JaySon-Huang deleted the remove_merge_tree_1 branch November 30, 2021 04:18
@sre-bot
Copy link
Collaborator

sre-bot commented Nov 30, 2021

Coverage detail: https://ci-internal.pingcap.net/job/tics_ghpr_unit_test/215/cobertura/
(Coverage detail url is limited office network access)

lines: 37.5% (44399 out of 118427)
branches: 5.5% (67155 out of 1215349)

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/LGT1 Indicates that a PR has LGTM 1. type/code-quality-improvement PR that can improve the code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants