HuangZhenQiu commented on code in PR #26640:
URL: https://github.com/apache/flink/pull/26640#discussion_r2174967576
##########
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/state/rocksdb/RocksDBStateUploader.java:
##########
@@ -32,32 +32,46 @@
import org.apache.flink.util.concurrent.FutureUtils;
import org.apache.flink.util.function.CheckedSupplier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import javax.annotation.Nonnull;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
+import java.util.Random;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
+import java.util.function.Consumer;
import java.util.stream.Collectors;
/** Help class for uploading RocksDB state files. */
public class RocksDBStateUploader implements Closeable {
+ private static final Logger LOG =
LoggerFactory.getLogger(RocksDBStateUploader.class);
private static final int READ_BUFFER_SIZE = 16 * 1024;
-
+ private final Duration uploadJitter;
+ private final Random random;
Review Comment:
I tried to use Math.random(), but it still needs to convert double into a
range between 0 to the jitter unbound. Thus, Make the random static is probably
a cleaner solution
##########
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/state/rocksdb/EmbeddedRocksDBStateBackend.java:
##########
@@ -140,6 +142,9 @@ public class EmbeddedRocksDBStateBackend extends
AbstractManagedMemoryStateBacke
/** Thread number used to transfer (download and upload) state, default
value: 1. */
private int numberOfTransferThreads;
+ /** The max duration of checkpoint uploader jitter. */
+ private Duration checkpointUploadJitter;
Review Comment:
Done.
##########
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/state/rocksdb/RocksDBKeyedStateBackendBuilder.java:
##########
@@ -271,6 +274,12 @@ RocksDBKeyedStateBackendBuilder<K>
setNumberOfTransferingThreads(
return this;
}
+ RocksDBKeyedStateBackendBuilder<K> setCheckpointUploadJitter(Duration
uploadJitter) {
Review Comment:
It is to keep the style of the class.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]