public class SavepointHandlers extends AbstractAsynchronousOperationHandlers<AsynchronousJobOperationKey,String>
Drawing savepoints is a potentially long-running operation. To avoid blocking HTTP
connections, savepoints must be drawn in two steps. First, an HTTP request is issued to trigger
the savepoint asynchronously. The request will be assigned a TriggerId
, which is returned
in the response body. Next, the returned id should be used to poll the status of the savepoint
until it is finished.
A savepoint is triggered by sending an HTTP POST
request to /jobs/:jobid/savepoints
. The HTTP request may contain a JSON body to specify the target
directory of the savepoint, e.g.,
{ "target-directory": "/tmp" }
If the body is omitted, or the field target-property
is null
, the default
savepoint directory as specified by CheckpointingOptions.SAVEPOINT_DIRECTORY
will be
used. As written above, the response will contain a request id, e.g.,
{ "request-id": "7d273f5a62eb4730b9dea8e833733c1e" }
To poll for the status of an ongoing savepoint, an HTTP GET
request is issued to
/jobs/:jobid/savepoints/:savepointtriggerid
. If the specified savepoint is still ongoing,
the response will be
{ "status": { "id": "IN_PROGRESS" } }
If the specified savepoint has completed, the status id will transition to COMPLETED
,
and the response will additionally contain information about the savepoint, such as the location:
{ "status": { "id": "COMPLETED" }, "operation": { "location": "/tmp/savepoint-d9813b-8a68e674325b" } }
Modifier and Type | Class and Description |
---|---|
class |
SavepointHandlers.SavepointStatusHandler
HTTP handler to query for the status of the savepoint.
|
class |
SavepointHandlers.SavepointTriggerHandler
HTTP handler to trigger savepoints.
|
class |
SavepointHandlers.StopWithSavepointHandler
HTTP handler to stop a job with a savepoint.
|
AbstractAsynchronousOperationHandlers.StatusHandler<T extends RestfulGateway,V,M extends MessageParameters>, AbstractAsynchronousOperationHandlers.TriggerHandler<T extends RestfulGateway,B extends RequestBody,M extends MessageParameters>
Constructor and Description |
---|
SavepointHandlers(String defaultSavepointDir) |
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.