[ 
https://issues.apache.org/jira/browse/HDDS-17515?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Priyesh Karatha updated HDDS-17515:
-----------------------------------
    Description: 
h3. Background

HDDS-16640 made the KeyLifecycleService properties reconfigurable at runtime. 
Doing that needed several pieces of hand-written plumbing:
 - {{{}KeyLifecycleService.OZONE_KEY_LIFECYCLE_PROPERTIES{}}}, a 
hand-maintained set of property keys used to register reconfiguration handlers 
in {{{}OzoneManager{}}}.
 - {{{}KeyLifecycleService.ReconfigurableSettings{}}}, which reads every 
property from {{ConfigurationSource}} and checks it.
 - Per-property handlers ({{{}validateKeyLifecycleProperty{}}}) that only 
validate, plus a complete callback that re-reads the full configuration.

The keys and defaults are also defined separately: as constants in 
{{{}OMConfigKeys{}}}, with descriptions in {{{}ozone-default.xml{}}}. Adding or 
changing a lifecycle property means updating all of these places.
h3. Proposal

Move all {{ozone.lifecycle.service.*}} properties into a new {{@ConfigGroup}} 
class, {{{}KeyLifecycleServiceConfig{}}}, that extends 
{{{}ReconfigurableConfig{}}}, following the existing {{OmConfig}} pattern.

  was:
h3. Background
HDDS-16640 made the KeyLifecycleService properties reconfigurable at runtime. 
Doing that needed several pieces of hand-written plumbing:
- \{{KeyLifecycleService.OZONE_KEY_LIFECYCLE_PROPERTIES}}, a hand-maintained 
set of property keys used to register reconfiguration handlers in 
\{{OzoneManager}}.
- \{{KeyLifecycleService.ReconfigurableSettings}}, which reads every property 
from \{{ConfigurationSource}} and checks it.
- Per-property handlers (\{{validateKeyLifecycleProperty}}) that only validate, 
plus a complete callback that re-reads the full configuration.

The keys and defaults are also defined separately: as constants in 
\{{OMConfigKeys}}, with descriptions in \{{ozone-default.xml}}. Adding or 
changing a lifecycle property means updating all of these places.

h3. Proposal
Move all \{{ozone.lifecycle.service.*}} properties into a new \{{@ConfigGroup}} 
class, \{{KeyLifecycleServiceConfig}}, that extends \{{ReconfigurableConfig}}, 
following the existing \{{OmConfig}} pattern.

- Declare each property once with \{{@Config(reconfigurable = true)}}, 
including its key, default, type, unit and description.
- Validate in a \{{@PostConstruct}} method. 
\{{ConfigurationReflectionUtil.reconfigureProperty}} already rolls a field back 
if validation fails.
- In \{{OzoneManager}}, register the config object with 
\{{reconfigurationHandler.register(lifecycleConfig)}}. This replaces 
\{{OZONE_KEY_LIFECYCLE_PROPERTIES}} and the per-property validation handlers.
- Keep a complete callback for the side effects: pool size, service timeout, 
and restarting the service when the interval changes or the service is enabled.
- Have \{{KeyLifecycleService}} read values from the config object, and remove 
\{{ReconfigurableSettings}} and the duplicated volatile fields.
- Remove the \{{OZONE_KEY_LIFECYCLE_SERVICE_*}} constants from 
\{{OMConfigKeys}} and the matching entries from \{{ozone-default.xml}}. The 
\{{@Config}} annotations generate those entries now.
- Update all usages (\{{KeyManagerImpl}}, 
\{{OMLifecycleSetServiceStatusRequest}}, unit tests and integration tests) to 
use \{{KeyLifecycleServiceConfig}} / \{{KeyLifecycleServiceConfig.Keys}}.

h3. Notes
- No change in behaviour: property names, defaults and the reconfiguration 
semantics stay the same.
- Fields read by lifecycle worker threads should be \{{volatile}}, because the 
reconfiguration thread updates them.
- Keep the current fallback: a non-positive value for the state-save interval 
or keys-processed setting falls back to its default.
- The properties have not been in any release, so the old constants can be 
removed instead of deprecated.

h3. Affected properties
{\{ozone.lifecycle.service.enabled}}, \{{.interval}}, \{{.timeout}}, 
\{{.workers}}, \{{.delete.batch-size}}, \{{.mpu.abort.limit.per.task}}, 
\{{.delete.cached.directory.max-count}}, \{{.state.save.interval.ms}}, 
\{{.state.save.keys.processed}}, \{{.move.to.trash.enabled}}


> Move KeyLifecycleService configuration from OMConfigKeys to a dedicated 
> KeyLifecycleServiceConfig
> -------------------------------------------------------------------------------------------------
>
>                 Key: HDDS-17515
>                 URL: https://issues.apache.org/jira/browse/HDDS-17515
>             Project: Apache Ozone
>          Issue Type: Sub-task
>          Components: OM
>            Reporter: Priyesh Karatha
>            Assignee: Priyesh Karatha
>            Priority: Major
>
> h3. Background
> HDDS-16640 made the KeyLifecycleService properties reconfigurable at runtime. 
> Doing that needed several pieces of hand-written plumbing:
>  - {{{}KeyLifecycleService.OZONE_KEY_LIFECYCLE_PROPERTIES{}}}, a 
> hand-maintained set of property keys used to register reconfiguration 
> handlers in {{{}OzoneManager{}}}.
>  - {{{}KeyLifecycleService.ReconfigurableSettings{}}}, which reads every 
> property from {{ConfigurationSource}} and checks it.
>  - Per-property handlers ({{{}validateKeyLifecycleProperty{}}}) that only 
> validate, plus a complete callback that re-reads the full configuration.
> The keys and defaults are also defined separately: as constants in 
> {{{}OMConfigKeys{}}}, with descriptions in {{{}ozone-default.xml{}}}. Adding 
> or changing a lifecycle property means updating all of these places.
> h3. Proposal
> Move all {{ozone.lifecycle.service.*}} properties into a new {{@ConfigGroup}} 
> class, {{{}KeyLifecycleServiceConfig{}}}, that extends 
> {{{}ReconfigurableConfig{}}}, following the existing {{OmConfig}} pattern.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to