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 Server API to get tenant pools #11273

Merged
merged 3 commits into from
Aug 11, 2023
Merged

Conversation

MeihanLi
Copy link
Contributor

@MeihanLi MeihanLi commented Aug 4, 2023

Add a new Server API GET /instance/pools in InstanceResource to get server pools. feature

It returns an empty map if the server is not assigned to any pool number

Tested locally:

  1. server is not assigned to any pool number
❯ curl localhost:7500/instance/pools | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100     2  100     2    0     0    153      0 --:--:-- --:--:-- --:--:--   333
{}
  1. server is assigned to pool numbers
❯ curl localhost:7500/instance/pools | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    58  100    58    0     0   5070      0 --:--:-- --:--:-- --:--:-- 11600
{
  "DefaultTenant_OFFLINE": "0",
  "DefaultTenant_REALTIME": "0"
}

@MeihanLi MeihanLi force-pushed the server_pool_api branch 2 times, most recently from 4330ccb to e390e53 Compare August 4, 2023 23:34
@MeihanLi
Copy link
Contributor Author

MeihanLi commented Aug 4, 2023

cc: @chenboat can you help review it? Thanks!

@codecov-commenter
Copy link

codecov-commenter commented Aug 5, 2023

Codecov Report

Merging #11273 (a63fb4d) into master (0984168) will decrease coverage by 0.01%.
Report is 29 commits behind head on master.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master   #11273      +/-   ##
==========================================
- Coverage    0.11%    0.11%   -0.01%     
==========================================
  Files        2229     2239      +10     
  Lines      119963   120429     +466     
  Branches    18183    18217      +34     
==========================================
  Hits          137      137              
- Misses     119806   120272     +466     
  Partials       20       20              
Flag Coverage Δ
integration1temurin11 0.00% <0.00%> (ø)
integration1temurin17 0.00% <0.00%> (ø)
integration1temurin20 0.00% <0.00%> (ø)
integration2temurin11 0.00% <0.00%> (ø)
integration2temurin17 0.00% <0.00%> (ø)
integration2temurin20 0.00% <0.00%> (ø)
unittests1temurin11 0.00% <ø> (ø)
unittests1temurin17 0.00% <ø> (ø)
unittests1temurin20 0.00% <ø> (ø)
unittests2temurin11 0.11% <0.00%> (-0.01%) ⬇️
unittests2temurin17 0.11% <0.00%> (-0.01%) ⬇️
unittests2temurin20 0.11% <0.00%> (-0.01%) ⬇️

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

Files Changed Coverage Δ
...e/pinot/server/api/resources/InstanceResource.java 0.00% <0.00%> (ø)

... and 58 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

})
@Produces(MediaType.APPLICATION_JSON)
public Map<String, String> getInstancePools() {
InstanceConfig instanceConfig = HelixHelper.getInstanceConfig(_helixManager, _instanceId);
Copy link
Contributor

Choose a reason for hiding this comment

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

need null check for instanceConfig (similar to getInstanceTags)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks Ankit, addressed

@ApiOperation(value = "Tenant pools for current instance")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Success"), @ApiResponse(code = 500, message = "Internal server error")
})
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. can you add the javadoc to explain return result types? i.e.,The summary in the PR looks good.
  2. Can you add a Pinot doc reference to the definition of pool in Pinot?

@chenboat chenboat merged commit 5290b80 into apache:master Aug 11, 2023
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants