sumitagrawl commented on code in PR #7149:
URL: https://github.com/apache/ozone/pull/7149#discussion_r1753353074
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/fsck/ContainerHealthTask.java:
##########
@@ -273,34 +279,41 @@ private long processExistingDBRecords(long currentTime,
recordCount++;
UnhealthyContainersRecord rec = cursor.fetchNext();
try {
+ // Set the current container if it's not already set
if (currentContainer == null) {
currentContainer = setCurrentContainer(rec.getContainerId());
}
+ // If the container ID has changed, finish processing the previous
one
if (currentContainer.getContainerID() != rec.getContainerId()) {
completeProcessingContainer(
currentContainer, existingRecords, currentTime,
unhealthyContainerStateCountMap);
existingRecords.clear();
currentContainer = setCurrentContainer(rec.getContainerId());
}
- if (ContainerHealthRecords
- .retainOrUpdateRecord(currentContainer, rec
- )) {
- // Check if the missing container is deleted in SCM
- if (currentContainer.isMissing() &&
- containerDeletedInSCM(currentContainer.getContainer())) {
- rec.delete();
- }
- existingRecords.add(rec.getContainerState());
- if (rec.changed()) {
- rec.update();
- }
- } else {
+
+ // Unhealthy Containers such as MISSING, UNDER_REPLICATED,
+ // OVER_REPLICATED, MIS_REPLICATED can have their unhealthy states
changed or retained.
+ if (!ContainerHealthRecords.retainOrUpdateRecord(currentContainer,
rec)) {
+ rec.delete();
LOG.info("DELETED existing unhealthy container record...for
Container: {}",
currentContainer.getContainerID());
+ }
+
+ // If the container is marked as MISSING and it's deleted in SCM,
remove the record
+ if (currentContainer.isMissing() &&
containerDeletedInSCM(currentContainer.getContainer())) {
rec.delete();
+ LOG.info("DELETED existing unhealthy container record...for
Container: {}",
+ currentContainer.getContainerID());
+ }
+
+ existingRecords.add(rec.getContainerState());
+ // If the record was changed, update it
+ if (rec.changed()) {
Review Comment:
there is change in behavior as compared old if-else. earlier for one case,
rec.changed() and this case is never called for else. But now its called both
case, please verify the impact.
cc: @devmadhuu
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]