jon-wei commented on a change in pull request #7490: Add reload by interval API
URL: https://github.com/apache/incubator-druid/pull/7490#discussion_r277065396
##########
File path:
server/src/main/java/org/apache/druid/server/http/DataSourcesResource.java
##########
@@ -700,4 +704,85 @@ static boolean
isSegmentLoaded(Iterable<ImmutableSegmentLoadInfo> serverView, Se
}
return false;
}
+
+ @PUT
+ @Path("/{dataSourceName}/markUsed")
+ @Produces(MediaType.APPLICATION_JSON)
+ @ResourceFilters(DatasourceResourceFilter.class)
+ public Response enableDatasourceSegments(
+ @PathParam("dataSourceName") String dataSourceName,
+ MarkDatasourceSegmentsPayload payload
+ )
+ {
+ if (payload == null || !payload.isValid()) {
+ return Response.status(Response.Status.BAD_REQUEST).entity(
+ ImmutableMap.of(
+ "error",
+ "Either a valid interval or segmentIds array must be specified"
+ )
+ ).build();
+ }
+
+ final ImmutableDruidDataSource dataSource = getDataSource(dataSourceName);
+ if (dataSource == null) {
+ return Response.noContent().build();
+ }
+
+ boolean success;
+ try {
+ if (payload.getInterval() != null) {
+ success = databaseSegmentManager.enableSegments(dataSource.getName(),
payload.getInterval());
+ } else {
+ success = databaseSegmentManager.enableSegments(dataSource.getName(),
payload.getSegmentIds());
Review comment:
For the segmentId case, I think it would be informative if the response gave
per-segment success/fail info
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]