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

RadisChaos: Add Cache Expiration #175

Merged
merged 6 commits into from
Jun 19, 2022

Conversation

FingerLeader
Copy link
Member

Signed-off-by: FingerLeader wanxfinger@gmail.com

Signed-off-by: FingerLeader <wanxfinger@gmail.com>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented May 30, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • WangXiangUSTC
  • cwen0

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.

cmd/attack/redis.go Outdated Show resolved Hide resolved
pkg/core/redis.go Show resolved Hide resolved
pkg/server/chaosd/redis.go Outdated Show resolved Hide resolved
pkg/server/chaosd/redis.go Outdated Show resolved Hide resolved
@FingerLeader
Copy link
Member Author

I find option can not work well, I will figure it out as soon as possible.

@FingerLeader
Copy link
Member Author

I find option can not work well, I will figure it out as soon as possible.

It works now

Signed-off-by: FingerLeader <wanxfinger@gmail.com>
@ti-chi-bot ti-chi-bot added size/M and removed size/L labels May 31, 2022
Copy link
Collaborator

@WangXiangUSTC WangXiangUSTC left a comment

Choose a reason for hiding this comment

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

Please fix the ci, rest LGTM

Signed-off-by: FingerLeader <wanxfinger@gmail.com>
Signed-off-by: FingerLeader <wanxfinger@gmail.com>
Signed-off-by: FingerLeader <wanxfinger@gmail.com>
Copy link
Collaborator

@WangXiangUSTC WangXiangUSTC left a comment

Choose a reason for hiding this comment

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

LGTM

cmd.Flags().StringVarP(&options.Addr, "addr", "a", "", "The address of redis server")
cmd.Flags().StringVarP(&options.Password, "password", "p", "", "The password of server")
cmd.Flags().StringVarP(&options.Key, "key", "k", "", "The key to be set a expiration, default expire all keys")
cmd.Flags().StringVarP(&options.Expiration, "expiration", "", "0", "The expiration of the key")
Copy link
Member

Choose a reason for hiding this comment

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

Does this flag represent expiration time? Can we add an example of this flag?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, and I'll enrich the description of expiration.

@@ -60,6 +64,10 @@ func (r *RedisCommand) Validate() error {
if r.CacheSize != "0" && r.Percent != "" {
return errors.New("only one of cachesize and percent can be set")
}
case RedisCacheExpirationAction:
if r.Option != "" && r.Option != "XX" && r.Option != "NX" && r.Option != "GT" && r.Option != "LT" {
Copy link
Member

Choose a reason for hiding this comment

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

This check is ugly. We can add use a map or an array to improve it.

}

func ExpireFunc(cli *redis.Client, key string, expiration time.Duration, option string) *redis.BoolCmd {
if option == "NX" {
Copy link
Member

Choose a reason for hiding this comment

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

I prefer to use switch instead of if else

@cwen0
Copy link
Member

cwen0 commented Jun 14, 2022

@FingerLeader PTAL

Signed-off-by: FingerLeader <wanxfinger@gmail.com>
@ti-chi-bot ti-chi-bot added size/L and removed size/M labels Jun 17, 2022
@cwen0 cwen0 self-requested a review June 18, 2022 05:49
Copy link
Member

@cwen0 cwen0 left a comment

Choose a reason for hiding this comment

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

LGTM

@cwen0
Copy link
Member

cwen0 commented Jun 19, 2022

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: e5a349c

@ti-chi-bot ti-chi-bot merged commit e4cabb4 into chaos-mesh:main Jun 19, 2022
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.

None yet

4 participants