maytasm commented on a change in pull request #9965:
URL: https://github.com/apache/druid/pull/9965#discussion_r439707193
##########
File path:
server/src/main/java/org/apache/druid/server/http/DataSourcesResource.java
##########
@@ -391,6 +396,123 @@ public Response getServedSegmentsInInterval(
return getServedSegmentsInInterval(dataSourceName, full != null,
theInterval::contains);
}
+ @GET
+ @Path("/{dataSourceName}/loadstatus")
+ @Produces(MediaType.APPLICATION_JSON)
+ @ResourceFilters(DatasourceResourceFilter.class)
+ public Response getDatasourceLoadstatus(
+ @PathParam("dataSourceName") String dataSourceName,
+ @QueryParam("interval") @Nullable final String interval,
+ @QueryParam("forceMetadataRefresh") @Nullable final Boolean
forceMetadataRefresh,
+ @QueryParam("simple") @Nullable final String simple,
+ @QueryParam("full") @Nullable final String full
+ )
+ {
+ final Interval theInterval;
+ if (interval == null) {
+ long defaultIntervalOffset = 14 * 24 * 60 * 60 * 1000;
+ long currentTimeInMs = System.currentTimeMillis();
+ theInterval = Intervals.utc(currentTimeInMs - defaultIntervalOffset,
currentTimeInMs);
+ } else {
+ theInterval = Intervals.of(interval.replace('_', '/'));
+ }
+
+ boolean requiresMetadataStorePoll = forceMetadataRefresh == null ? true :
forceMetadataRefresh;
Review comment:
Making this field mandatory instead. 400 bad request will be returned if
forceMetadataRefresh is not given. This will make sure user read and understand
the doc when using this API. To use this API properly, you will have to change
the flag in the flow between first call and subsequent call. Hence, there is no
“default” as the flag are for different cases. Basically both flags are as
default as the other flag and are needed for different step in the flow.
##########
File path:
server/src/main/java/org/apache/druid/server/http/DataSourcesResource.java
##########
@@ -391,6 +396,123 @@ public Response getServedSegmentsInInterval(
return getServedSegmentsInInterval(dataSourceName, full != null,
theInterval::contains);
}
+ @GET
+ @Path("/{dataSourceName}/loadstatus")
+ @Produces(MediaType.APPLICATION_JSON)
+ @ResourceFilters(DatasourceResourceFilter.class)
+ public Response getDatasourceLoadstatus(
+ @PathParam("dataSourceName") String dataSourceName,
+ @QueryParam("interval") @Nullable final String interval,
+ @QueryParam("forceMetadataRefresh") @Nullable final Boolean
forceMetadataRefresh,
+ @QueryParam("simple") @Nullable final String simple,
+ @QueryParam("full") @Nullable final String full
+ )
+ {
+ final Interval theInterval;
+ if (interval == null) {
+ long defaultIntervalOffset = 14 * 24 * 60 * 60 * 1000;
+ long currentTimeInMs = System.currentTimeMillis();
+ theInterval = Intervals.utc(currentTimeInMs - defaultIntervalOffset,
currentTimeInMs);
+ } else {
+ theInterval = Intervals.of(interval.replace('_', '/'));
+ }
+
+ boolean requiresMetadataStorePoll = forceMetadataRefresh == null ? true :
forceMetadataRefresh;
+
+ Optional<Iterable<DataSegment>> segments =
segmentsMetadataManager.iterateAllUsedNonOvershadowedSegmentsForDatasourceInterval(
+ dataSourceName,
+ theInterval,
+ requiresMetadataStorePoll
+ );
+
+ if (!segments.isPresent()) {
+ return logAndCreateDataSourceNotFoundResponse(dataSourceName);
+ }
+
+ if (simple != null) {
Review comment:
Done
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]