gaborgsomogyi commented on code in PR #27527:
URL: https://github.com/apache/flink/pull/27527#discussion_r3000040457


##########
flink-runtime/src/main/java/org/apache/flink/runtime/state/OperatorStateRestoreOperation.java:
##########
@@ -225,15 +225,19 @@ private <S> void deserializeOperatorStateValues(
             OperatorStateHandle.StateMetaInfo metaInfo)
             throws IOException {
 
-        if (null != metaInfo) {
+        if (metaInfo != null) {
             long[] offsets = metaInfo.getOffsets();
-            if (null != offsets) {
+            if (offsets != null) {
                 DataInputView div = new DataInputViewStreamWrapper(in);
                 TypeSerializer<S> serializer =
                         
stateListForName.getStateMetaInfo().getPartitionStateSerializer();
+                long currentPos = in.getPos();
                 for (long offset : offsets) {
-                    in.seek(offset);
+                    if (currentPos != offset) {
+                        in.seek(offset);
+                    }
                     stateListForName.add(serializer.deserialize(div));
+                    currentPos = in.getPos();

Review Comment:
   I tend to say that `getPos` and `seek` contract must be fine on all 
filesystem implementations so we're on the safe side. WDYT @Zakelly? The only 
concern is that if there are FS implementations which are not always fulfilling 
this but I've not met such so I would say good to go and planning to merge if 
no objections.



-- 
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]

Reply via email to