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

Add query option to use more replica groups #8550

Merged
merged 2 commits into from
Apr 21, 2022

Conversation

PrachiKhobragade
Copy link
Contributor

@PrachiKhobragade PrachiKhobragade commented Apr 15, 2022

In case when the routingConfig is replicaGroup, user can provide an option to
fan out a query to x replicaGroups where 1 <= x <= replicaGroups so that more
resources could be used for an expensive query
Fixes #8217

Release Notes

When the instance selection criteria for segments is based on replica groups REPLICA_GROUP_INSTANCE_SELECTOR_TYPE, the query goes to just one of the many replica groups, this helps in limiting the number of servers used to serve this query. This may sometimes have a negative effect on time consuming queries, which would get served slower. If we can somehow give an option to the user to fan their query to more replica groups, the query can be served faster.
This PR will add an option to the Sql query numReplicaGroupsToQuery which will take a positive integer, specifying the number of replica groups the query should be fanned out to.

Eg: When the replica group is set to 3, and with 3 servers S1, S2, S3. All the segments will be available on all the servers and we would choose any of S1 | S2 | S3 to serve the segments, with numReplicaGroupsToQuery set to 2 option passed with the query, we will chose two servers to serve the query with the number of segments coming equally from both the servers.
An example query should look like :

SELECT COUNT(*) FROM T GROUP BY A OPTION(numReplicaGroupsToQuery=2)

@PrachiKhobragade
Copy link
Contributor Author

Please Review @sajjad-moradi @snleee

Copy link
Contributor

@sajjad-moradi sajjad-moradi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a unit test for invalid value for numReplicas in the option?

Copy link
Contributor

@snleee snleee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial Review

@sajjad-moradi sajjad-moradi added the release-notes Referenced by PRs that need attention when compiling the next release notes label Apr 18, 2022
@sajjad-moradi
Copy link
Contributor

Please add a brief Release Note section to the PR description.

@kishoreg
Copy link
Member

can we add sample docs to the description? is this specific to replica group based assignment or a generic solution where users can override routing strategy on a per query basis

@codecov-commenter
Copy link

codecov-commenter commented Apr 20, 2022

Codecov Report

Merging #8550 (fcde57e) into master (6eff177) will decrease coverage by 41.37%.
The diff coverage is 60.00%.

@@              Coverage Diff              @@
##             master    #8550       +/-   ##
=============================================
- Coverage     70.83%   29.46%   -41.38%     
=============================================
  Files          1688     1676       -12     
  Lines         88295    87964      -331     
  Branches      13358    13327       -31     
=============================================
- Hits          62542    25916    -36626     
- Misses        21388    59666    +38278     
+ Partials       4365     2382     -1983     
Flag Coverage Δ
integration1 27.31% <36.00%> (-0.01%) ⬇️
integration2 25.76% <60.00%> (-0.05%) ⬇️
unittests1 ?
unittests2 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ing/instanceselector/BalancedInstanceSelector.java 100.00% <ø> (ø)
...va/org/apache/pinot/spi/utils/CommonConstants.java 0.00% <ø> (-21.32%) ⬇️
...roker/requesthandler/BaseBrokerRequestHandler.java 41.28% <28.57%> (-9.35%) ⬇️
.../org/apache/pinot/core/util/QueryOptionsUtils.java 72.22% <50.00%> (-2.78%) ⬇️
...instanceselector/ReplicaGroupInstanceSelector.java 73.68% <60.00%> (-26.32%) ⬇️
...routing/instanceselector/BaseInstanceSelector.java 94.69% <100.00%> (-5.31%) ⬇️
.../java/org/apache/pinot/spi/utils/BooleanUtils.java 0.00% <0.00%> (-100.00%) ⬇️
...java/org/apache/pinot/spi/trace/BaseRecording.java 0.00% <0.00%> (-100.00%) ⬇️
...java/org/apache/pinot/spi/trace/NoOpRecording.java 0.00% <0.00%> (-100.00%) ⬇️
...ava/org/apache/pinot/spi/config/table/FSTType.java 0.00% <0.00%> (-100.00%) ⬇️
... and 1174 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6eff177...fcde57e. Read the comment docs.

@sajjad-moradi
Copy link
Contributor

can we add sample docs to the description? is this specific to replica group based assignment or a generic solution where users can override routing strategy on a per query basis

This is specific to replica group based assignment in which user can specify in each query string to use more than one replica group for query execution. @PrachiKhobragade correct me if I'm wrong.

Copy link
Contributor

@sajjad-moradi sajjad-moradi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Please update the description with a sample query and add maybe add a small release note section with summary to make life easier for the next person cutting the release.

@snleee
Copy link
Contributor

snleee commented Apr 20, 2022

@kishoreg This is for overriding # of replica groups to route per-query basis for tables with replica group feature enabled. We can use a similar approach to allow users to use different instance selecting algorithms (e.g. balanced vs replica group-based).

@PrachiKhobragade
Copy link
Contributor Author

Can you add a unit test for invalid value for numReplicas in the option?

added an invalid option test in QueryValidationTest

In case when the routingConfig is replicaGroup, user can provide an option to
fan out a query to x replicaGroups where 1 <= x <= replicaGroups so that more
resources could be used for an expensice query
@PrachiKhobragade
Copy link
Contributor Author

can we add sample docs to the description? is this specific to replica group based assignment or a generic solution where users can override routing strategy on a per query basis

This is specific to replica group based assignment in which user can specify in each query string to use more than one replica group for query execution. @PrachiKhobragade correct me if I'm wrong.

@kishoreg This will be specific to Replica Group based based routing

@PrachiKhobragade
Copy link
Contributor Author

Please add a brief Release Note section to the PR description.

@sajjad-moradi added

Copy link
Contributor

@snleee snleee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you for adding this feature!

@snleee snleee merged commit 2fba4b0 into apache:master Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature release-notes Referenced by PRs that need attention when compiling the next release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a query option to use more replica groups
7 participants