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

keyspace: Refactor keyspace manager using RunInTxn #5843

Merged
merged 21 commits into from
Jan 11, 2023

Conversation

AmoebaProtozoa
Copy link
Contributor

@AmoebaProtozoa AmoebaProtozoa commented Jan 9, 2023

What problem does this PR solve?

Issue Number: Ref #5293

Previous PR #5347 added ability to batch multiple kv operations into a single RunInTxn style execution block, this PR uses that to refactor Keyspace manager.

In addition, a new keyspace state tombstone is added to denote that user data related to keyspace has been completely removed from storage.

It also updates kvproto to pingcap/kvproto#1033

What is changed and how does it work?

Check List

Tests

  • Unit test
  • Integration test

Release note

None.

Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
# Conflicts:
#	pkg/storage/kv/etcd_kv.go
#	pkg/storage/kv/levedb_kv.go
Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jan 9, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • disksing
  • nolouch

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 do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Jan 9, 2023
@ti-chi-bot
Copy link
Member

Hi @AmoebaProtozoa. Thanks for your PR.

I'm waiting for a tikv member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 kubernetes/test-infra repository.

Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Jan 9, 2023

Codecov Report

Base: 74.85% // Head: 75.48% // Increases project coverage by +0.62% 🎉

Coverage data is based on head (c9b07ba) compared to base (59a6203).
Patch coverage: 68.80% of modified lines in pull request are covered.

❗ Current head c9b07ba differs from pull request most recent head 07f70cd. Consider uploading reports for the commit 07f70cd to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5843      +/-   ##
==========================================
+ Coverage   74.85%   75.48%   +0.62%     
==========================================
  Files         337      338       +1     
  Lines       33941    33983      +42     
==========================================
+ Hits        25406    25651     +245     
+ Misses       6351     6126     -225     
- Partials     2184     2206      +22     
Flag Coverage Δ
unittests 75.48% <68.80%> (+0.62%) ⬆️

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

Impacted Files Coverage Δ
client/metrics.go 100.00% <ø> (ø)
server/server.go 75.12% <33.33%> (+0.41%) ⬆️
client/keyspace_client.go 63.63% <66.66%> (+1.41%) ⬆️
server/keyspace/keyspace.go 70.38% <67.27%> (+5.58%) ⬆️
server/keyspace_service.go 61.19% <71.42%> (+5.63%) ⬆️
pkg/storage/endpoint/keyspace.go 74.35% <76.92%> (-5.65%) ⬇️
server/keyspace/util.go 85.71% <100.00%> (ø)
pkg/dashboard/adapter/manager.go 81.60% <0.00%> (-6.90%) ⬇️
server/tso/tso.go 70.22% <0.00%> (-1.69%) ⬇️
pkg/utils/etcdutil/etcdutil.go 84.88% <0.00%> (-1.17%) ⬇️
... and 32 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@AmoebaProtozoa AmoebaProtozoa mentioned this pull request Jan 10, 2023
11 tasks
@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/needs-linked-issue do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jan 10, 2023
Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
@AmoebaProtozoa AmoebaProtozoa changed the title [DNM] keyspace: Refactor keyspace manager using RunInTxn keyspace: Refactor keyspace manager using RunInTxn Jan 10, 2023
Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
@AmoebaProtozoa AmoebaProtozoa marked this pull request as ready for review January 10, 2023 08:46
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 10, 2023
server/server.go Outdated Show resolved Hide resolved
Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
Copy link
Contributor

@nolouch nolouch left a comment

Choose a reason for hiding this comment

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

LGTM

//
// ENABLED -> {ENABLED, DISABLED}
// DISABLED -> {ENABLED, DISABLED, ARCHIVED}
// ARCHIVED -> {ARCHIVED, TOMBSTONE}
Copy link
Contributor

Choose a reason for hiding this comment

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

What the different between the {ARCHIVED, TOMBSTONE}?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Archive is used to denote that keyspace's corresponding data in store nodes are safe to remove/ currently being removed (or being archived into cold storage somewhere else), a point of no return for the keyspace (as oppose to disabled which means data are still intact). This tells gc worker to keep cleaning up data belong to this keyspace.

Tombstone is used to denote that keyspace's data in storage has been completely removed, gc worker can safely skip gcing this keyspace

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jan 11, 2023
@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 Jan 11, 2023
@disksing
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

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

/run-all-tests

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: c9b07ba

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jan 11, 2023
@disksing
Copy link
Contributor

/test build

@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Jan 11, 2023
Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
@disksing
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

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

/run-all-tests

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: 07f70cd

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jan 11, 2023
@disksing
Copy link
Contributor

/test run

@ti-chi-bot
Copy link
Member

@disksing: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test build

Use /test all to run all jobs.

In response to this:

/test run

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 kubernetes/test-infra repository.

@disksing
Copy link
Contributor

/test build

@ti-chi-bot ti-chi-bot merged commit bac5bf4 into tikv:master Jan 11, 2023
@AmoebaProtozoa AmoebaProtozoa deleted the RefactorKeyspaceManager branch January 11, 2023 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. release-note-none Denotes a PR that doesn't merit a release note. 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.

5 participants