ozone
ozone copied to clipboard
HDDS-14119. Capture all container replication status in SCM container info
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
-
ContainerHealthStateEnum
- 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, andREPLICA_MISMATCH - Combination states (values 100+): 8 common combinations like
MISSING_EMPTY,UNDER_REPLICATED_MIS_REPLICATED, etc.
-
HealthStateFilterAPI
- 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
-
ContainerInfoIntegration
- 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
-
ContainerManagerQuery 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