@PublicEvolving public class SavepointWriter extends Object
SavepointWriter
can create new savepoints from bounded data streams. This can allow for
boostrapping state for new applications or modifying the savepoints of existing jobs.Modifier and Type | Field and Description |
---|---|
protected SavepointMetadataV2 |
metadata
The savepoint metadata, which maintains the current set of existing / newly added operator
states.
|
protected StateBackend |
stateBackend
The state backend to use when writing this savepoint.
|
Modifier and Type | Method and Description |
---|---|
SavepointWriter |
changeOperatorIdentifier(OperatorIdentifier from,
OperatorIdentifier to)
Changes the identifier of an operator.
|
static SavepointWriter |
fromExistingSavepoint(StreamExecutionEnvironment executionEnvironment,
String path)
Loads an existing savepoint.
|
static SavepointWriter |
fromExistingSavepoint(StreamExecutionEnvironment executionEnvironment,
String path,
StateBackend stateBackend)
Loads an existing savepoint.
|
static SavepointWriter |
fromExistingSavepoint(String path)
Deprecated.
|
static SavepointWriter |
fromExistingSavepoint(String path,
StateBackend stateBackend)
|
static SavepointWriter |
newSavepoint(int maxParallelism)
Deprecated.
|
static SavepointWriter |
newSavepoint(StateBackend stateBackend,
int maxParallelism)
Deprecated.
|
static SavepointWriter |
newSavepoint(StreamExecutionEnvironment executionEnvironment,
int maxParallelism)
Creates a new savepoint.
|
static SavepointWriter |
newSavepoint(StreamExecutionEnvironment executionEnvironment,
StateBackend stateBackend,
int maxParallelism)
Creates a new savepoint.
|
SavepointWriter |
removeOperator(OperatorIdentifier identifier)
Drop an existing operator from the savepoint.
|
SavepointWriter |
removeOperator(String uid)
Deprecated.
|
<T> SavepointWriter |
withConfiguration(ConfigOption<T> option,
T value)
Sets a configuration that will be applied to the stream operators used to bootstrap a new
savepoint.
|
<T> SavepointWriter |
withOperator(OperatorIdentifier identifier,
StateBootstrapTransformation<T> transformation)
Adds a new operator to the savepoint.
|
<T> SavepointWriter |
withOperator(String uid,
StateBootstrapTransformation<T> transformation)
Deprecated.
|
void |
write(String path)
Write out a new or updated savepoint.
|
protected final SavepointMetadataV2 metadata
@Nullable protected final StateBackend stateBackend
@Deprecated public static SavepointWriter fromExistingSavepoint(String path) throws IOException
fromExistingSavepoint(StreamExecutionEnvironment, String)
IOException
public static SavepointWriter fromExistingSavepoint(StreamExecutionEnvironment executionEnvironment, String path) throws IOException
path
- The path to an existing savepoint on disk.SavepointWriter
.IOException
fromExistingSavepoint(StreamExecutionEnvironment, String, StateBackend)
,
withConfiguration(ConfigOption, Object)
@Deprecated public static SavepointWriter fromExistingSavepoint(String path, StateBackend stateBackend) throws IOException
IOException
public static SavepointWriter fromExistingSavepoint(StreamExecutionEnvironment executionEnvironment, String path, StateBackend stateBackend) throws IOException
path
- The path to an existing savepoint on disk.stateBackend
- The state backend of the savepoint.SavepointWriter
.IOException
fromExistingSavepoint(String)
@Deprecated public static SavepointWriter newSavepoint(int maxParallelism)
newSavepoint(StreamExecutionEnvironment, int)
public static SavepointWriter newSavepoint(StreamExecutionEnvironment executionEnvironment, int maxParallelism)
maxParallelism
- The max parallelism of the savepoint.SavepointWriter
.newSavepoint(StreamExecutionEnvironment, StateBackend, int)
,
withConfiguration(ConfigOption, Object)
@Deprecated public static SavepointWriter newSavepoint(StateBackend stateBackend, int maxParallelism)
newSavepoint(StreamExecutionEnvironment, StateBackend, int)
public static SavepointWriter newSavepoint(StreamExecutionEnvironment executionEnvironment, StateBackend stateBackend, int maxParallelism)
stateBackend
- The state backend of the savepoint used for keyed state.maxParallelism
- The max parallelism of the savepoint.SavepointWriter
.newSavepoint(StreamExecutionEnvironment, int)
@Deprecated public SavepointWriter removeOperator(String uid)
removeOperator(OperatorIdentifier)
public SavepointWriter removeOperator(OperatorIdentifier identifier)
identifier
- The identifier of the operator.@Deprecated public <T> SavepointWriter withOperator(String uid, StateBootstrapTransformation<T> transformation)
public <T> SavepointWriter withOperator(OperatorIdentifier identifier, StateBootstrapTransformation<T> transformation)
identifier
- The identifier of the operator.transformation
- The operator to be included.public <T> SavepointWriter withConfiguration(ConfigOption<T> option, T value)
T
- type of the value to be storedoption
- metadata informationvalue
- value to be storedpublic SavepointWriter changeOperatorIdentifier(OperatorIdentifier from, OperatorIdentifier to)
This method is comparatively cheap since it only modifies savepoint metadata without reading the entire savepoint data.
Use-cases include, but are not limited to:
Identifier changes are applied after all other operations; in the following example the savepoint will only contain UID_2.
SavepointWriter savepoint = ... savepoint.withOperator(UID_1, ...) savepoint.changeOperatorIdentifier(UID_1, UID_2) savepoint.write(...)
You cannot define a chain of changes; in the following example the savepoint will only contain UID_2.
SavepointWriter savepoint = ... savepoint.withOperator(UID_1, ...) savepoint.changeOperatorIdentifier(UID_1, UID_2) savepoint.changeOperatorIdentifier(UID_2, UID_3) savepoint.write(...)
from
- operator whose identifier should be changedto
- desired identifierpublic final void write(String path)
path
- The path to where the savepoint should be written.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.