You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/12/10 06:59:06 UTC

[GitHub] [flink] fredia commented on a diff in pull request #21405: [FLINK-23035][state/changelog] Add explicit append() to StateChangelogWriter to write metadata

fredia commented on code in PR #21405:
URL: https://github.com/apache/flink/pull/21405#discussion_r1044999240


##########
flink-runtime/src/main/java/org/apache/flink/runtime/state/changelog/StateChange.java:
##########
@@ -26,14 +26,21 @@
 @Internal
 public class StateChange implements Serializable {
 
+    /* For metadata, see FLINK-23035.*/
+    public static final int META_KEY_GROUP = -1;
+
     private static final long serialVersionUID = 1L;
 
     private final int keyGroup;
     private final byte[] change;
 
+    public StateChange(byte[] change) {
+        this.keyGroup = META_KEY_GROUP;
+        this.change = Preconditions.checkNotNull(change);
+    }
+
     public StateChange(int keyGroup, byte[] change) {
-        // todo: enable check in FLINK-23035
-        // Preconditions.checkArgument(keyGroup >= 0);
+        Preconditions.checkArgument(keyGroup >= 0);

Review Comment:
   Nice suggestion, this can reduce the probability of error, fixed.



-- 
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-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org