Closed srteam2020 closed 3 years ago
You shouldn't be able to trigger 2 operations. You're saying you changed it from 3 to 2 to 1. You should be able to change to 2 but not to 1 until the change has been applied. To me it seems kind of a hack to trigger 2 operations but yeah it should be prevented if it's not.
Let me know if the issue still makes sense otherwise we'll close it.
Thanks
@cscetbon Thanks for the follow up. You can close this issue and we will go back if we figure out how to scale the cassandra cluster rack correctly.
Bug Report
The casskop operator has the following steps to prevent user from removing more than 1 DC at a time,
annotation
when finish one reconcileannotation
We ran a workload to change DC size from 3 to 2 to 1. Ideally, the DC will finally be scaled down to 1. However, we observed that the DC is not scaled at the end (still remaining size of 3).
The reason is that the goroutine of performing reconciliation (g1) and the goroutine of updating the cassandraCluster object (g2) are concurrent, and certain interleaving of the two goroutines can lead to the unexpected scaling behavior. Ideally, the following interleaving will lead to the correct result:
And we find that the following interleaving can lead to the unexpected scaling behavior mentioned above:
What did you do? We ran a scaledown workload changing DC size from 3 to 2 to 1.
What did you expect to see? The cassandra DC should end up with 1 replica.
What did you see instead? Under which circumstances? The cassandra DC has 3 replicas at the end.
Environment
casskop version: f87c8e05c1a2896732fc5f3a174f1eb99e936907 (master branch)
Kubernetes version information: 1.18.9
Cassandra version: 3.11
Additional context We are willing to send a PR to help fix this issue. One potential fix we are considering here is that: In step 4, when the operator finds that "user is going to remove more than 1 DC at a time", instead of setting back to the old value stored in
annotation
(which will totally block the scaling down), we can set back to the old value - 1. So that even if the operator misses some intermediate events, the scaling down will still happen gracefully (scaling one by one) and smoothly. Please let us know if the potential fix is reasonable or not.