Skip to content

resolved_ts: return early after regions already had quorum#11352

Merged
ti-chi-bot merged 11 commits intotikv:masterfrom
5kbpers:fix-resolved-ts
Nov 24, 2021
Merged

resolved_ts: return early after regions already had quorum#11352
ti-chi-bot merged 11 commits intotikv:masterfrom
5kbpers:fix-resolved-ts

Conversation

@5kbpers
Copy link
Member

@5kbpers 5kbpers commented Nov 12, 2021

Signed-off-by: 5kbpers tangminghua@pingcap.com

What problem does this PR solve?

Issue Number: close #11351

Problem Summary:

What is changed and how it works?

What's Changed:

  • export region_resolved_ts_store from resolved_ts and import it in cdc
  • use select_all instead of join_all for returning early

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Integration test

Release note

Fix resolved ts lag increased after stoping a tikv

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Nov 12, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • NingLin-P
  • overvenus

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 Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 12, 2021
5kbpers and others added 2 commits November 12, 2021 12:40
Signed-off-by: 5kbpers <tangminghua@pingcap.com>
@5kbpers
Copy link
Member Author

5kbpers commented Nov 19, 2021

/run-all-tests

5kbpers added 2 commits November 19, 2021 15:40
Signed-off-by: 5kbpers <tangminghua@pingcap.com>
Copy link
Member

@NingLin-P NingLin-P left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 19, 2021
@0xPoe
Copy link
Member

0xPoe commented Nov 19, 2021

/run-integration-cdc-test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>
@0xPoe
Copy link
Member

0xPoe commented Nov 19, 2021

/run-integration-cdc-test

})
.collect();
for _ in 0..store_count {
let (res, _, remains) = select_all(stores).await;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add comments on why using select_all as opposed to the original solution using join_all?

let leader_info_size = store_map
.values()
.next()
.map_or(0, |regions| regions[0].compute_size());
Copy link
Contributor

Choose a reason for hiding this comment

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

Can there be 0 regions?

// region_id -> peers id, record the responses
let mut resp_map: HashMap<u64, Vec<u64>> = HashMap::default();
// region_id -> `(Vec<Peer>, LeaderInfo)`
let info_map = region_read_progress.dump_leader_infos(&regions);
Copy link
Contributor

Choose a reason for hiding this comment

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

How expensive is this function?

Copy link
Member Author

Choose a reason for hiding this comment

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

O(n), n is the number of regions

5kbpers and others added 3 commits November 23, 2021 14:05
Signed-off-by: 5kbpers <tangminghua@pingcap.com>

Co-authored-by: Zixiong Liu <liuzixiong@pingcap.com>
Signed-off-by: 5kbpers <tangminghua@pingcap.com>
Signed-off-by: 5kbpers <tangminghua@pingcap.com>
Comment on lines +261 to +266
let cb = ChannelBuilder::new(env.clone());
let channel = security_mgr.connect(cb, &store.address);
tikv_clients
.lock()
.unwrap()
.insert(store_id, TikvClient::new(channel));
Copy link
Member

Choose a reason for hiding this comment

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

When do we release these connections?

Copy link
Member

Choose a reason for hiding this comment

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

There is an issue #11400 about it, I think we can fix it in another PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

After some requests failed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

5kbpers added 2 commits November 24, 2021 16:31
Signed-off-by: 5kbpers <tangminghua@pingcap.com>
@5kbpers
Copy link
Member Author

5kbpers commented Nov 24, 2021

/run-all-tests

Copy link
Member

@overvenus overvenus left a comment

Choose a reason for hiding this comment

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

LGTM

@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 Nov 24, 2021
@5kbpers
Copy link
Member Author

5kbpers commented Nov 24, 2021

/merge

@ti-chi-bot
Copy link
Member

@5kbpers: 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: a542652

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 24, 2021
ti-srebot pushed a commit to ti-srebot/tikv that referenced this pull request Dec 2, 2021
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-5.3 in PR #11537

@ti-srebot
Copy link
Contributor

cherry pick to release-5.0 in PR #11538

@ti-srebot
Copy link
Contributor

cherry pick to release-5.2 in PR #11539

@ti-srebot
Copy link
Contributor

cherry pick to release-5.1 in PR #11540

@hicqu hicqu deleted the fix-resolved-ts branch December 10, 2021 07:22
hicqu added a commit to hicqu/tikv that referenced this pull request Dec 10, 2021
* close tikv#11351

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix tests

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix tests

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Apply suggestions from code review

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

Co-authored-by: Zixiong Liu <liuzixiong@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* make clippy happy

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* close tikv#11400

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

Co-authored-by: qupeng <qupeng@pingcap.com>
Co-authored-by: Zixiong Liu <liuzixiong@pingcap.com>
Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
hicqu added a commit that referenced this pull request Dec 10, 2021
* resolved_ts: return early after regions already had quorum (#11352)

* close #11351

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix tests

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix tests

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Apply suggestions from code review

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

Co-authored-by: Zixiong Liu <liuzixiong@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* make clippy happy

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* close #11400

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

Co-authored-by: qupeng <qupeng@pingcap.com>
Co-authored-by: Zixiong Liu <liuzixiong@pingcap.com>
Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>

* Support to iterate table properties for KvEngine  (#11388)

* support to iterate table properties for KvEngine
* close #11387

Signed-off-by: qupeng <qupeng@pingcap.com>

* cdc: introduce TsFilter into incremental scan (#11385)

* close #11384

Signed-off-by: qupeng <qupeng@pingcap.com>

* support to get approximate keys and size for a given range from UserCollectedProperties (#11465)

Signed-off-by: qupeng <qupeng@pingcap.com>

Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>

* cherry pick pr #11615

Signed-off-by: qupeng <qupeng@pingcap.com>

Co-authored-by: 5kbpers <tangminghua@pingcap.com>
Co-authored-by: Zixiong Liu <liuzixiong@pingcap.com>
Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
zhouqiang-cl pushed a commit that referenced this pull request Dec 21, 2021
…11538)

* ref #11351

Signed-off-by: 5kbpers <tangminghua@pingcap.com>
sticnarf pushed a commit to ti-srebot/tikv that referenced this pull request Feb 8, 2022
… (tikv#11538)

* ref tikv#11351

Signed-off-by: 5kbpers <tangminghua@pingcap.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
ti-chi-bot pushed a commit that referenced this pull request Feb 8, 2022
…11540)

close #11351, ref #11352

Signed-off-by: 5kbpers <tangminghua@pingcap.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>

Co-authored-by: qupeng <qupeng@pingcap.com>
ti-chi-bot added a commit that referenced this pull request Feb 21, 2022
…11537)

close #11351, ref #11352

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
Signed-off-by: 5kbpers <tangminghua@pingcap.com>

Co-authored-by: 5kbpers <tangminghua@pingcap.com>
Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
5kbpers pushed a commit to ti-srebot/tikv that referenced this pull request Apr 14, 2022
Signed-off-by: 5kbpers <tangminghua@pingcap.com>
ti-chi-bot pushed a commit that referenced this pull request Apr 14, 2022
…11539)

close #11351, ref #11352

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

Co-authored-by: 5kbpers <tangminghua@pingcap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-cherry-pick-release-5.0 Type: Need cherry pick to release 5.0 needs-cherry-pick-release-5.1 Type: Need cherry pick to release 5.1 needs-cherry-pick-release-5.2 Type: Need cherry pick to release-5.2 needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 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.

resolved ts lag increased after stoping a tikv

8 participants