Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Router priority strategy implementation does not match documentation #17118

Open
SamWheating opened this issue Sep 19, 2024 · 0 comments
Open

Comments

@SamWheating
Copy link
Contributor

The priority router strategy is documented as follows (source):

Queries with a priority set to less than minPriority are routed to the lowest priority Broker. Queries with priority set to greater than maxPriority are routed to the highest priority Broker. By default, minPriority is 0 and maxPriority is 1. Using these default values, if a query with priority 0 (the default query priority is 0) is sent, the query skips the priority selection logic.

But the implementation is very different:

@Override
public Optional<String> getBrokerServiceName(TieredBrokerConfig tierConfig, Query query)
{
final int priority = query.context().getPriority();
if (priority < minPriority || priority > maxPriority) {
return Optional.of(
tierConfig.getDefaultBrokerServiceName()
);
}
return Optional.absent();
}
}

Since this is a default router strategy, it can lead to some really unexpected behaviour. Given default configuration, a query with priority=2 will be assigned directly to the default brokers, bypassing any other broker routing strategies.

More accurate documentation would be:

Queries with a priority higher than maxPriority or lower than minPriority will be routed to the default broker tier. All other queries will skip the priority selection logic.

I think it would be preferable to update the implementation. I'm happy to submit a fix but will need someone to confirm the intended behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant