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

feat(tiup-worker): add distribute publishing lock #208

Merged
merged 1 commit into from
Dec 1, 2024

Conversation

wuhuizuo
Copy link
Contributor

@wuhuizuo wuhuizuo commented Dec 1, 2024

Implement the lock with redlock on redis

Signed-off-by: wuhuizuo [email protected]

Implement the lock with redlock on redis

Signed-off-by: wuhuizuo <[email protected]>
@ti-chi-bot ti-chi-bot bot requested a review from purelind December 1, 2024 10:03
Copy link

ti-chi-bot bot commented Dec 1, 2024

I have already done a preliminary review for you, and I hope to help you do a better job.

The key change is that the PR implements a distributed lock with redlock on Redis, which prevents multiple instances of the same program from executing the same code simultaneously. This will be useful in the case where multiple instances of the same program attempt to publish a package at the same time.

There are no apparent problems with the changes made in this PR. However, one suggestion to improve the code quality is to extract the mutex-related variables into constants or variables at the package level, and to add unit tests to verify the correctness of the locking mechanism.

Another suggestion is to add more descriptive error messages for debugging purposes. This will make it easier to diagnose any issues that may arise in the future.

Overall, the changes made in this PR seem to be well thought out and implemented. The author has done a good job of adding a distributed lock to prevent race conditions, and the changes are likely to be beneficial to the codebase.

@ti-chi-bot ti-chi-bot bot added the size/M label Dec 1, 2024
@wuhuizuo
Copy link
Contributor Author

wuhuizuo commented Dec 1, 2024

/approve

Copy link

ti-chi-bot bot commented Dec 1, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wuhuizuo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the approved label Dec 1, 2024
@ti-chi-bot ti-chi-bot bot merged commit f0b4200 into main Dec 1, 2024
7 checks passed
@ti-chi-bot ti-chi-bot bot deleted the feature/add-publishing-redis-lock branch December 1, 2024 10:11
ti-chi-bot bot pushed a commit to PingCAP-QE/ee-ops that referenced this pull request Dec 2, 2024
…-15-gf0b4200 (#1361)

Deploy with feature: PingCAP-QE/ee-apps#208

Signed-off-by: wuhuizuo <[email protected]>

Signed-off-by: wuhuizuo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant