Github user StefanRRichter commented on a diff in the pull request:
https://github.com/apache/flink/pull/5518#discussion_r169067403
--- Diff:
flink-contrib/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBKeyedStateBackend.java
---
@@ -266,9 +267,16 @@ public RocksDBKeyedStateBackend(
RocksIterator iterator = db.newIterator(columnInfo.f0);
iterator.seekToFirst();
- Iterable<K> iterable = () -> new
RocksIteratorWrapper<>(iterator, state, keySerializer, keyGroupPrefixBytes);
- Stream<K> targetStream =
StreamSupport.stream(iterable.spliterator(), false);
- return targetStream.onClose(iterator::close);
+ try {
+ ByteArrayOutputStream outputStream = new
ByteArrayOutputStream(8);
--- End diff --
You could better use our `ByteArrayOutputStreamWithPos` which drops all the
unnecessary synchronization.
---