ARTEMIS-6043 updating divert w/mngmnt API can persist invalid config#6406
Merged
clebertsuconic merged 1 commit intoapache:mainfrom May 1, 2026
Merged
ARTEMIS-6043 updating divert w/mngmnt API can persist invalid config#6406clebertsuconic merged 1 commit intoapache:mainfrom
clebertsuconic merged 1 commit intoapache:mainfrom
Conversation
|
|
||
| storageManager.storeDivertConfiguration(new PersistedDivertConfiguration(config)); | ||
| if (onDiskDivert != null) { | ||
| storageManager.storeDivertConfiguration(new PersistedDivertConfiguration(onDiskDivert)); |
Contributor
There was a problem hiding this comment.
Can you add comments for two things I had to dive in to realize:
I - The fact that storeDiverConfiguration will replace the old one by the new record you are sending now.
II - updateDivert is called for both in XML configuration and in Journal configurations. That object is used to verify if it's coming from storage or not.
| } | ||
| } | ||
| } catch (Exception e) { | ||
| ActiveMQServerLogger.LOGGER.failedToRecoverStoredDivertConfiguration(persistedDivertConfiguration.getName(), e); |
Contributor
There was a problem hiding this comment.
My suggestion for this method:
private void recoverStoredDiverts() throws Exception {
if (storageManager.recoverDivertConfigurations() != null) {
for (PersistedDivertConfiguration persistedDivertConfiguration : storageManager.recoverDivertConfigurations()) {
try {
//has it been removed from config
boolean deleted = configuration.getDivertConfigurations().stream().noneMatch(divertConfiguration -> divertConfiguration.getName().equals(persistedDivertConfiguration.getName()));
// if it has remove it if configured to do so
if (deleted) {
if (addressSettingsRepository.getMatch(persistedDivertConfiguration.getDivertConfiguration().getAddress()).getConfigDeleteDiverts() == DeletionPolicy.FORCE) {
storageManager.deleteDivertConfiguration(persistedDivertConfiguration.getName());
} else {
deployDivert(persistedDivertConfiguration.getDivertConfiguration());
}
}
} catch (Exception e) {
logger.debug(e.getMessage(), e);
ActiveMQServerLogger.LOGGER.failedToRecoverStoredDivertConfiguration(persistedDivertConfiguration.getName(), String.valueOf(persistedDivertConfiguration.getDivertConfiguration()));
}
}
}This commit fixes two related issues: - Ensures the broker can still start if recovering a persisted divert configuration fails - Ensures the broker does not persist an invalid divert configuration
Contributor
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit fixes two related issues: