rkhachatryan commented on a change in pull request #18391:
URL: https://github.com/apache/flink/pull/18391#discussion_r794289499
##########
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:
I see, thanks for the clarification.
I think the proper way to address this would be to allow
`SharedStateRegistry` to work with any type of state handles. But that's
probably not something to do before the release. So maybe it makes sense to add
a TODO or a ticket, WDYT?
--
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]