github-advanced-security[bot] commented on code in PR #19051:
URL: https://github.com/apache/druid/pull/19051#discussion_r2853927687
##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorResource.java:
##########
@@ -351,6 +357,79 @@
);
}
+ @GET
+ @Path("/{id}/reindexingTimeline")
+ @Produces(MediaType.APPLICATION_JSON)
+ @ResourceFilters(SupervisorResourceFilter.class)
+ public Response getReindexingTimeline(
+ @PathParam("id") final String id,
+ @QueryParam("referenceTime") @Nullable final String referenceTimeStr
+ )
+ {
+ return asLeaderWithSupervisorManager(
+ manager -> {
+ Optional<SupervisorSpec> specOptional =
manager.getSupervisorSpec(id);
+ if (!specOptional.isPresent()) {
+ return Response.status(Response.Status.NOT_FOUND)
+ .entity(ImmutableMap.of("error",
StringUtils.format("Supervisor[%s] does not exist", id)))
+ .build();
+ }
+
+ SupervisorSpec spec = specOptional.get();
+ if (!(spec instanceof CompactionSupervisorSpec)) {
+ return Response.status(Response.Status.BAD_REQUEST)
+ .entity(ImmutableMap.of(
+ "error",
+ StringUtils.format(
+ "Supervisor[%s] is not a compaction
supervisor",
+ id,
+ spec.getClass().getSimpleName()
+ )
Review Comment:
## Unused format argument
This format call refers to 1 argument(s) but supplies 2 argument(s).
[Show more
details](https://github.com/apache/druid/security/code-scanning/10834)
##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorResource.java:
##########
@@ -351,6 +357,79 @@
);
}
+ @GET
+ @Path("/{id}/reindexingTimeline")
+ @Produces(MediaType.APPLICATION_JSON)
+ @ResourceFilters(SupervisorResourceFilter.class)
+ public Response getReindexingTimeline(
+ @PathParam("id") final String id,
+ @QueryParam("referenceTime") @Nullable final String referenceTimeStr
+ )
+ {
+ return asLeaderWithSupervisorManager(
+ manager -> {
+ Optional<SupervisorSpec> specOptional =
manager.getSupervisorSpec(id);
+ if (!specOptional.isPresent()) {
+ return Response.status(Response.Status.NOT_FOUND)
+ .entity(ImmutableMap.of("error",
StringUtils.format("Supervisor[%s] does not exist", id)))
+ .build();
+ }
+
+ SupervisorSpec spec = specOptional.get();
+ if (!(spec instanceof CompactionSupervisorSpec)) {
+ return Response.status(Response.Status.BAD_REQUEST)
+ .entity(ImmutableMap.of(
+ "error",
+ StringUtils.format(
+ "Supervisor[%s] is not a compaction
supervisor",
+ id,
+ spec.getClass().getSimpleName()
+ )
+ ))
+ .build();
+ }
+
+ CompactionSupervisorSpec compactionSpec = (CompactionSupervisorSpec)
spec;
+
+ DateTime referenceTime;
+ if (referenceTimeStr != null) {
+ try {
+ referenceTime = DateTimes.of(referenceTimeStr);
+ }
+ catch (IllegalArgumentException e) {
+ return Response.status(Response.Status.BAD_REQUEST)
+ .entity(ImmutableMap.of(
+ "error",
+ StringUtils.format("Reference time[%s] is in
invalid format. Use ISO 8601 standard format.")
Review Comment:
## Missing format argument
This format call refers to 1 argument(s) but only supplies 0 argument(s).
[Show more
details](https://github.com/apache/druid/security/code-scanning/10836)
##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorResource.java:
##########
@@ -351,6 +357,79 @@
);
}
+ @GET
+ @Path("/{id}/reindexingTimeline")
+ @Produces(MediaType.APPLICATION_JSON)
+ @ResourceFilters(SupervisorResourceFilter.class)
+ public Response getReindexingTimeline(
+ @PathParam("id") final String id,
+ @QueryParam("referenceTime") @Nullable final String referenceTimeStr
+ )
+ {
+ return asLeaderWithSupervisorManager(
+ manager -> {
+ Optional<SupervisorSpec> specOptional =
manager.getSupervisorSpec(id);
+ if (!specOptional.isPresent()) {
+ return Response.status(Response.Status.NOT_FOUND)
+ .entity(ImmutableMap.of("error",
StringUtils.format("Supervisor[%s] does not exist", id)))
+ .build();
+ }
+
+ SupervisorSpec spec = specOptional.get();
+ if (!(spec instanceof CompactionSupervisorSpec)) {
+ return Response.status(Response.Status.BAD_REQUEST)
+ .entity(ImmutableMap.of(
+ "error",
+ StringUtils.format(
+ "Supervisor[%s] is not a compaction
supervisor",
+ id,
+ spec.getClass().getSimpleName()
+ )
+ ))
+ .build();
+ }
+
+ CompactionSupervisorSpec compactionSpec = (CompactionSupervisorSpec)
spec;
+
+ DateTime referenceTime;
+ if (referenceTimeStr != null) {
+ try {
+ referenceTime = DateTimes.of(referenceTimeStr);
+ }
+ catch (IllegalArgumentException e) {
+ return Response.status(Response.Status.BAD_REQUEST)
+ .entity(ImmutableMap.of(
+ "error",
+ StringUtils.format("Reference time[%s] is in
invalid format. Use ISO 8601 standard format.")
+ ))
+ .build();
+ }
+ } else {
+ referenceTime = DateTimes.nowUtc();
+ }
+
+ CompactionJobTemplate template = compactionSpec.getTemplate();
+ if (!(template instanceof CascadingReindexingTemplate)) {
+ return Response.status(Response.Status.BAD_REQUEST)
+ .entity(ImmutableMap.of(
+ "error",
+ StringUtils.format(
+ "Reindexing timeline is not available for
supervisor[%s] as it does not use a cascading template",
+ id,
+ template.getClass().getSimpleName()
+ )
Review Comment:
## Unused format argument
This format call refers to 1 argument(s) but supplies 2 argument(s).
[Show more
details](https://github.com/apache/druid/security/code-scanning/10835)
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]