Copilot commented on code in PR #62673:
URL: https://github.com/apache/doris/pull/62673#discussion_r3116122502


##########
fe/fe-core/src/main/java/org/apache/doris/persist/gson/GsonUtils.java:
##########
@@ -526,7 +526,9 @@ public class GsonUtils {
         } else {
             // compatible with old cloud code.
             tabletTypeAdapterFactory.registerDefaultSubtype(CloudTablet.class);
+            
tabletTypeAdapterFactory.registerCompatibleSubtype(CloudTablet.class, 
Tablet.class.getSimpleName());
             
replicaTypeAdapterFactory.registerDefaultSubtype(CloudReplica.class);
+            
replicaTypeAdapterFactory.registerCompatibleSubtype(CloudReplica.class, 
Replica.class.getSimpleName());

Review Comment:
   Add a regression test for this upgrade-compatibility behavior. This change 
makes cloud mode accept legacy type labels ("Tablet"/"Replica") and map them to 
CloudTablet/CloudReplica; without a test, it’s easy to regress and reintroduce 
journal deserialization failures during upgrades. Consider a unit test that 
deserializes a minimal JSON payload containing `clazz: "Tablet"` (and `clazz: 
"Replica"`) and asserts it produces CloudTablet/CloudReplica (you can build a 
dedicated Gson with the same RuntimeTypeAdapterFactory registrations to avoid 
depending on GsonUtils’ static initialization order).



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