mirror of https://github.com/apache/druid.git
Add /readiness to HistoricalResource (#4916)
* Add /loadStatusCode to HistoricalResource * Address comments * Fixes
This commit is contained in:
parent
56fb11ce0b
commit
7a9940d624
|
@ -50,4 +50,11 @@ Returns the Druid version, loaded extensions, memory used, total memory and othe
|
|||
|
||||
* `/druid/historical/v1/loadstatus`
|
||||
|
||||
Returns a flag indicating if all segments in the local cache have been loaded. This can be used to know when a historical node is ready to be queried after a restart.
|
||||
Returns JSON of the form `{"cacheInitialized":<value>}`, where value is either `true` or `false` indicating if all
|
||||
segments in the local cache have been loaded. This can be used to know when a historical node is ready
|
||||
to be queried after a restart.
|
||||
|
||||
* `/druid/historical/v1/readiness`
|
||||
|
||||
Similar to `/druid/historical/v1/loadstatus`, but instead of returning JSON with a flag, responses 200 OK if segments
|
||||
in the local cache have been loaded, and 503 SERVICE UNAVAILABLE, if they haven't.
|
||||
|
|
|
@ -52,4 +52,15 @@ public class HistoricalResource
|
|||
{
|
||||
return Response.ok(ImmutableMap.of("cacheInitialized", coordinator.isStarted())).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/readiness")
|
||||
public Response getReadiness()
|
||||
{
|
||||
if (coordinator.isStarted()) {
|
||||
return Response.ok().build();
|
||||
} else {
|
||||
return Response.status(Response.Status.SERVICE_UNAVAILABLE).build();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue