-
Notifications
You must be signed in to change notification settings - Fork 593
HDDS-11389. Incorrect number of deleted containers shown in Recon UI. #7149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
647806f
adb768c
346ae0d
6941dc2
8fcb72c
4959cca
460a94c
212bf24
dd19857
ceff089
bcd6754
14ffa8e
65e2911
5603df6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -256,6 +256,11 @@ private void completeProcessingContainer( | |
| * completeProcessingContainer is called. This will check to see if any | ||
| * additional records need to be added to the database. | ||
| * | ||
| * If a container is identified as missing, empty-missing, under-replicated, | ||
| * over-replicated or mis-replicated, the method checks with SCM to determine | ||
| * if it has been deleted, using {@code containerDeletedInSCM}. If the container is | ||
| * deleted in SCM, the corresponding record is removed from Recon. | ||
| * | ||
| * @param currentTime Timestamp to place on all records generated by this run | ||
| * @param unhealthyContainerStateCountMap | ||
| * @return Count of records processed | ||
|
|
@@ -273,34 +278,44 @@ 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, EMPTY_MISSING, UNDER_REPLICATED, | ||
| // OVER_REPLICATED, MIS_REPLICATED can have their unhealthy states changed or retained. | ||
| if (!ContainerHealthRecords.retainOrUpdateRecord(currentContainer, rec)) { | ||
| LOG.info("DELETED existing unhealthy container record...for Container: {}", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move this log after
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! |
||
| currentContainer.getContainerID()); | ||
| rec.delete(); | ||
| continue; | ||
|
||
| } | ||
|
|
||
| // If the container is marked as MISSING and it's deleted in SCM, remove the record | ||
| if (currentContainer.isMissing() && containerDeletedInSCM(currentContainer.getContainer())) { | ||
| rec.delete(); | ||
| } | ||
|
|
||
| // If the container is in the EMPTY_MISSING state, delete the record | ||
| if (currentContainer.isEmptyMissing()) { | ||
sumitagrawl marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| rec.delete(); | ||
| } | ||
| existingRecords.add(rec.getContainerState()); | ||
| // If the record was changed, update it | ||
| if (rec.changed()) { | ||
ArafatKhan2198 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| rec.update(); | ||
| } | ||
| } catch (ContainerNotFoundException cnf) { | ||
| // If the container is not found, delete the record and reset currentContainer | ||
| rec.delete(); | ||
| currentContainer = null; | ||
| } | ||
|
|
@@ -349,6 +364,18 @@ private void processContainer(ContainerInfo container, long currentTime, | |
| } | ||
| } | ||
|
|
||
| /** | ||
| * Ensures the container's state in Recon is updated to match its state in SCM. | ||
| * | ||
| * If SCM reports the container as DELETED, this method attempts to transition | ||
| * the container's state in Recon from CLOSED to DELETING, or from DELETING to | ||
| * DELETED, based on the current state in Recon. It logs each transition attempt | ||
| * and handles any exceptions that may occur. | ||
| * | ||
| * @param containerInfo the container whose state is being checked and potentially updated. | ||
| * @return {@code true} if the container was found to be DELETED in SCM and the | ||
| * state transition was attempted in Recon; {@code false} otherwise. | ||
| */ | ||
| private boolean containerDeletedInSCM(ContainerInfo containerInfo) { | ||
| try { | ||
| ContainerWithPipeline containerWithPipeline = | ||
|
|
@@ -358,13 +385,16 @@ private boolean containerDeletedInSCM(ContainerInfo containerInfo) { | |
| if (containerInfo.getState() == HddsProtos.LifeCycleState.CLOSED) { | ||
| containerManager.updateContainerState(containerInfo.containerID(), | ||
| HddsProtos.LifeCycleEvent.DELETE); | ||
| LOG.debug("Successfully changed container {} state from CLOSED to DELETING.", | ||
| containerInfo.containerID()); | ||
| } | ||
| if (containerInfo.getState() == HddsProtos.LifeCycleState.DELETING && | ||
| containerManager.getContainerReplicas(containerInfo.containerID()) | ||
| .size() == 0 | ||
| ) { | ||
| containerManager.updateContainerState(containerInfo.containerID(), | ||
| HddsProtos.LifeCycleEvent.CLEANUP); | ||
| LOG.info("Successfully Deleted container {} from Recon.", containerInfo.containerID()); | ||
| } | ||
| return true; | ||
| } | ||
|
|
@@ -435,6 +465,9 @@ public static boolean retainOrUpdateRecord( | |
| case MISSING: | ||
| returnValue = container.isMissing() && !container.isEmpty(); | ||
| break; | ||
| case EMPTY_MISSING: | ||
|
||
| returnValue = container.isMissing() && container.isEmpty(); | ||
| break; | ||
| case MIS_REPLICATED: | ||
| returnValue = keepMisReplicatedRecord(container, rec); | ||
| break; | ||
|
|
@@ -495,7 +528,7 @@ public static List<UnhealthyContainers> generateUnhealthyRecords( | |
|
|
||
| LOG.debug("Empty container {} is missing. Kindly check the " + | ||
| "consolidated container stats per UNHEALTHY state logged as " + | ||
| "starting with **Container State Stats:**"); | ||
| "starting with **Container State Stats:**", container.getContainerID()); | ||
|
|
||
| records.add( | ||
| recordForState(container, EMPTY_MISSING, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.