mysql-operator icon indicating copy to clipboard operation
mysql-operator copied to clipboard

How to disable Pvc Cleaner?

Open chenmin1992 opened this issue 6 years ago • 9 comments

https://github.com/presslabs/mysql-operator/pull/140/files#diff-fd332df34b6a8aed6f6e0cb14b640f07R203

I just think that PVC should stay or the data will be lost. I think there would an option that controls the behavior of how the operator manages PVC for data safe purpose.

chenmin1992 avatar Nov 06 '19 08:11 chenmin1992

Hi @chenmin1992, Ther is no method to disable the PVC cleaner but the operator does not delete the data for node 0, in any case, so your data is safe. Indeed there may be some corner cases that require more attention(what I'm thinking about is when you scale the cluster down to 1 replica and node 0 is not up-to-date and you can lose data).

Also, if the cluster is scaled down its essential to remove the PVC because after a while the data from that PVC become obsolete and when the cluster is scaled back up the replication will fail.

Please give me more details of what do you think about how the operator should manage PVCs.

AMecea avatar Nov 06 '19 13:11 AMecea

@AMecea For me the only feature request here would be handling the "node 0 is out of date" case (maybe refuse to scale down to a number that stops the current master?)

abh avatar Nov 06 '19 20:11 abh

@AMecea No, in my test case, PVC for node 0 is also deleted when deleting the mysqlcluster customresource haodai1. WX20191107-101348

chenmin1992 avatar Nov 07 '19 02:11 chenmin1992

Maybe the OwnerReferences delete the PVC associated with node 0.

chenmin1992 avatar Nov 07 '19 02:11 chenmin1992

Yes, after deleting OwnerReferences, the PVC-0 won't be deleted.

chenmin1992 avatar Nov 07 '19 02:11 chenmin1992

length of the parameter of ensureVolumeClaimTemplates is always 0 so far.

chenmin1992 avatar Nov 07 '19 03:11 chenmin1992

Hi @chenmin1992, the PVC should be deleted when the cluster is deleted. That's the intended behavior. If you want to preserve the data then scale the cluster down to zero.

@AMecea For me the only feature request here would be handling the "node 0 is out of date" case (maybe refuse to scale down to a number that stops the current master?)

@abh, this is indeed a problem that needs to be addressed and it's more complex. Here is something that I thought about https://github.com/presslabs/mysql-operator/issues/404#issuecomment-539555943

AMecea avatar Nov 14 '19 11:11 AMecea

Hi @chenmin1992, the PVC should be deleted when the cluster is deleted. That's the intended behavior. If you want to preserve the data then scale the cluster down to zero.

I think it would be nice to have an option like persistentVolumeReclaimPolicy to retain PVC's (or at least 1 master one) on cluster deletion.

elderapo avatar Aug 17 '20 20:08 elderapo

我也觉得应该有一个配置选项去控制pvc是否删除

1447543654 avatar Aug 11 '22 03:08 1447543654