carp84 commented on a change in pull request #10329: 
[FLINK-12785][StateBackend] RocksDB savepoint recovery can use a lot of 
unmanaged memory
URL: https://github.com/apache/flink/pull/10329#discussion_r353669969
 
 

 ##########
 File path: 
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBWriteBatchWrapper.java
 ##########
 @@ -49,22 +53,35 @@
 
        private final int capacity;
 
-       public RocksDBWriteBatchWrapper(@Nonnull RocksDB rocksDB) {
-               this(rocksDB, null, 500);
+       @Nonnegative
+       private final long batchSize;
+
+       public RocksDBWriteBatchWrapper(@Nonnull RocksDB rocksDB, long 
writeBatchSize) {
+               this(rocksDB, null, 500, writeBatchSize);
        }
 
        public RocksDBWriteBatchWrapper(@Nonnull RocksDB rocksDB, @Nullable 
WriteOptions options) {
-               this(rocksDB, options, 500);
+               this(rocksDB, options, 500, DEFAULT_BATCH_SIZE);
+       }
+
+       public RocksDBWriteBatchWrapper(@Nonnull RocksDB rocksDB, @Nullable 
WriteOptions options, long batchSize) {
+               this(rocksDB, options, 500, batchSize);
        }
 
-       public RocksDBWriteBatchWrapper(@Nonnull RocksDB rocksDB, @Nullable 
WriteOptions options, int capacity) {
+       public RocksDBWriteBatchWrapper(@Nonnull RocksDB rocksDB, @Nullable 
WriteOptions options, int capacity, long batchSize) {
                Preconditions.checkArgument(capacity >= MIN_CAPACITY && 
capacity <= MAX_CAPACITY,
                        "capacity should be between " + MIN_CAPACITY + " and " 
+ MAX_CAPACITY);
+               Preconditions.checkArgument(batchSize >= 0, "Max batch size 
have to be no negative.");
 
 Review comment:
   We can use `@Nonnegative` for all function parameters instead of 
`checkArgument`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to