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

Track unavailable segments in InstanceSelector #5337

Merged

Conversation

Jackie-Jiang
Copy link
Contributor

@Jackie-Jiang Jackie-Jiang commented May 5, 2020

Unavailable segments are the segments that has no enabled instance or all enabled instances are in ERROR state.
We don't count segment with enabled instance in OFFLINE state as unavailable because it is a valid state when segment is new added and has not become ONLINE/CONSUMING.

Introduced RoutingTable class to wrap the a map from ServerInstance to segments and a list of unavailable segments.
Added a new property 'numUnavailableSegments' into the RequestStatistics.

@Jackie-Jiang
Copy link
Contributor Author

@fx19880617 This PR changed the broker debug API to return the unavailable segments within the routing table. Please check whether it is okay for presto connector

@Jackie-Jiang Jackie-Jiang force-pushed the routing_unavailable_segments branch 2 times, most recently from e5fa585 to 584eea6 Compare May 6, 2020 03:12
@codecov-io
Copy link

codecov-io commented May 6, 2020

Codecov Report

Merging #5337 into master will increase coverage by 9.41%.
The diff coverage is 88.07%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5337      +/-   ##
==========================================
+ Coverage   56.88%   66.29%   +9.41%     
==========================================
  Files        1073     1075       +2     
  Lines       54722    54775      +53     
  Branches     8159     8169      +10     
==========================================
+ Hits        31126    36313    +5187     
+ Misses      21149    15786    -5363     
- Partials     2447     2676     +229     
Impacted Files Coverage Δ
...rg/apache/pinot/broker/routing/RoutingManager.java 78.62% <50.00%> (+12.85%) ⬆️
...org/apache/pinot/broker/api/RequestStatistics.java 64.51% <66.66%> (+64.51%) ⬆️
...e/pinot/broker/api/resources/PinotBrokerDebug.java 79.31% <66.66%> (+79.31%) ⬆️
...roker/requesthandler/BaseBrokerRequestHandler.java 79.89% <81.81%> (+59.73%) ⬆️
.../org/apache/pinot/broker/routing/RoutingTable.java 100.00% <100.00%> (ø)
...routing/instanceselector/BaseInstanceSelector.java 100.00% <100.00%> (+11.42%) ⬆️
...ker/routing/instanceselector/InstanceSelector.java 100.00% <100.00%> (ø)
.../realtime/impl/ThreadSafeMutableRoaringBitmap.java 92.85% <0.00%> (-7.15%) ⬇️
... and 328 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 52001be...236ce24. Read the comment docs.

Map<String, List<String>> segmentToEnabledInstancesMap = _segmentToEnabledInstancesMap;
Set<String> currentUnavailableSegments = _unavailableSegments;
Copy link
Contributor

Choose a reason for hiding this comment

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

we dont need this variable, we can use _unavailableSegments in line 110 right?

Copy link
Contributor

Choose a reason for hiding this comment

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

It should be fine, it's just a reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

_unavailableSegments is volatile, so I find get its reference for performance concern

}

@Test
public void testUnavailableSegments() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Good to iterate this test a few times, with realtime table and with CONSUMING segments as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@mcvsubbu mcvsubbu left a comment

Choose a reason for hiding this comment

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

Other than minor comments, lgtm
Perhaps you can check this in and then @jackjlli can follow, or you can merge from his PR as needed

Copy link
Contributor

@jackjlli jackjlli left a comment

Choose a reason for hiding this comment

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

Minor but LGTM

Map<String, List<String>> segmentToEnabledInstancesMap = _segmentToEnabledInstancesMap;
Set<String> currentUnavailableSegments = _unavailableSegments;
Copy link
Contributor

Choose a reason for hiding this comment

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

It should be fine, it's just a reference.

}
}
_unavailableSegments = newUnavailableSegments;
}

@Override
public void onExternalViewChange(ExternalView externalView, Set<String> onlineSegments) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be good to put some comments on what you're gonna do in this method, as the logic becomes complex.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

@Jackie-Jiang
Copy link
Contributor Author

@fx19880617 This PR changed the broker debug API to return the unavailable segments within the routing table. Please check whether it is okay for presto connector

Discussed offline. Will keep the API unchanged.

Unavailable segments are the segments that has no enabled instance or all enabled instances are in ERROR state.
We don't count segment with enabled instance in OFFLINE state as unavailable because it is a valid state when segment is new added and has not become ONLINE/CONSUMING.

Introduced RoutingTable class to wrap the a map from ServerInstance to segments and a list of unavailable segments.
Added a new property 'numUnavailableSegments' into the RequestStatistics.
@Jackie-Jiang Jackie-Jiang force-pushed the routing_unavailable_segments branch from 584eea6 to 236ce24 Compare May 6, 2020 19:51
@Jackie-Jiang Jackie-Jiang merged commit f0ecdf1 into apache:master May 6, 2020
@Jackie-Jiang Jackie-Jiang deleted the routing_unavailable_segments branch May 6, 2020 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants