[ 
https://issues.apache.org/jira/browse/HDDS-17556?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18151376#comment-18151376
 ] 

Devesh Kumar Singh edited comment on HDDS-17556 at 11/26/26, 10:33 AM:
-----------------------------------------------------------------------

Thanks everyone for the discussion on PR #9472 and PR #12048. Here is a 
proposal to start from. Comments welcome.

h3. Problem
* One label ({{SimplifiedContainerHealthStateForReporting}}) mixes lifecycle, 
replication, unhealthy replicas and placement. Names such as HEALTHY, UNHEALTHY 
and QUASI_CLOSED_STUCK are not precisely defined.
* Code that only wants to ask "is this container under-replicated?" has to list 
several labels. HDDS-17225 is a real bug caused by this: 
{{DatanodeAdminMonitorImpl}} checks only {{UNDER_REPLICATED}}, so containers 
recorded as {{UNHEALTHY_UNDER_REPLICATED}}, {{MISSING_UNDER_REPLICATED}} or 
{{QUASI_CLOSED_STUCK_UNDER_REPLICATED}} do not block decommission.
* When a label is missing, we cannot tell whether a check passed or never ran, 
because the handler chain stops early for some containers.

h3. What already exists
* RM's internal {{UnderReplicatedHealthResult}} already records most of the 
facts: unrecoverable, missing, has healthy replicas, has an index only on an 
offline node, vulnerable UNHEALTHY replica. Over and mis-replication results 
carry their own facts. So a first phase needs no new replica analysis.
* {{ReplicationManagerReport}} stats are string keys sent as proto key/value 
pairs. Unknown keys are ignored when read, and {{getStat}} returns -1 for a 
missing key. New keys are wire-compatible in both directions.
* The exact-label filter ({{ContainerStateMap.getContainerIDs(..., healthState, 
...)}}) is used only by {{ContainerExportManager}}, which is not exposed over 
RPC yet. We can change the filter without breaking users.

h3. Proposal: independent dimensions
Each dimension has values that exclude each other, plus NOT_EVALUATED (the 
check did not run) and NOT_APPLICABLE.

||Dimension||Values||
|Lifecycle|reuse {{HddsProtos.LifeCycleState}}|
|Pipeline (OPEN only)|HAS_PIPELINE, NO_PIPELINE|
|Replication|CORRECTLY_REPLICATED, UNDER_REPLICATED, OVER_REPLICATED, 
NO_REPLICA|
|Replica health|ALL_HEALTHY, SOME_UNHEALTHY, ONLY_UNHEALTHY|
|Replica state match|CONSISTENT, INCONSISTENT|
|Placement|PLACEMENT_OK, MIS_REPLICATED|
|Recoverability|RECOVERABLE, NEEDS_UNHEALTHY_REPLICAS, UNRECOVERABLE|
|Force close (QUASI_CLOSED Ratis)|ALLOWED, BLOCKED (replaces "STUCK")|
|Data|EMPTY, HAS_DATA|
|Corruption|NOT_EVALUATED for now. Only datanode scanners check data.|

The Replication dimension is defined by what RM has to do. This makes 
UNDER_REPLICATED the superset that [~sodonnell] asked for on PR #12048:
* UNDER_REPLICATED: RM must create at least one replica, for any reason. This 
covers too few replicas, an index only on an offline node, a vulnerable 
UNHEALTHY replica, and a stuck origin with too few copies.
* OVER_REPLICATED: RM must delete at least one replica.
* NO_REPLICA: there is nothing left to copy from (MISSING).
* If both under and over apply, UNDER_REPLICATED wins, matching the handler 
order.

The reason a container is under-replicated is in the other dimensions, not in 
the label name. Decommission and maintenance only need {{Replication == 
UNDER_REPLICATED}}.

h3. Phases
# *Helper (now).* Add one helper, for example 
{{SimplifiedContainerHealthStateForReporting#isUnderReplicated()}}, and use it 
in {{DatanodeAdminMonitorImpl}} and Recon. This fixes HDDS-17225 / PR #12048 
without a model change.
# *Record the dimensions.* RM builds a {{ContainerAssessment}} from its 
existing results in {{processContainer}} and stores it on {{ContainerInfo}}, in 
memory only, not in proto. Repair commands do not change. Dimensions not 
reached because the chain stopped stay NOT_EVALUATED.
# *Report and metrics.* Add per-dimension report keys, for example 
{{Replication.UNDER_REPLICATED}}. Keep the old label keys and metric names, 
derived from the assessment, for at least one release. Move 
{{DatanodeAdminMonitorImpl}}, Recon and the export filter to the dimensions.
# *Redesign {{ContainerHealthResult}}* as [~szetszwo] suggested: replace 
HEALTHY/UNHEALTHY with dimension results. This is internal to SCM but touches 
the balancer ({{MoveManager}}, {{ContainerBalancerSelectionCriteria}}) and 
{{DeletedBlockLogImpl}}, so it should be its own subtask.
# *CLI and Recon.* Show per-dimension sections in {{ozone admin container 
report}}, let Recon read the dimensions directly, deprecate the combined labels 
and remove them later.

h3. Open questions
# Should {{MISSING_UNDER_REPLICATED}} block decommission? With the action-based 
definition, yes: the offline EC index is on the decommissioning node and RM 
copies it before the node leaves. [~sodonnel], your comment on PR #12048 
assumed a missing container has no replica on the node. Does this case change 
that?
# Freshness: is a report-level timestamp enough, or do we need an "assessed at" 
time per container?
# Corruption: keep it NOT_EVALUATED in RM, or derive it from replica checksums 
(container reconciliation)?

h3. Proposed subtasks
# Helper for the under-replicated labels. Unblocks HDDS-17225 / PR #12048.
# Design doc with precise dimension definitions for Ratis, EC, maintenance and 
decommission.
# {{ContainerAssessment}} recorded by RM handlers (reporting only).
# Per-dimension report keys and metrics, with old keys kept.
# Move {{DatanodeAdminMonitorImpl}}, Recon and the export filter to the 
dimensions.
# Redesign {{ContainerHealthResult}}.
# CLI report output and deprecation of the combined labels.

[~shuohaung] offered on PR #12048 to help with the replication part. Subtask 1, 
and later subtask 5, would be a good fit. 
cc:  [~szetszwo] [~sodonnell] [~adoroszlai]



was (Author: JIRAUSER295411):
Thanks everyone for the discussion on PR #9472 and PR #12048. Here is a 
proposal to start from. Comments welcome.

h3. Problem
* One label ({{SimplifiedContainerHealthStateForReporting}}) mixes lifecycle, 
replication, unhealthy replicas and placement. Names such as HEALTHY, UNHEALTHY 
and QUASI_CLOSED_STUCK are not precisely defined.
* Code that only wants to ask "is this container under-replicated?" has to list 
several labels. HDDS-17225 is a real bug caused by this: 
{{DatanodeAdminMonitorImpl}} checks only {{UNDER_REPLICATED}}, so containers 
recorded as {{UNHEALTHY_UNDER_REPLICATED}}, {{MISSING_UNDER_REPLICATED}} or 
{{QUASI_CLOSED_STUCK_UNDER_REPLICATED}} do not block decommission.
* When a label is missing, we cannot tell whether a check passed or never ran, 
because the handler chain stops early for some containers.

h3. What already exists
* RM's internal {{UnderReplicatedHealthResult}} already records most of the 
facts: unrecoverable, missing, has healthy replicas, has an index only on an 
offline node, vulnerable UNHEALTHY replica. Over and mis-replication results 
carry their own facts. So a first phase needs no new replica analysis.
* {{ReplicationManagerReport}} stats are string keys sent as proto key/value 
pairs. Unknown keys are ignored when read, and {{getStat}} returns -1 for a 
missing key. New keys are wire-compatible in both directions.
* The exact-label filter ({{ContainerStateMap.getContainerIDs(..., healthState, 
...)}}) is used only by {{ContainerExportManager}}, which is not exposed over 
RPC yet. We can change the filter without breaking users.

h3. Proposal: independent dimensions
Each dimension has values that exclude each other, plus NOT_EVALUATED (the 
check did not run) and NOT_APPLICABLE.

||Dimension||Values||
|Lifecycle|reuse {{HddsProtos.LifeCycleState}}|
|Pipeline (OPEN only)|HAS_PIPELINE, NO_PIPELINE|
|Replication|CORRECTLY_REPLICATED, UNDER_REPLICATED, OVER_REPLICATED, 
NO_REPLICA|
|Replica health|ALL_HEALTHY, SOME_UNHEALTHY, ONLY_UNHEALTHY|
|Replica state match|CONSISTENT, INCONSISTENT|
|Placement|PLACEMENT_OK, MIS_REPLICATED|
|Recoverability|RECOVERABLE, NEEDS_UNHEALTHY_REPLICAS, UNRECOVERABLE|
|Force close (QUASI_CLOSED Ratis)|ALLOWED, BLOCKED (replaces "STUCK")|
|Data|EMPTY, HAS_DATA|
|Corruption|NOT_EVALUATED for now. Only datanode scanners check data.|

