-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 changes to Point in time segments API service layer #4105
Conversation
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
760c517
to
42f5f10
Compare
Gradle Check (Jenkins) Run Completed with:
|
return pitIds; | ||
} | ||
|
||
public void setPitIds(Collection<String> pitIds) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for having setter. We can have it initialised during construction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah in transport layer, if no pit ids are passed, we get all PITs and set it in request.
|
||
} | ||
|
||
public Collection<String> getPitIds() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UnmodifiableList
? Also i don't see anywhere we are using it apart from List type. We can use List itself.
*/ | ||
public class PitSegmentsRequest extends BroadcastRequest<PitSegmentsRequest> { | ||
|
||
protected boolean verbose = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why protected if we already have setter and getter public methods.
Since default value is false
. So don't need to mention it specifically.
* Sets the <code>verbose</code> option. | ||
* @see #verbose() | ||
*/ | ||
public void verbose(boolean v) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setVerbose
?
* <code>true</code> if detailed information about each segment should be returned, | ||
* <code>false</code> otherwise. | ||
*/ | ||
public boolean verbose() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isVerbose
for clarity?
Gradle Check (Jenkins) Run Completed with:
|
...r/src/main/java/org/opensearch/action/admin/indices/segments/TransportPitSegmentsAction.java
Show resolved
Hide resolved
Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
c29f252
to
cd5263f
Compare
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
} | ||
|
||
public List<Segment> getSegments() { | ||
return segments; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collection.unmodifiable
IndicesSegmentResponse indicesSegmentResponse = client.execute(PitSegmentsAction.INSTANCE, new PitSegmentsRequest()).actionGet(); | ||
assertTrue(indicesSegmentResponse.getShardFailures() == null || indicesSegmentResponse.getShardFailures().length == 0); | ||
if (isEmpty) { | ||
assertTrue(indicesSegmentResponse.getIndices().size() == 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can use assertEquals(indicesSegmentResponse.getIndices().isEmpty(), isEmpty);
and avoid if/else block
Gradle Check (Jenkins) Run Completed with:
|
* Transport request for retrieving PITs segment information | ||
*/ | ||
public class PitSegmentsRequest extends BroadcastRequest<PitSegmentsRequest> { | ||
boolean verbose = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can simply write private boolean verbose;
. Since default initialisation is false for boolean. No need to give package access to variable as we already have public setter.
Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
cd5263f
to
babab92
Compare
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
The build is failing, please fix it. |
Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
184e206
to
51ef240
Compare
Gradle Check (Jenkins) Run Completed with:
|
*/ | ||
@Override | ||
protected ShardSegments shardOperation(PitSegmentsRequest request, ShardRouting shardRouting) { | ||
if (shardRouting instanceof PitAwareShardRouting) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be an assertion instead of an if condition
.get(shardRouting.shardId()); | ||
PitReaderContext pitReaderContext = searchService.getPitReaderContext(searchContextIdForNode.getSearchContextId()); | ||
if (pitReaderContext == null) { | ||
return new ShardSegments(shardRouting, new ArrayList<>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collections.emptyList()
instead?
} else { | ||
throw new IllegalArgumentException("Shard routing is not of PitAwareShardRouting type"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets remove and replace with assertion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
bdc97fb
to
903588e
Compare
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
@reta @Bukhtawar I've addressed comments, if changes look good can you please approve / merge. |
@Override | ||
protected ClusterBlockException checkGlobalBlock(ClusterState state, PitSegmentsRequest request) { | ||
return state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_READ); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be READ
instead of METADATA_READ
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
METADATA_READ
is used in index segments as well. Read
is used in operations like search, multisearch etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple of minor comments. Please review them
Gradle Check (Jenkins) Run Completed with:
|
b3a9c87
to
f100c7b
Compare
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
f100c7b
to
78c645b
Compare
Gradle Check (Jenkins) Run Completed with:
|
@reta @Bukhtawar can we please merge this ? |
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Bharathwaj G bharath78910@gmail.com
Description
This contains service layer changes for retrieving segments information of PITs which provides information about disk utilization of PIT
Issues Resolved
#1147
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.