ozone icon indicating copy to clipboard operation
ozone copied to clipboard

HDDS-14119. Capture all container replication status in SCM container info

Open devmadhuu opened this issue 1 month ago • 0 comments

What changes were proposed in this pull request?

This PR updates existing SCM ReplicationManager to capture all container replication statuses in existing ContainerInfo object. The implementation uses a simple enum-based approach with short values, enabling SCM to track both individual health states (e.g., UNDER_REPLICATED, MISSING) and common combinations (e.g., UNDER_REPLICATED_MIS_REPLICATED) efficiently.

Key Features

  1. ContainerHealthState Enum
  • Individual states (values 0-99): 11 health states including HEALTHY, UNDER_REPLICATED, MIS_REPLICATED, OVER_REPLICATED, MISSING, UNHEALTHY, EMPTY, OPEN_UNHEALTHY, QUASI_CLOSED_STUCK, OPEN_WITHOUT_PIPELINE, and REPLICA_MISMATCH
  • Combination states (values 100+): 8 common combinations like MISSING_EMPTY, UNDER_REPLICATED_MIS_REPLICATED, etc.
  1. HealthStateFilter API
  • Simple filtering mechanism for querying containers by exact health state match
  • Factory methods: HealthStateFilter.of(state) for single state or multiple states
  • Clean matches() method for container filtering
  1. ContainerInfo Integration
  • New healthState field (short, 2 bytes per container)
  • New healthStateUpdateTime field for tracking when health state changed
  • Automatic timestamp updates when health state is modified
  • Protobuf serialization support
  1. ContainerManager Query API
List<ContainerInfo> getContainersByHealthState(HealthStateFilter filter);
Map<ContainerInfo, ContainerHealthState> getContainersWithHealthState(HealthStateFilter filter);

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-14119

How was this patch tested?

This patch is tested using new test cases: TestContainerHealthState covering: - All individual states and combinations - Conversion from ReplicationManager states - Protobuf serialization/deserialization - Health state filtering and querying - Edge cases and invalid states

devmadhuu avatar Dec 10 '25 08:12 devmadhuu