The Replication dimension is defined by what RM has to do. This makes 
UNDER_REPLICATED the superset that [~sodonnel] asked for on PR #12048:
* UNDER_REPLICATED: RM must create at least one replica, for any reason. This 
covers too few replicas, an index only on an offline node, a vulnerable 
UNHEALTHY replica, and a stuck origin with too few copies.
* OVER_REPLICATED: RM must delete at least one replica.
* NO_REPLICA: there is nothing left to copy from (MISSING).
* If both under and over apply, UNDER_REPLICATED wins, matching the handler 
order.

The reason a container is under-replicated is in the other dimensions, not in 
the label name. Decommission and maintenance only need {{Replication == 
UNDER_REPLICATED}}.

h3. Phases
# *Helper (now).* Add one helper, for example 
{{SimplifiedContainerHealthStateForReporting#isUnderReplicated()}}, and use it 
in {{DatanodeAdminMonitorImpl}} and Recon. This fixes HDDS-17225 / PR #12048 
without a model change.
# *Record the dimensions.* RM builds a {{ContainerAssessment}} from its 
existing results in {{processContainer}} and stores it on {{ContainerInfo}}, in 
memory only, not in proto. Repair commands do not change. Dimensions not 
reached because the chain stopped stay NOT_EVALUATED.
# *Report and metrics.* Add per-dimension report keys, for example 
{{Replication.UNDER_REPLICATED}}. Keep the old label keys and metric names, 
derived from the assessment, for at least one release. Move 
{{DatanodeAdminMonitorImpl}}, Recon and the export filter to the dimensions.
# *Redesign {{ContainerHealthResult}}* as [~szetszwo] suggested: replace 
HEALTHY/UNHEALTHY with dimension results. This is internal to SCM but touches 
the balancer ({{MoveManager}}, {{ContainerBalancerSelectionCriteria}}) and 
{{DeletedBlockLogImpl}}, so it should be its own subtask.
# *CLI and Recon.* Show per-dimension sections in {{ozone admin container 
report}}, let Recon read the dimensions directly, deprecate the combined labels 
and remove them later.

h3. Open questions
# Should {{MISSING_UNDER_REPLICATED}} block decommission? With the action-based 
definition, yes: the offline EC index is on the decommissioning node and RM 
copies it before the node leaves. [~sodonnel], your comment on PR #12048 
assumed a missing container has no replica on the node. Does this case change 
that?
# Freshness: is a report-level timestamp enough, or do we need an "assessed at" 
time per container?
# Corruption: keep it NOT_EVALUATED in RM, or derive it from replica checksums 
(container reconciliation)?

h3. Proposed subtasks
# Helper for the under-replicated labels. Unblocks HDDS-17225 / PR #12048.
# Design doc with precise dimension definitions for Ratis, EC, maintenance and 
decommission.
# {{ContainerAssessment}} recorded by RM handlers (reporting only).
# Per-dimension report keys and metrics, with old keys kept.
# Move {{DatanodeAdminMonitorImpl}}, Recon and the export filter to the 
dimensions.
# Redesign {{ContainerHealthResult}}.
# CLI report output and deprecation of the combined labels.

[~shuohaung] offered on PR #12048 to help with the replication part. Subtask 1, 
and later subtask 5, would be a good fit. 
cc:  [~szetszwo] [~sodonnell] [~adoroszlai]


> Redesign SCM container health reporting using independent assessment 
> dimensions
> -------------------------------------------------------------------------------
>
>                 Key: HDDS-17556
>                 URL: https://issues.apache.org/jira/browse/HDDS-17556
>             Project: Apache Ozone
>          Issue Type: Improvement
>          Components: Ozone CLI, Ozone Datanode, Ozone Recon
>            Reporter: Devesh Kumar Singh
>            Priority: Major
>
> Track the design and implementation of a clearer SCM container-assessment 
> model, following [~szetszwo] proposal on PR #9472 
> (https://github.com/apache/ozone/pull/9472#issuecomment-6477345275).
> The current model combines several conditions into one ContainerHealthState 
> value. Broad labels such as HEALTHY and combined labels such as 
> QUASI_CLOSED_STUCK_UNDER_REPLICATED do not clearly distinguish lifecycle, 
> replication, placement, and other assessments.
> *Design scope:*
> - Evaluate separate dimensions for replication, placement/racks, lifecycle, 
> consistency, corruption, and recoverability.
> - Define precise states and applicability for Ratis, EC, maintenance, and 
> decommissioning.
> - Define UNKNOWN, NOT_EVALUATED, and NOT_APPLICABLE semantics where needed.
> - Specify assessment freshness and distinguish unchecked conditions from 
> successful checks.
> - Identify existing assessments that can be reused and additional evidence or 
> checks required.
> - Plan compatibility for metrics, report categories, CLI/API consumers, and 
> health-state filtering.
> - Separate reporting-model changes from changes to replication repair 
> decisions and safety checks.
> - Define unit, integration, and compatibility coverage.



--
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