kfaraz commented on code in PR #16768:
URL: https://github.com/apache/druid/pull/16768#discussion_r1738565421
##########
server/src/main/java/org/apache/druid/server/http/CompactionResource.java:
##########
@@ -100,4 +114,31 @@ public Response getCompactionSnapshotForDataSource(
}
return Response.ok(ImmutableMap.of("latestStatus", snapshots)).build();
}
+
+ @POST
+ @Path("/simulate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Response simulateClusterCompactionConfigUpdate(
+ ClusterCompactionConfig updatePayload
+ )
+ {
+ if (compactionSupervisorsConfig.isEnabled()) {
+ return buildErrorResponseWhenRunningAsSupervisor();
+ }
+
+ return Response.ok().entity(
+ coordinator.simulateRunWithConfigUpdate(updatePayload)
+ ).build();
+ }
+
+ private Response buildErrorResponseWhenRunningAsSupervisor()
+ {
+ return Response.status(Response.Status.SERVICE_UNAVAILABLE).entity(
+ ImmutableMap.of(
+ "error",
+ "Compaction has been disabled on the Coordinator."
+ + " Use Overlord APIs to fetch compaction status."
+ )
+ ).build();
+ }
Review Comment:
@abhishekagarwal87 , to deal with the issue with rolling upgrades, I decide
to do this instead.
- The leader Overlord is the single source of truth on whether the feature
is enabled.
- API `/druid/indexer/v1/compaction/isSupervisorEnabled` can be used by the
Coordinator to determine if the feature is enabled.
- If enabled, Coordinator redirects the compaction status APIs to the leader
Overlord using the `OverlordClient`.
- Router does not perform any redirecting between Overlord and Coordinator.
- __Overlord does not redirect to Coordinator.__ When the feature is
disabled, Overlord simply returns a 504 (service unavailable) with an
appropriate error message. This is to keep things simple and to avoid getting
into an infinite redirect situation.
The only reason we need the redirect is that a client (like web-console)
using the Coordinator compaction status APIs continues to work seamlessly when
we toggle the feature on or off. With a client explicitly using the new
Overlord APIs, we don't have the burden of backward compatibility and thus no
redirect is required.
--
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]