wanglijie95 commented on code in PR #22861: URL: https://github.com/apache/flink/pull/22861#discussion_r1259513819
########## flink-runtime/src/main/java/org/apache/flink/runtime/deployment/SerializedShuffleDescriptorAndIndices.java: ########## @@ -0,0 +1,48 @@ +/* + * 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.deployment; + +import org.apache.flink.runtime.deployment.TaskDeploymentDescriptor.MaybeOffloaded; +import org.apache.flink.runtime.deployment.TaskDeploymentDescriptorFactory.ShuffleDescriptorAndIndex; + +/** Wrapper of serializedShuffleDescriptors, used for {@link InputGateDeploymentDescriptor}. */ +public class SerializedShuffleDescriptorAndIndices { + /** Serialized value of shuffle descriptors with index. */ + private final MaybeOffloaded<ShuffleDescriptorAndIndex[]> serializedShuffleDescriptors; + + private final SerializedShuffleDescriptorAndIndicesID Review Comment: As mentioned above, rename this to `ShuffleDescriptorGroupID `. This id is used to identify both the serialized and de-serialized shuffle descriptors. ########## flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/ShuffleDescriptorsCache.java: ########## @@ -0,0 +1,101 @@ +/* + * 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.taskexecutor; + +import org.apache.flink.api.common.JobID; +import org.apache.flink.runtime.concurrent.ComponentMainThreadExecutor; +import org.apache.flink.runtime.deployment.SerializedShuffleDescriptorAndIndicesID; +import org.apache.flink.runtime.deployment.TaskDeploymentDescriptorFactory; + +/** Cache of shuffle descriptors in TaskExecutor. */ +public interface ShuffleDescriptorsCache { + /** + * Start cache manager. + * + * @param mainThreadExecutor of main thread executor. + */ + void start(ComponentMainThreadExecutor mainThreadExecutor); + + /** Stop cache manager. */ + void stop(); + + /** + * Get shuffle descriptors entry in cache. + * + * @param serializedShuffleDescriptorsId of cached serialized shuffle descriptors + * @return cache shuffle descriptors entry in cache if exists, otherwise null + */ + ShuffleDescriptorCacheEntry get( Review Comment: I think we return the deserialized shuffle descriptors(`ShuffleDescriptorGroup`) is enough here. We can move the `ShuffleDescriptorCacheEntry` into `DefaultShuffleDescriptorsCache` as a inline class. ########## flink-runtime/src/main/java/org/apache/flink/runtime/deployment/SerializedShuffleDescriptorAndIndices.java: ########## @@ -0,0 +1,48 @@ +/* + * 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.deployment; + +import org.apache.flink.runtime.deployment.TaskDeploymentDescriptor.MaybeOffloaded; +import org.apache.flink.runtime.deployment.TaskDeploymentDescriptorFactory.ShuffleDescriptorAndIndex; + +/** Wrapper of serializedShuffleDescriptors, used for {@link InputGateDeploymentDescriptor}. */ +public class SerializedShuffleDescriptorAndIndices { Review Comment: How about change this class name to `SerializedShuffleDescriptorGroup` ? Besides, we can also introduce a new class `ShuffleDescriptorGroup`, which maintains the `ShuffleDescriptorAndIndex[] shuffleDescriptors`, and it can be used in the `ShuffleDescriptorCache`. `ShuffleDescriptorGroup` represents a set of shuffle descriptors that will be serialized togother, `SerializedShuffleDescriptorGroup` is a serialization vertion of it. And both of them can be identified by the `ShuffleDescriptorGroupID` -- 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]
