Myasuka commented on a change in pull request #18391:
URL: https://github.com/apache/flink/pull/18391#discussion_r793182488
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/state/SharedStateRegistryTest.java
##########
@@ -143,4 +222,87 @@ public boolean isDiscarded() {
return discarded;
}
}
+
+ private static class KeyedStateHandleWrapper implements KeyedStateHandle {
+ private static final long serialVersionUID = 1L;
+ protected final KeyedStateHandle keyedStateHandle;
+ private volatile boolean isDiscarded;
+
+ KeyedStateHandleWrapper(KeyedStateHandle keyedStateHandle) {
+ this.keyedStateHandle = keyedStateHandle;
+ this.isDiscarded = false;
+ }
+
+ @Override
+ public void registerSharedStates(SharedStateRegistry stateRegistry,
long checkpointID) {
+ keyedStateHandle.registerSharedStates(stateRegistry, checkpointID);
+ }
+
+ @Override
+ public KeyGroupRange getKeyGroupRange() {
+ return keyedStateHandle.getKeyGroupRange();
+ }
+
+ @Nullable
+ @Override
+ public KeyedStateHandle getIntersection(KeyGroupRange keyGroupRange) {
+ return keyedStateHandle.getIntersection(keyGroupRange);
+ }
+
+ @Override
+ public void discardState() throws Exception {
+ isDiscarded = true;
+ keyedStateHandle.discardState();
+ }
+
+ @Override
+ public long getStateSize() {
+ return keyedStateHandle.getStateSize();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ KeyedStateHandleWrapper that = (KeyedStateHandleWrapper) o;
+ return Objects.equals(keyedStateHandle, that.keyedStateHandle);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(keyedStateHandle);
+ }
+
+ boolean isDiscarded() {
+ return isDiscarded;
+ }
+ }
+
+ private static class IncrementalStateHandleWrapper extends
KeyedStateHandleWrapper {
Review comment:
Actually, the main purpose is for `isDiscarded`.
Current implementation has been changed.
--
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]