StefanRRichter commented on a change in pull request #7674: [FLINK-10043]
[State Backends] Refactor RocksDBKeyedStateBackend object
construction/initialization/restore code
URL: https://github.com/apache/flink/pull/7674#discussion_r257759063
##########
File path:
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/BackendRestorerProcedure.java
##########
@@ -141,14 +141,17 @@ public T createAndRestore(@Nonnull List<? extends
Collection<S>> restoreOptions)
private T attemptCreateAndRestore(Collection<S> restoreState) throws
Exception {
// create a new, empty backend.
- final T backendInstance = instanceSupplier.get();
+ final T backendInstance = instanceSupplier.apply(restoreState);
try {
// register the backend with the registry to
participate in task lifecycle w.r.t. cancellation.
backendCloseableRegistry.registerCloseable(backendInstance);
// attempt to restore from snapshot (or null if no
state was checkpointed).
- backendInstance.restore(restoreState);
+ // TODO we could remove this invocation when moving all
backend's restore into builder
+ if
(!backendInstance.getClass().getName().contains("RocksDBKeyedStateBackend")) {
Review comment:
I think that when the tests we discussed are changed then we should be able
to make `RocksDBKeyedStateBackend::restore(...)` an empty method, because I
think keeping the method was only required as workaround for
`RocksDBStateBackendTest`. `RocksDBStateBackendTest` can be refactored to avoid
this, as described in one of my other comments. Once
`RocksDBKeyedStateBackend::restore(...)` is an empty method, you can remove the
extra check and just always call restore. The same for all the tests where you
currently added `if (backend instanceof HeapKeyedStateBackend)
{backend.restore(...); }`.
----------------------------------------------------------------
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