flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sihuazhou <...@git.apache.org>
Subject [GitHub] flink pull request #5518: [FLINK-8679][State Backends]Fix RocksDBKeyedBacken...
Date Tue, 20 Feb 2018 16:04:38 GMT
Github user sihuazhou commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5518#discussion_r169368355
  
    --- 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);
    +			namespaceSerializer.serialize(namespace, new DataOutputViewStreamWrapper(outputStream));
    +			final byte[] namespaceBytes = outputStream.toByteArray();
    +			Iterable<K> iterable = () -> new RocksIteratorWrapper<>(iterator, state,
keySerializer, keyGroupPrefixBytes, namespaceBytes);
    +			Stream<K> targetStream = StreamSupport.stream(iterable.spliterator(), false);
    +			return targetStream.onClose(iterator::close);
    +		} catch (IOException ex) {
    +			throw new FlinkRuntimeException("Failed to get keys from RocksDB state backend.",
ex);
    --- End diff --
    
    Nice catch! Addressed.


---

Mime
View raw message