azagrebin commented on a change in pull request #7351: [FLINK-11008][State
Backends, Checkpointing]SpeedUp upload state files using multithread
URL: https://github.com/apache/flink/pull/7351#discussion_r246333395
##########
File path:
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDbStateDataTransfer.java
##########
@@ -61,6 +69,88 @@ static void transferAllStateDataToDirectory(
downloadDataForAllStateHandles(miscFiles, dest,
restoringThreadNum, closeableRegistry);
}
+ public static void uploadFilesToCheckpointFs(
+ @Nonnull Map<StateHandleID, Path> files,
+ int numberOfSnapshottingThreads,
+ CheckpointStreamFactory checkpointStreamFactory,
+ CloseableRegistry closeableRegistry,
+ Map<StateHandleID, StreamStateHandle> hanldes) throws Exception
{
+
+ ExecutorService executorService =
createExecutorService(numberOfSnapshottingThreads);
+
+ Map<StateHandleID, CompletableFuture<StreamStateHandle>>
futures = new HashMap<>(files.size());
+
+ for (Map.Entry<StateHandleID, Path> entry : files.entrySet()) {
Review comment:
What do you think if the first part, which creates futures, has its own
function `createUploadFutures`?
Also if `() -> uploadLocalFileToCheckpointFs(..)` is assigned to a separate
variable to reduce `futures.put(..)` line.
----------------------------------------------------------------
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