himanshumaurya09876 commented on code in PR #4263:
URL: https://github.com/apache/ambari/pull/4263#discussion_r4614701342


##########
ambari-web/latest/src/screens/Hosts/bulkOperations.tsx:
##########
@@ -155,11 +155,33 @@ const getHostsForBulkOperationSuccessCallback = (
     return;
   }
 
-  if (
-    ["SET_RACK_INFO", "ADD", "DELETE", "RECOVER_HOST"].includes(
-      operationData.action
-    )
-  ) {
+  if (operationData.action === "RECOVER_HOST") {
+    // The host list above may have been fetched with a component/service
+    // filter applied (selection === "filtered"), which narrows each host's
+    // host_components to only the matching component. Recoverability must be
+    // judged on every component on the host, so refetch host_components here
+    // with no component/service filter before partitioning or building 
batches.
+    const data = {
+      hosts: hosts.map((host: any) => host.hostName),
+      displayParams: [
+        "host_components/HostRoles/component_name",
+        "host_components/HostRoles/state",
+      ],
+    };
+    getComponentsFromServer(data, clusterName, (responseData: any) => {
+      bulkOperation(
+        operationData,
+        convertHostsObjects(responseData),
+        clusterName,
+        serviceComponentInfo,
+        serviceModels,
+        getKDCSessionState
+      );
+    });
+    return;
+  }
+
+  if (["SET_RACK_INFO", "ADD", "DELETE"].includes(operationData.action)) {

Review Comment:
   I have confirmed this by inspection. bulkOperationForHostsDelete reads 
host.allHostComponents from the initial, potentially filtered fetch rather than 
from an unfiltered refetch; this list is passed into getHostComponentsInfo, 
which determines nonDeletableComponents, nonAddableMasterComponents, 
lastMasterComponents, and runningComponents. As a result, a component or 
service filter applied under "Filtered Hosts" could hide a master or running 
component and allow a host to be presented as deletable when it should not be.
   This shares the same root cause as the issue addressed in this pull request, 
applied to a different code path. I have filed AMBARI-26680 to track it 
separately, as it is out of scope for this change.



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

Reply via email to