AHeise commented on a change in pull request #13735:
URL: https://github.com/apache/flink/pull/13735#discussion_r518179029



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/RescaledChannelsMapping.java
##########
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.checkpoint;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import static java.util.Collections.emptyMap;
+
+/**
+ * Contains the fine-grain channel mappings that occur when a connected 
operator has been rescaled.
+ */
+public class RescaledChannelsMapping implements Serializable {
+       public static final RescaledChannelsMapping NO_CHANNEL_MAPPING = new 
RescaledChannelsMapping(emptyMap());
+
+       private static final long serialVersionUID = -8719670050630674631L;
+
+       /**
+        * For each new channel (=index), all old channels are set.
+        */
+       private final Map<Integer, Set<Integer>> newToOldChannelIndexes;
+
+       /**
+        * For each old channel (=index), all new channels are set. Lazily 
calculated to keep {@link OperatorSubtaskState}
+        * small in terms of serialization cost.
+        */
+       private transient Map<Integer, Set<Integer>> oldToNewChannelIndexes;

Review comment:
       Actually I made it quasi-thread safe, where no fields are updated 
anymore (see your other suggestion). I refrain from doing defensive copies as 
it's purely internal.




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

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


Reply via email to