Skip to content

Commit

Permalink
Fix cache-deserialization for UpdateableObj (#8815)
Browse files Browse the repository at this point in the history
  • Loading branch information
snazy authored Jun 13, 2024
1 parent 0450690 commit ab04281
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,10 @@ public static Obj deserializeObjProto(ObjId id, ObjProto obj, String versionToke
return deserializeUniqueId(id, obj.getUniqueId());
}
if (obj.hasCustom()) {
return deserializeCustom(id, obj.getCustom(), versionToken);
return deserializeCustom(
id,
obj.getCustom(),
versionToken != null ? versionToken : obj.getCustom().getVersionToken());
}
throw new UnsupportedOperationException("Cannot deserialize " + obj);
}
Expand Down Expand Up @@ -506,9 +509,14 @@ private static UniqueIdProto.Builder serializeUniqueId(UniqueIdObj obj) {

private static Obj deserializeCustom(ObjId id, CustomProto custom, String versionToken) {
ObjType type = ObjTypes.forShortName(custom.getObjType());
if (versionToken == null) {
// versionToken is set when reading objects from the database, but cache-deserialization has
// the versionToken in the object
versionToken = custom.getVersionToken();
}
return SmileSerialization.deserializeObj(
id,
versionToken != null ? versionToken : custom.getVersionToken(),
versionToken,
custom.getData().toByteArray(),
type.targetClass(),
custom.getCompression().name());
Expand Down

0 comments on commit ab04281

Please sign in to comment.