canonical / mysql-k8s-operator

A Charmed Operator for running MySQL on Kubernetes
https://charmhub.io/mysql-k8s
Apache License 2.0
8 stars 16 forks source link

[RFE] binlog_expire_logs_seconds option #412

Closed pedrofragola closed 3 months ago

pedrofragola commented 6 months ago

[Feature request]

The mysql-k8s charm currently uses the default parameter for binary log retention (binlog_expire_logs_seconds), which is set to rotate the logs after 30 days as per the documentation[0]. In some scenarios, such as when using Kubeflow, this binary log can fill up very quickly. It would be beneficial to have the ability to modify this configuration directly through Juju, allowing users to set this parameter permanently on the charm to accommodate their specific usage patterns.

[0] https://dev.mysql.com/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_expire_logs_seconds

github-actions[bot] commented 6 months ago

https://warthogs.atlassian.net/browse/DPE-4247

paulomach commented 5 months ago

Hi @pedrofragola , we are discussing this and will fup here

paulomach commented 5 months ago

@pedrofragola we are going to change it to 7 days, which is inline with retention period for other logs

pedrofragola commented 5 months ago

@paulomach thanks for the heads-up :) ... Do you think for the next releases it will be possible to have an option to update this config using the charm option?

paulomach commented 5 months ago

@pedrofragola, an option is out of the cards for now

slapcat commented 3 months ago

Hi @paulomach - We are seeing multiple customers affected by full disks from binlogs in Kubeflow environments. The current workaround is to adjust this value during runtime from the mysql-k8s pod, for example:

kubectl exec -it -n kubeflow kfp-db-0 -c mysql --  mysql -userverconfig -p$(juju run kfp-db/0 get-password username=serverconfig | awk -F': ' '/password/ {print $2}') -e 'SET GLOBAL MAX_BINLOG_SIZE=4096;'
kubectl exec -it -n kubeflow kfp-db-0 -c mysql --  mysql -userverconfig -p$(juju run kfp-db/0 get-password username=serverconfig | awk -F': ' '/password/ {print $2}') -e 'SET GLOBAL BINLOG_EXPIRE_LOGS_SECONDS=86400;'

However, this needs to be manually reset every time the pod restarts, so it is very inconvenient. Is it possible to have this prioritized or at least have a clearer picture of when this feature might be added?

paulomach commented 3 months ago

@slapcat PR will be up today or tomorrow.

paulomach commented 3 months ago

@slapcat @pedrofragola I'll need to refactor the PR, for your benefit though. Our PM approved having a dedicated configuration parameter as per comment

paulomach commented 3 months ago

@slapcat @pedrofragola Feature now published to channel 8.0/edge One can set charm configuration binlog_retention_days at a minimum of 1 day (default being 7 days). Appreciate if you can test it.

pedrofragola commented 3 months ago

Hi @paulomach thanks for checking it ... I did the test using the edge channel:

mysql-k8s 8.0.37-0ubuntu0.22.04.3 active 1 mysql-k8s 8.0/edge 178 10.152.183.190 no

juju config mysql-k8s binlog_retention_days=2

mysql> SHOW VARIABLES LIKE '%expire_logs%'; +-------------------------------+--------+ | Variable_name | Value | +-------------------------------+--------+ | binlog_expire_logs_auto_purge | ON | | binlog_expire_logs_seconds | 172800 | | expire_logs_days | 0 | +-------------------------------+--------+ 3 rows in set (0.01 sec)

It worked... do you happen to know when this charm will be promoted to stable channel?

paulomach commented 3 months ago

Hi @paulomach thanks for checking it ... I did the test using the edge channel:

mysql-k8s 8.0.37-0ubuntu0.22.04.3 active 1 mysql-k8s 8.0/edge 178 10.152.183.190 no

juju config mysql-k8s binlog_retention_days=2

mysql> SHOW VARIABLES LIKE '%expire_logs%'; +-------------------------------+--------+ | Variable_name | Value | +-------------------------------+--------+ | binlog_expire_logs_auto_purge | ON | | binlog_expire_logs_seconds | 172800 | | expire_logs_days | 0 | +-------------------------------+--------+ 3 rows in set (0.01 sec)

It worked... do you happen to know when this charm will be promoted to stable channel?

We will be releasing a candidate next week and ask test from sunbeam/kubeflow. We can promote as soon they validate it