prabhjyotsingh opened a new pull request, #4262:
URL: https://github.com/apache/ambari/pull/4262

   ## What changes were proposed in this pull request?
   
   JIRA: [AMBARI-26678](https://issues.apache.org/jira/browse/AMBARI-26678)
   
   Since AMBARI-26614, saving cluster configs pushes agent configs only to hosts
   that already run a component depending on, or owned by the service of, a
   changed config type (`ConfigHelper.getHostsAffectedByConfigTypes`). The 
result
   is empty when no host runs a component of the owning service yet.
   
   Nothing refreshed a host's agent configs when it later gained a component.
   `createHostComponents` published a topology update but no config update. The
   server's per-host config state (`AgentConfigsHolder`) and the agent cache 
kept
   the old configs, and the following INSTALL used them. Adding Ranger through
   Add Service failed:
   
   ```
   resource_management.core.exceptions.Fail: Configuration parameter 
'admin-properties' was not found in configurations dictionary!
   ```
   
   The agent's configuration dictionary contained the installed services' types
   but no Ranger type at all. Re-registering the agent did not help, because the
   server answered with the same cached per-host payload.
   
   `AmbariManagementControllerImpl.createHostComponents` now calls the new
   `updateAgentConfigsForAddedComponents`. It groups the requested hosts by
   cluster and calls `ConfigHelper.updateAgentConfigs(cluster, hostIds)` once 
per
   cluster, with each host listed once. That method recomputes the host's 
configs
   from the current desired configs and sends only changes, so hosts that are
   already current receive no update. The same fix covers Add Component, Add
   Host, and moving a master onto a host that missed earlier config changes for
   that service. A failed refresh is reported as an error, so the request is not
   treated as successful with stale configs.
   
   ## How was this patch tested?
   
   New unit tests in `AmbariManagementControllerImplTest`:
   
   - `testAddedHostComponentsRefreshAgentConfigsOfTheirHosts`: three component
     requests on two hosts produce one push per cluster, containing each host
     exactly once.
   - `testAddedHostComponentsFailWhenAgentConfigsCannotBeRefreshed`: a failure
     from `ConfigHelper.updateAgentConfigs` propagates as an `AmbariException`.
   
   Command (JDK 17):
   `mvn -pl ambari-project,ambari-server -DskipPythonTests 
-Dtest=AmbariManagementControllerImplTest test`
   
   Result: both new tests pass. I ran the class on a downstream branch with the
   same change and EasyMock 5.2.0, because trunk's `3.1.0.0-SNAPSHOT` sibling
   modules were not available locally. Of the 49 tests, 47 passed and 1 was
   skipped. The other failure, `testCreateClusterWithRepository`, is a 
stack-name
   fixture difference on that downstream branch (it expects `HDP` but gets
   `ODP`). It is unrelated to this change. Please rely on CI for the trunk run.
   
   Manual: on a cluster with HDFS, YARN, MapReduce2, Hive, HBase, Tez, and
   ZooKeeper installed, adding Ranger failed at INSTALL with the error above.
   With this change built into ambari-server, the Ranger installation completed.
   
   Please review [Ambari Contributing 
Guide](https://cwiki.apache.org/confluence/display/AMBARI/How+to+Contribute) 
before opening a pull request.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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