This is an automated email from the ASF dual-hosted git repository.

rickyma pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git


The following commit(s) were added to refs/heads/master by this push:
     new 7973c3cb9 [#1961] Fix(client/spark): Add serialVersionUID to each 
class that implements Serializable (#1960)
7973c3cb9 is described below

commit 7973c3cb95904d2908f0e5f8c086b43fd7e91a87
Author: maobaolong <baoloong...@tencent.com>
AuthorDate: Fri Jul 26 15:10:50 2024 +0800

    [#1961] Fix(client/spark): Add serialVersionUID to each class that 
implements Serializable (#1960)
    
    ### What changes were proposed in this pull request?
    
    Add serialVersionUID to each class that implements Serializable, to avoid 
encountering the `local class incompatible` issue.
    
    ### Why are the changes needed?
    
    Not specifying serialVersionUID in Java can cause Incompatible 
Serialization, changes in class definition without updating serialVersionUID 
can lead to InvalidClassException. The automatically generated serialVersionUID 
may differ across different Java platforms, which can lead to problems during 
serialization and deserialization between different platforms. Besides, 
sometimes, compiler optimizations may change the generated serialVersionUID.
    
    In a word, explicitly defining serialVersionUID ensures serialization 
compatibility and data integrity. This is a good practice.
    
    Fix: #1961
    
    ### Does this PR introduce any user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    No need
---
 .../common/src/main/java/org/apache/spark/shuffle/RssShuffleHandle.java | 1 +
 .../java/org/apache/spark/shuffle/handle/MutableShuffleHandleInfo.java  | 1 +
 .../java/org/apache/spark/shuffle/handle/SimpleShuffleHandleInfo.java   | 1 +
 .../org/apache/spark/shuffle/handle/StageAttemptShuffleHandleInfo.java  | 1 +
 common/src/main/java/org/apache/uniffle/common/RemoteStorageInfo.java   | 1 +
 common/src/main/java/org/apache/uniffle/common/ShuffleServerInfo.java   | 2 +-
 .../java/org/apache/uniffle/storage/common/FileBasedShuffleSegment.java | 2 +-
 7 files changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/client-spark/common/src/main/java/org/apache/spark/shuffle/RssShuffleHandle.java
 
b/client-spark/common/src/main/java/org/apache/spark/shuffle/RssShuffleHandle.java
index acf681587..e3dd3aa05 100644
--- 
a/client-spark/common/src/main/java/org/apache/spark/shuffle/RssShuffleHandle.java
+++ 
b/client-spark/common/src/main/java/org/apache/spark/shuffle/RssShuffleHandle.java
@@ -28,6 +28,7 @@ import org.apache.uniffle.common.RemoteStorageInfo;
 import org.apache.uniffle.common.ShuffleServerInfo;
 
 public class RssShuffleHandle<K, V, C> extends ShuffleHandle {
+  private static final long serialVersionUID = 0L;
 
   private String appId;
   private int numMaps;
diff --git 
a/client-spark/common/src/main/java/org/apache/spark/shuffle/handle/MutableShuffleHandleInfo.java
 
b/client-spark/common/src/main/java/org/apache/spark/shuffle/handle/MutableShuffleHandleInfo.java
index 1e3b29019..6fc215943 100644
--- 
a/client-spark/common/src/main/java/org/apache/spark/shuffle/handle/MutableShuffleHandleInfo.java
+++ 
b/client-spark/common/src/main/java/org/apache/spark/shuffle/handle/MutableShuffleHandleInfo.java
@@ -40,6 +40,7 @@ import org.apache.uniffle.proto.RssProtos;
 
 /** This class holds the dynamic partition assignment for partition reassign 
mechanism. */
 public class MutableShuffleHandleInfo extends ShuffleHandleInfoBase {
+  private static final long serialVersionUID = 0L;
   private static final Logger LOGGER = 
LoggerFactory.getLogger(MutableShuffleHandleInfo.class);
 
   /**
diff --git 
a/client-spark/common/src/main/java/org/apache/spark/shuffle/handle/SimpleShuffleHandleInfo.java
 
b/client-spark/common/src/main/java/org/apache/spark/shuffle/handle/SimpleShuffleHandleInfo.java
index 60cb6f27a..2fab7a1cb 100644
--- 
a/client-spark/common/src/main/java/org/apache/spark/shuffle/handle/SimpleShuffleHandleInfo.java
+++ 
b/client-spark/common/src/main/java/org/apache/spark/shuffle/handle/SimpleShuffleHandleInfo.java
@@ -33,6 +33,7 @@ import org.apache.uniffle.common.ShuffleServerInfo;
  * <p>It's to be broadcast to executors and referenced by shuffle tasks.
  */
 public class SimpleShuffleHandleInfo extends ShuffleHandleInfoBase implements 
Serializable {
+  private static final long serialVersionUID = 0L;
   private Map<Integer, List<ShuffleServerInfo>> partitionToServers;
 
   public SimpleShuffleHandleInfo(
diff --git 
a/client-spark/common/src/main/java/org/apache/spark/shuffle/handle/StageAttemptShuffleHandleInfo.java
 
b/client-spark/common/src/main/java/org/apache/spark/shuffle/handle/StageAttemptShuffleHandleInfo.java
index 8fd9642ac..22a2fe5ed 100644
--- 
a/client-spark/common/src/main/java/org/apache/spark/shuffle/handle/StageAttemptShuffleHandleInfo.java
+++ 
b/client-spark/common/src/main/java/org/apache/spark/shuffle/handle/StageAttemptShuffleHandleInfo.java
@@ -32,6 +32,7 @@ import org.apache.uniffle.common.ShuffleServerInfo;
 import org.apache.uniffle.proto.RssProtos;
 
 public class StageAttemptShuffleHandleInfo extends ShuffleHandleInfoBase {
+  private static final long serialVersionUID = 0L;
   private static final Logger LOGGER = 
LoggerFactory.getLogger(StageAttemptShuffleHandleInfo.class);
 
   private ShuffleHandleInfo current;
diff --git 
a/common/src/main/java/org/apache/uniffle/common/RemoteStorageInfo.java 
b/common/src/main/java/org/apache/uniffle/common/RemoteStorageInfo.java
index 093bc7bd2..c4738822c 100644
--- a/common/src/main/java/org/apache/uniffle/common/RemoteStorageInfo.java
+++ b/common/src/main/java/org/apache/uniffle/common/RemoteStorageInfo.java
@@ -30,6 +30,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.uniffle.common.util.Constants;
 
 public class RemoteStorageInfo implements Serializable {
+  private static final long serialVersionUID = 0L;
   public static final RemoteStorageInfo EMPTY_REMOTE_STORAGE = new 
RemoteStorageInfo("", "");
   private final String path;
   private final Map<String, String> confItems;
diff --git 
a/common/src/main/java/org/apache/uniffle/common/ShuffleServerInfo.java 
b/common/src/main/java/org/apache/uniffle/common/ShuffleServerInfo.java
index 4f3459d49..6ebea551a 100644
--- a/common/src/main/java/org/apache/uniffle/common/ShuffleServerInfo.java
+++ b/common/src/main/java/org/apache/uniffle/common/ShuffleServerInfo.java
@@ -26,7 +26,7 @@ import com.google.common.annotations.VisibleForTesting;
 import org.apache.uniffle.proto.RssProtos;
 
 public class ShuffleServerInfo implements Serializable {
-
+  private static final long serialVersionUID = 0L;
   private String id;
 
   private String host;
diff --git 
a/storage/src/main/java/org/apache/uniffle/storage/common/FileBasedShuffleSegment.java
 
b/storage/src/main/java/org/apache/uniffle/storage/common/FileBasedShuffleSegment.java
index 625c12855..e3c530d4e 100644
--- 
a/storage/src/main/java/org/apache/uniffle/storage/common/FileBasedShuffleSegment.java
+++ 
b/storage/src/main/java/org/apache/uniffle/storage/common/FileBasedShuffleSegment.java
@@ -21,7 +21,7 @@ import java.util.Objects;
 
 public class FileBasedShuffleSegment extends ShuffleSegment
     implements Comparable<FileBasedShuffleSegment> {
-
+  private static final long serialVersionUID = 0L;
   public static final int SEGMENT_SIZE = 4 * Long.BYTES + 2 * Integer.BYTES;
   private long offset;
   private int length;

Reply via email to