Myasuka commented on a change in pull request #18391: URL: https://github.com/apache/flink/pull/18391#discussion_r792406221
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/state/changelog/ChangelogStateBackendHandle.java ########## @@ -130,14 +155,51 @@ public String toString() { keyGroupRange, materialized.size(), nonMaterialized.size()); } - private static Closeable asCloseable(KeyedStateHandle h) { - return () -> { - try { - h.discardState(); - } catch (Exception e) { - ExceptionUtils.rethrowIOException(e); + private static class StreamStateHandleWrapper implements StreamStateHandle { + private static final long serialVersionUID = 1L; + + private final KeyedStateHandle keyedStateHandle; + + StreamStateHandleWrapper(KeyedStateHandle keyedStateHandle) { + this.keyedStateHandle = keyedStateHandle; + } + + @Override + public void discardState() throws Exception { + keyedStateHandle.discardState(); + } + + @Override + public long getStateSize() { + return keyedStateHandle.getStateSize(); + } + + @Override + public FSDataInputStream openInputStream() throws IOException { + throw new UnsupportedOperationException("Should not call here."); + } + + @Override + public Optional<byte[]> asBytesIfInMemory() { + throw new UnsupportedOperationException("Should not call here."); + } Review comment: The returned `StreamStateHandle` would only be used in `IncrementalRemoteKeyedStateHandle`, which is safe here to just add such wrapper. -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org