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 controller API to get allLiveInstances #12498

Merged
merged 3 commits into from
Feb 28, 2024

Conversation

tibrewalpratik17
Copy link
Contributor

@tibrewalpratik17 tibrewalpratik17 commented Feb 26, 2024

label:
api

Adding a controller API to get all live instances in the cluster.

  • We fetch all instances for a cluster for attribution internally. Some of them are dead and causes issues in the attribution logic. Having /liveinstances endpoint will help in having the correct set of valid instances.

Updated UTs to test the change.

@codecov-commenter
Copy link

codecov-commenter commented Feb 26, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 61.71%. Comparing base (59551e4) to head (3a1a09e).
Report is 21 commits behind head on master.

Files Patch % Lines
...er/api/resources/PinotInstanceRestletResource.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #12498      +/-   ##
============================================
- Coverage     61.75%   61.71%   -0.05%     
  Complexity      207      207              
============================================
  Files          2436     2449      +13     
  Lines        133233   133505     +272     
  Branches      20636    20686      +50     
============================================
+ Hits          82274    82386     +112     
- Misses        44911    45037     +126     
- Partials       6048     6082      +34     
Flag Coverage Δ
custom-integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration <0.01% <0.00%> (-0.01%) ⬇️
integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration2 0.00% <0.00%> (ø)
java-11 61.65% <50.00%> (-0.06%) ⬇️
java-21 61.57% <50.00%> (-0.06%) ⬇️
skip-bytebuffers-false 61.69% <50.00%> (-0.06%) ⬇️
skip-bytebuffers-true 61.55% <50.00%> (+33.82%) ⬆️
temurin 61.71% <50.00%> (-0.05%) ⬇️
unittests 61.70% <50.00%> (-0.05%) ⬇️
unittests1 46.83% <ø> (-0.06%) ⬇️
unittests2 27.70% <50.00%> (-0.03%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Path("/liveinstances")
@Authorize(targetType = TargetType.CLUSTER, action = Actions.Cluster.GET_INSTANCE)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "List all live instances")
Copy link
Contributor

Choose a reason for hiding this comment

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

Would this also list instances that have temporarily disconnected from Helix? (due to GC, regular restart, etc.)

If not, might be good to call it out explicitly in the description.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tested via the following:

  • Restarted a node in one of our clusters. During the restart we did not get the instance id of that node in the /liveinstances ZK path. Post restart, we got the instance back.

Copy link
Contributor

@ankitsultana ankitsultana left a comment

Choose a reason for hiding this comment

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

change lgtm. tagged @Jackie-Jiang to see if he has any opinions on this. I see that there was a controller task updated in #10027 to fix this issue. But having this endpoint might anyways be useful.

Copy link
Member

@satishd satishd left a comment

Choose a reason for hiding this comment

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

Thanks @tibrewalpratik17 for the PR. The added API /liveinstances seems reasonable to me.

Copy link
Contributor

@Jackie-Jiang Jackie-Jiang left a comment

Choose a reason for hiding this comment

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

LGTM otherwise

@Jackie-Jiang Jackie-Jiang merged commit 7e6117f into apache:master Feb 28, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants