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

fix: should get the really leader count when scale in #885

Merged
merged 3 commits into from
Apr 22, 2024

Conversation

drivebyer
Copy link
Collaborator

@drivebyer drivebyer commented Apr 21, 2024

Description

close #860

The operator should rely on the actual status queried from the redis cluster, not just the status it assumes. Otherwise, we might end up with outdated information, leading to downsizing even when the desired leader count is met.

when i scale in cluster from 6 shards to 3 shards, the log Redis cluster is downscaling show more than 3 times.
see:

{"level":"info","ts":"2024-04-21T14:23:18+08:00","logger":"controllers.RedisCluster","msg":"Redis cluster is downscaling...","Request.Namespace":"default","Request.Name":"redis-cluster-v1beta2","Ready.ReadyLeaderReplicas":6,"Expected.ReadyLeaderReplicas":3}
{"level":"info","ts":"2024-04-21T14:23:18+08:00","logger":"controllers.RedisCluster","msg":"Redis cluster is downscaling","Request.Namespace":"default","Request.Name":"redis-cluster-v1beta2","The times of loop":0}
{"level":"info","ts":"2024-04-21T14:24:58+08:00","logger":"controllers.RedisCluster","msg":"Redis cluster is downscaling","Request.Namespace":"default","Request.Name":"redis-cluster-v1beta2","The times of loop":1}
{"level":"info","ts":"2024-04-21T14:26:31+08:00","logger":"controllers.RedisCluster","msg":"Redis cluster is downscaling","Request.Namespace":"default","Request.Name":"redis-cluster-v1beta2","The times of loop":2}
{"level":"info","ts":"2024-04-21T14:27:51+08:00","logger":"controllers.RedisCluster","msg":"Redis cluster is downscaled... Rebalancing the cluster","Request.Namespace":"default","Request.Name":"redis-cluster-v1beta2"}
{"level":"info","ts":"2024-04-21T14:29:57+08:00","logger":"controllers.RedisCluster","msg":"Redis cluster is downscaled... Rebalancing the cluster is done","Request.Namespace":"default","Request.Name":"redis-cluster-v1beta2"}
{"level":"info","ts":"2024-04-21T14:29:58+08:00","logger":"controllers.RedisCluster","msg":"Reconciling opstree redis Cluster controller","Request.Namespace":"default","Request.Name":"redis-cluster-v1beta2"}
{"level":"info","ts":"2024-04-21T14:29:58+08:00","logger":"controllers.RedisCluster","msg":"Redis cluster is downscaling...","Request.Namespace":"default","Request.Name":"redis-cluster-v1beta2","Ready.ReadyLeaderReplicas":6,"Expected.ReadyLeaderReplicas":3}
{"level":"info","ts":"2024-04-21T14:29:58+08:00","logger":"controllers.RedisCluster","msg":"Redis cluster is downscaling","Request.Namespace":"default","Request.Name":"redis-cluster-v1beta2","The times of loop":0}

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • Tests have been added/modified and all tests pass.
  • Functionality/bugs have been confirmed to be unchanged or fixed.
  • I have performed a self-review of my own code.

Additional Context

Signed-off-by: drivebyer <yang.wu@daocloud.io>
@drivebyer drivebyer added the bug Something isn't working label Apr 21, 2024
@drivebyer drivebyer requested a review from shubham-cmyk April 21, 2024 06:38
Copy link

codecov bot commented Apr 21, 2024

Codecov Report

Attention: Patch coverage is 0% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 39.57%. Comparing base (d121d86) to head (59ad503).
Report is 29 commits behind head on master.

Files Patch % Lines
controllers/rediscluster_controller.go 0.00% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #885      +/-   ##
==========================================
+ Coverage   35.20%   39.57%   +4.37%     
==========================================
  Files          19       19              
  Lines        3213     2656     -557     
==========================================
- Hits         1131     1051      -80     
+ Misses       2015     1536     -479     
- Partials       67       69       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: drivebyer <yang.wu@daocloud.io>
Signed-off-by: drivebyer <yang.wu@daocloud.io>
@drivebyer drivebyer enabled auto-merge (squash) April 22, 2024 08:37
@drivebyer drivebyer merged commit 736836c into OT-CONTAINER-KIT:master Apr 22, 2024
28 of 29 checks passed
@drivebyer drivebyer deleted the fix-scale-in branch April 22, 2024 08:55
mattrobinsonsre pushed a commit to mattrobinsonsre/redis-operator that referenced this pull request Jul 11, 2024
…IT#885)

* fix: should get the really leader count when scale in

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix timeout

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix test

Signed-off-by: drivebyer <yang.wu@daocloud.io>

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
Signed-off-by: Matt Robinson <mattrobinsonsre@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cluster broken when it scale-in
2 participants