bug5787: started with a TODO / FIXME comment

This commit is contained in:
Axel Uhl
2023-04-20 21:38:11 +02:00
parent 109d4f66c2
commit 46c96fe850
2 changed files with 7 additions and 5 deletions
@@ -107,13 +107,14 @@ public interface ApplicationLoadBalancer<ShardingKey> extends Named {
Iterable<Rule> addRulesAssigningUnusedPriorities(boolean forceContiguous, Rule... rules);
/**
* For inserting e.g. Shard at a specific priority, we must ensure that the priority is unique in the ruleset.
* This function shifts every priority starting at the highest priority one higher for making the priority at {@code index}
* free.
* For inserting e.g. Shard at a specific priority, we must ensure that the priority is unique in the ruleset. This
* function shifts every priority starting at the highest priority one higher for making the priority at
* {@code index} free.
*
* @param index
* index supposed to be free
* index supposed to be free
* @throws IllegalStateException
* gets thrown if shifting exceeds the limit of priorities
* gets thrown if shifting exceeds the limit of priorities
*/
void shiftRulesToMakeSpaceAt(int index) throws IllegalStateException;
@@ -304,6 +304,7 @@ implements ApplicationLoadBalancer<ShardingKey> {
return Util.stream(getRules()).filter(r->isDefaultRedirectRule(r, hostname)).findAny()
.map(defaultRedirectRule->updateDefaultRedirectRule(defaultRedirectRule.ruleArn(), hostname, pathWithLeadingSlash, query))
.orElseGet(()->{
// FIXME bug 5787: this rule would then typically end up at the end of the rule set, being superseded by all other rules for the replica set; use shiftRulesToMakeSpaceAt with the first rule priority of the replica set identified by hostname
final Rule defaultRedirectRule = createDefaultRedirectRule(hostname, pathWithLeadingSlash, query);
addRulesAssigningUnusedPriorities(/* forceContiguous */ false, defaultRedirectRule);
return defaultRedirectRule;