Skip to content

HDDS-16640. Make KeyLifecycleService configuration reconfigurable at runtime - #11721

Merged
priyeshkaratha merged 3 commits into
apache:masterfrom
priyeshkaratha:HDDS-16640
Oct 29, 2026
Merged

priyeshkaratha merged 3 commits into
apache:masterfrom
priyeshkaratha:HDDS-16640

Conversation

@priyeshkaratha

@priyeshkaratha priyeshkaratha commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

Before this change, changing any ozone.om.key.lifecycle.service.* property meant restarting OM. This PR makes those properties reconfigurable at runtime through the OM reconfiguration framework (ozone admin reconfig --service=OM ... start).

Reconfigurable properties (the new KeyLifecycleService.OZONE_KEY_LIFECYCLE_PROPERTIES set):

  • ozone.lifecycle.service.enabled
  • ozone.lifecycle.service.interval
  • ozone.lifecycle.service.timeout
  • ozone.lifecycle.service.workers
  • ozone.lifecycle.service.delete.batch-size
  • ozone.lifecycle.service.mpu.abort.limit.per.task
  • ozone.lifecycle.service.delete.cached.directory.max-coun
  • ozone.lifecycle.service.state.save.interval.ms
  • ozone.lifecycle.service.state.save.keys.processed
  • ozone.lifecycle.service.move.to.trash.enabled

What is the link to the Apache JIRA

HDDS-16640

How was this patch tested?

Added test case and tested manually

bash-5.1$ vi /etc/hadoop/ozone-site.xml
bash-5.1$ ozone admin reconfig --service=OM --address=om:9862 start
OM: Started reconfiguration task on node [om:9862].
bash-5.1$ ozone admin om lifecycle status --service-host om
========================================
          Lifecycle Service Status
========================================
IsEnabled: true
IsSuspended: false
No buckets are currently being processed.
========================================
bash-5.1$ vi /etc/hadoop/ozone-site.xml
bash-5.1$
bash-5.1$ ozone admin reconfig --service=OM --address=om:9862 start
OM: Started reconfiguration task on node [om:9862].
bash-5.1$ ozone admin om lifecycle status --service-host om
========================================
          Lifecycle Service Status
========================================
IsEnabled: false
No buckets are currently being processed.
========================================

@adoroszlai

Copy link
Copy Markdown
Contributor

Thanks for the patch. To save CI resources, please consider creating PRs as draft, and keeping them that way until approved. (No need to change this now, just a note for future PRs.)

@ChenSammi

ChenSammi commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Reconfigurable properties (the new KeyLifecycleService.OZONE_KEY_LIFECYCLE_PROPERTIES set):

ozone.om.key.lifecycle.service.enabled
ozone.om.key.lifecycle.service.interval
ozone.om.key.lifecycle.service.timeout
ozone.om.key.lifecycle.service.workers
ozone.om.key.lifecycle.service.delete.batch-size
ozone.om.key.lifecycle.service.mpu.abort.limit.per.task
ozone.om.key.lifecycle.service.delete.cached.directory.max.count
ozone.om.key.lifecycle.service.state.save.interval.ms
ozone.om.key.lifecycle.service.state.save.keys.processed
ozone.om.key.lifecycle.service.move.to.trash.enabled

These property names in the description not match the real name

Will the "ozone admin reconfig --service=OM --address=om:9862 start" command display which property name is changed?

@priyeshkaratha , could you add a section about reconfiguration in lifecycle.md and it's Chinese version?

@adoroszlai

Copy link
Copy Markdown
Contributor

could you add a section about reconfiguration in lifecycle.md and it's Chinese version?

Please add documentation in ozone-site. Leftover docs are being removed from this repo in #10829.

public void reconfigure(String property, ConfigurationSource conf) {
switch (property) {
case OZONE_KEY_LIFECYCLE_SERVICE_ENABLED:
isServiceEnabled.set(conf.getBoolean(property, OZONE_KEY_LIFECYCLE_SERVICE_ENABLED_DEFAULT));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should call the start() if the change is from false to enabled, and do nothing if it's from true-> false.

/**
* Apply the new value of a property in {@link #OZONE_KEY_LIFECYCLE_PROPERTIES
* } without restarting OM.
* Changes to batch sizes and limits take effect on the next scheduled task. A new interval restarts the service,

@ChenSammi ChenSammi Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Changes to batch sizes and limits take effect on the next scheduled task" is not accurate, all the changes, except the interval, will take effect immediately on existing tasks' next batch scan.

* @param property the property being reconfigured
* @param conf configuration holding the new value, or not holding the property to fall back to the default
*/
public void reconfigure(String property, ConfigurationSource conf) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of for each property change to take effect individually, is it possible that we can handle all the property change in one function in the same time?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is handled

getSubject().reconfigureProperty(OZONE_KEY_LIFECYCLE_SERVICE_ENABLED, String.valueOf(originalEnabled));
getSubject().reconfigureProperty(OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL, originalInterval);
getSubject().reconfigureProperty(OZONE_KEY_LIFECYCLE_SERVICE_WORKERS, originalWorkers);
assertEquals(originalEnabled, service.status().getIsEnabled());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add test for unset case?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

@adoroszlai
adoroszlai marked this pull request as draft October 26, 2026 08:01
@priyeshkaratha

Copy link
Copy Markdown
Member Author

Hi @ChenSammi Addressed review comments in latest commit. Created https://issues.apache.org/jira/browse/HDDS-17499 for document changes.

@ChenSammi

ChenSammi commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Thanks @priyeshkaratha for updating the patch.

One minor comment is we'd better change the log message from "KeyLifecycleService is suspended, disabled, or leader not ready" to ""KeyLifecycleService is suspended, disabled, leader not ready, or about to restart".

And the introduced "OZONE_KEY_LIFECYCLE_PROPERTIES" reminds me that maybe we should extract all the key lifecycle properties from OMConfigKeys, to a new file, similar to "OmConfig", and extend the ReconfigurableConfig, that will make the logic very clear, and also easy to maintain. What do you think?

@priyeshkaratha

Copy link
Copy Markdown
Member Author

And the introduced "OZONE_KEY_LIFECYCLE_PROPERTIES" reminds me that maybe we should extract all the key lifecycle properties from OMConfigKeys, to a new file, similar to "OmConfig", and extend the ReconfigurableConfig, that will make the logic very clear, and also easy to maintain. What do you think?

Thanks @ChenSammi. It makes sense to me too. It may require more changes. I have created followup Jira HDDS-17515 for the same

@priyeshkaratha
priyeshkaratha marked this pull request as ready for review October 29, 2026 05:11
@priyeshkaratha
priyeshkaratha merged commit 91ca736 into apache:master Oct 29, 2026
133 checks passed
@priyeshkaratha

Copy link
Copy Markdown
Member Author

Thanks @ChenSammi for the review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants