EnricoMi commented on code in PR #1652:
URL: 
https://github.com/apache/incubator-uniffle/pull/1652#discussion_r1580747660


##########
client-spark/common/src/main/java/org/apache/spark/shuffle/handle/MutableShuffleHandleInfo.java:
##########
@@ -0,0 +1,268 @@
+/*
+ * 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.spark.shuffle.handle;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import com.google.common.annotations.VisibleForTesting;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.uniffle.client.PartitionDataReplicaRequirementTracking;
+import org.apache.uniffle.common.RemoteStorageInfo;
+import org.apache.uniffle.common.ShuffleServerInfo;
+import org.apache.uniffle.common.exception.RssException;
+import org.apache.uniffle.proto.RssProtos;
+
+/** This class holds the dynamic partition assignment for partition reassign 
mechanism. */
+public class MutableShuffleHandleInfo extends ShuffleHandleInfoBase {

Review Comment:
   I'd suggest `ReplicaShuffleHandleInfo`, as this primarily provides the 
notion of replica, which are (secondary) mutable.



##########
client-spark/common/src/main/java/org/apache/spark/shuffle/handle/DefaultShuffleHandleInfo.java:
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.spark.shuffle.handle;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.apache.uniffle.client.PartitionDataReplicaRequirementTracking;
+import org.apache.uniffle.common.RemoteStorageInfo;
+import org.apache.uniffle.common.ShuffleServerInfo;
+
+/**
+ * Class for holding, 1. partition ID -> shuffle servers mapping. 2. remote 
storage info
+ *
+ * <p>It's to be broadcast to executors and referenced by shuffle tasks.
+ */
+public class DefaultShuffleHandleInfo extends ShuffleHandleInfoBase implements 
Serializable {

Review Comment:
   The name shouldn't encode knowledge (external to the class) about its usage, 
but merely about its inner structure. I'd suggest `SimpleShuffleHandleInfo`, as 
this class represents the most simple implementation / data structure to 
implement `ShuffleHandleInfo`. It might be used as the default, but that is up 
to other code.



##########
client-spark/common/src/main/java/org/apache/spark/shuffle/handle/ShuffleHandleInfo.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.spark.shuffle.handle;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.uniffle.client.PartitionDataReplicaRequirementTracking;
+import org.apache.uniffle.common.RemoteStorageInfo;
+import org.apache.uniffle.common.ShuffleServerInfo;
+
+public interface ShuffleHandleInfo {
+  /** List all the assigned servers including the excluded servers. */
+  Set<ShuffleServerInfo> listServers();

Review Comment:
   Naming conventions implies this should be called `getServers`.
   ```suggestion
     /** Get all the assigned servers including the excluded servers. */
     Set<ShuffleServerInfo> getServers();
   ```



##########
client-spark/common/src/main/java/org/apache/spark/shuffle/handle/ShuffleHandleInfo.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.spark.shuffle.handle;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.uniffle.client.PartitionDataReplicaRequirementTracking;
+import org.apache.uniffle.common.RemoteStorageInfo;
+import org.apache.uniffle.common.ShuffleServerInfo;
+
+public interface ShuffleHandleInfo {
+  /** List all the assigned servers including the excluded servers. */
+  Set<ShuffleServerInfo> listServers();
+
+  /**
+   * Get the latest assignment for writer to write partitioned blocks to 
corresponding
+   * shuffleServers
+   */
+  Map<Integer, List<ShuffleServerInfo>> getLatestPartitionServersForWriter();

Review Comment:
   I think `Available` is more meaningful here than `Latest`:
   ```suggestion
     /**
      * Get the assignment of available servers for writer to write partitioned 
blocks to corresponding
      * shuffleServers. Implementations might return dynamic, up-to-date 
information here.
      */
     Map<Integer, List<ShuffleServerInfo>> 
getAvailablePartitionServersForWriter();
   ```



##########
client-spark/common/src/main/java/org/apache/spark/shuffle/handle/ShuffleHandleInfo.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.spark.shuffle.handle;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.uniffle.client.PartitionDataReplicaRequirementTracking;
+import org.apache.uniffle.common.RemoteStorageInfo;
+import org.apache.uniffle.common.ShuffleServerInfo;
+
+public interface ShuffleHandleInfo {
+  /** List all the assigned servers including the excluded servers. */
+  Set<ShuffleServerInfo> listServers();
+
+  /**
+   * Get the latest assignment for writer to write partitioned blocks to 
corresponding
+   * shuffleServers
+   */
+  Map<Integer, List<ShuffleServerInfo>> getLatestPartitionServersForWriter();
+
+  /**
+   * Get the all assigned servers group by partitionId for reader to get the 
data from these
+   * historical and latest servers
+   */
+  Map<Integer, List<ShuffleServerInfo>> getAllPartitionServersForReader();

Review Comment:
   To reflect above change:
   ```suggestion
     /**
      * Get all servers ever assigned to writers group by partitionId for 
reader to get the data
      * written to these servers
      */
     Map<Integer, List<ShuffleServerInfo>> getAllPartitionServersForReader();
   ```



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to