egor-ryashin commented on a change in pull request #6349: maintenance mode for
Historical
URL: https://github.com/apache/incubator-druid/pull/6349#discussion_r225124132
##########
File path:
server/src/main/java/org/apache/druid/server/http/CoordinatorDynamicConfigsResource.java
##########
@@ -84,22 +84,29 @@ public Response setDynamicConfigs(final
CoordinatorDynamicConfig.Builder dynamic
@Context HttpServletRequest req
)
{
- CoordinatorDynamicConfig current = manager.watch(
- CoordinatorDynamicConfig.CONFIG_KEY,
- CoordinatorDynamicConfig.class
- ).get();
+ try {
+ CoordinatorDynamicConfig current = manager.watch(
+ CoordinatorDynamicConfig.CONFIG_KEY,
+ CoordinatorDynamicConfig.class
+ ).get();
- final SetResult setResult = manager.set(
- CoordinatorDynamicConfig.CONFIG_KEY,
- current == null ? dynamicConfigBuilder.build() :
dynamicConfigBuilder.build(current),
- new AuditInfo(author, comment, req.getRemoteAddr())
- );
+ final SetResult setResult = manager.set(
+ CoordinatorDynamicConfig.CONFIG_KEY,
+ current == null ? dynamicConfigBuilder.build() :
dynamicConfigBuilder.build(current),
+ new AuditInfo(author, comment, req.getRemoteAddr())
+ );
- if (setResult.isOk()) {
- return Response.ok().build();
- } else {
+ if (setResult.isOk()) {
+ return Response.ok().build();
+ } else {
+ return Response.status(Response.Status.BAD_REQUEST)
+ .entity(ImmutableMap.of("error",
setResult.getException()))
+ .build();
+ }
+ }
+ catch (IllegalArgumentException e) {
return Response.status(Response.Status.BAD_REQUEST)
- .entity(ImmutableMap.of("error",
setResult.getException()))
+ .entity(ImmutableMap.<String, Object>of("error",
e.getMessage()))
Review comment:
✅
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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]