markap14 commented on code in PR #11231:
URL: https://github.com/apache/nifi/pull/11231#discussion_r3222286594
##########
nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardConnectorDAO.java:
##########
@@ -111,7 +115,9 @@ public ConnectorNode createConnector(final String type,
final String id, final B
@Override
public void updateConnector(final ConnectorDTO connectorDTO) {
- final ConnectorNode connector = getConnector(connectorDTO.getId());
+ // Rename writes the in-memory working configuration back to the
provider; sync first so we
+ // do not overwrite changes the provider made out-of-band with stale
local state.
+ final ConnectorNode connector = requireConnector(connectorDTO.getId(),
ConnectorSyncMode.SYNC_WITH_PROVIDER);
if (connectorDTO.getName() != null) {
getConnectorRepository().updateConnector(connector,
connectorDTO.getName());
}
Review Comment:
Refactored to match `repo.configureConnector`.
`StandardConnectorRepository.updateConnector(connector, name)` now does its own
`provider.load` (falling back to a locally-built working configuration when the
provider has no record), sets the new name, then `provider.save`. With the
load+save responsibility colocated in the repository,
`StandardConnectorDAO.updateConnector` drops to `LOCAL_ONLY`, so every DAO
write path is now uniformly `LOCAL_ONLY` while still preserving the no-clobber
guarantee for out-of-band provider changes.
--
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]