How to reduce the retention period of deleted metadata in the ODF Multicloud Gateway MCG Noobaa DB database
Environment
- OpenShift Data Foundation (ODF) 4.16
Issue
- The default retention period of deleted metadata in the MCG Noobaa DB is 3 months. This can cause the Noobaa DB to grow excessively if there are frequent changes to Noobaa objects. Reducing the retention period to something smaller, like two weeks, can potentially reduce the Noobaa DB disk usage.
Resolution
To reduce the retention period to two weeks, set the environment variable CONFIG_JS_DB_CLEANER_BACK_TIME to the desired retention period in milliseconds. For example, two weeks (14 days) would be 1209600000 milliseconds. The environment variable would be set in the core container in the noobaa-core StatefulSet.
In addition, the following environment variables also need to be set to speed up the garbage collection:
- CONFIG_JS_OBJECT_RECLAIMER_BATCH_DELAY = 100 // 100 ms
- CONFIG_JS_OBJECT_RECLAIMER_ERROR_DELAY = 3000 // 3 seconds
$ oc set env statefulset/noobaa-core -n openshift-storage -c 'core' CONFIG_JS_DB_CLEANER_BACK_TIME=1209600000
statefulset.apps/noobaa-core updated
$ oc set env statefulset/noobaa-core -n openshift-storage -c 'core' CONFIG_JS_OBJECT_RECLAIMER_BATCH_DELAY=100
statefulset.apps/noobaa-core updated
$ oc set env statefulset/noobaa-core -n openshift-storage -c 'core' CONFIG_JS_OBJECT_RECLAIMER_ERROR_DELAY=3000
statefulset.apps/noobaa-core updated
Root Cause
- The default retention period of deleted metadata in the MCG Noobaa DB is 3 months. This can cause the Noobaa DB to grow excessively if there are frequent changes to Noobaa objects. This would be most apparent in the
objectmdstable.
SBR
Product(s)
Category
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.