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

Feature: cache timestamp.json to accelerate #1212

Merged
merged 8 commits into from
Mar 16, 2021

Conversation

lucklove
Copy link
Member

What problem does this PR solve?

We implemented a base function, ensureManifests(), which will fetch n.root.json and timestamp.json, and if the timestamp.json is a new one, fetch snapshot.json and {component}.json.

However, there are many places invoke ensureManifests() and TiUP will fetch timestamp.json and root.json many times even though there is no change on them, which cause TiUP run slowly.

What is changed and how it works?

Cache timestamp.json in memory so that TiUP will only fetch it once every time the user execute TiUP command.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Code changes

  • Has exported function/method change
  • Has exported variable/fields change
  • Has interface methods change
  • Has persistent data change

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Release notes:

NONE

@ti-chi-bot ti-chi-bot requested review from lonng and nrc March 15, 2021 09:38
@ti-chi-bot ti-chi-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 15, 2021
@codecov-io
Copy link

codecov-io commented Mar 15, 2021

Codecov Report

Merging #1212 (b0205f7) into master (c9376f1) will decrease coverage by 4.63%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1212      +/-   ##
==========================================
- Coverage   52.43%   47.79%   -4.64%     
==========================================
  Files         289      288       -1     
  Lines       20563    20564       +1     
==========================================
- Hits        10782     9829     -953     
- Misses       8085     9021     +936     
- Partials     1696     1714      +18     
Flag Coverage Δ
cluster 44.90% <83.33%> (+1.23%) ⬆️
dm 25.54% <83.33%> (-0.04%) ⬇️
integrate 47.79% <100.00%> (+0.96%) ⬆️
playground 3.09% <0.00%> (-0.01%) ⬇️
tiup 16.53% <100.00%> (+0.05%) ⬆️
unittest ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cmd/mirror.go 48.71% <100.00%> (+0.11%) ⬆️
pkg/repository/v1_repository.go 51.25% <100.00%> (-11.76%) ⬇️
components/dm/ansible/worker.go 0.00% <0.00%> (-100.00%) ⬇️
pkg/meta/err.go 0.00% <0.00%> (-81.25%) ⬇️
pkg/telemetry/scrub.go 6.66% <0.00%> (-80.00%) ⬇️
pkg/cluster/api/error.go 0.00% <0.00%> (-80.00%) ⬇️
pkg/telemetry/telemetry.go 0.00% <0.00%> (-68.43%) ⬇️
pkg/utils/error.go 0.00% <0.00%> (-63.64%) ⬇️
components/dm/ansible/import.go 0.00% <0.00%> (-62.70%) ⬇️
pkg/cluster/executor/local.go 0.00% <0.00%> (-55.72%) ⬇️
... and 51 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eb23b23...8ddf0f4. Read the comment docs.

@AstroProfundis AstroProfundis added category/usability Categorizes issue or PR as a usability enhancement. type/enhancement Categorizes issue or PR as related to an enhancement. labels Mar 16, 2021
@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • AstroProfundis

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 writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 16, 2021
@AstroProfundis
Copy link
Contributor

/hold

unit tests are failing

@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 Mar 16, 2021
@ti-chi-bot ti-chi-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 16, 2021
@AstroProfundis
Copy link
Contributor

/unhold

/merge

@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 Mar 16, 2021
@ti-chi-bot
Copy link
Member

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

Commit hash: 8ddf0f4

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 16, 2021
@ti-chi-bot ti-chi-bot merged commit f9b0a7d into pingcap:master Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category/usability Categorizes issue or PR as a usability enhancement. size/M Denotes a PR that changes 30-99 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/enhancement Categorizes issue or PR as related to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants