Uh oh!
There was an error while loading. Please reload this page.
branch-4.1: [fix](fe) fix Azure resource persistence #65052 - #65177
Merged
Conversation
hello-stephen
commented
Jul 2, 2026
Contributor
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
hello-stephen
commented
Jul 2, 2026
Contributor
run buildall |
hello-stephen
commented
Jul 2, 2026
Contributor
FE UT Coverage ReportIncrement line coverage |
### What problem does this PR solve? Issue Number: DORIS-26664 Related PR: None Problem Summary: `AzureResource` was not registered in the `Resource` runtime Gson adapter. As a result, persisted Azure resources could be serialized without the `clazz` field, and FE replay from edit log or image failed when deserializing them as `Resource.class`. Observed failure stack: ```text 2026-06-26 10:16:34,576 ERROR (leaderCheckpointer|100) [BDBJournalCursor.next():122] fail to read journal entity key=136567, will exit com.google.gson.JsonParseException: cannot deserialize class org.apache.doris.catalog.Resource because it does not define a field named clazz at org.apache.doris.persist.gson.RuntimeTypeAdapterFactory$1.read(RuntimeTypeAdapterFactory.java:321) at com.google.gson.TypeAdapter$1.read(TypeAdapter.java:204) at com.google.gson.Gson.fromJson(Gson.java:1227) at com.google.gson.Gson.fromJson(Gson.java:1137) at com.google.gson.Gson.fromJson(Gson.java:1047) at com.google.gson.Gson.fromJson(Gson.java:982) at org.apache.doris.catalog.Resource.read(Resource.java:264) at org.apache.doris.journal.JournalEntity.readFields(JournalEntity.java:585) at org.apache.doris.journal.bdbje.BDBJournalCursor.next(BDBJournalCursor.java:119) at org.apache.doris.catalog.Env.replayJournal(Env.java:3091) at org.apache.doris.master.Checkpoint.doCheckpoint(Checkpoint.java:161) at org.apache.doris.master.Checkpoint.runAfterCatalogReady(Checkpoint.java:89) at org.apache.doris.common.util.MasterDaemon.runOneCycle(MasterDaemon.java:58) at org.apache.doris.common.util.Daemon.run(Daemon.java:119) ``` This PR registers `AzureResource` in `GsonUtils` and makes both `Resource.read` and `ResourceMgr.read` compatible with legacy resource JSON that has `type` but no `clazz`, deriving the subtype label from `ResourceType`. Why the persisted JSON could miss `clazz`: `clazz` is not a real field of `Resource`; it is the discriminator added by `RuntimeTypeAdapterFactory` only when that factory handles serialization. `Resource.write()` currently uses `GsonUtils.GSON.toJson(this)`. When `this` is an `AzureResource` and `AzureResource` has not been registered as a `Resource` subtype, Gson looks up serialization by the runtime type `AzureResource.class`, the resource runtime type adapter does not match, and Gson falls back to normal reflective serialization. That reflective path writes real fields such as `name`, `type`, `references`, `id`, and `version`, but it does not add `clazz`. The read path is different: `Resource.read()` deserializes the same JSON as `Resource.class`, so `RuntimeTypeAdapterFactory` is used and requires the `clazz` discriminator before it can choose a concrete subtype. The resources image path also deserializes nested `Resource` values through `ResourceMgr.read()` and `GsonUtils.GSON.fromJson(json, ResourceMgr.class)`, so those nested resources do not pass through `Resource.read()`. Registering `AzureResource` fixes new writes and reads of JSON that already has `clazz:"AzureResource"`, but it cannot repair already persisted legacy JSON that has only `type:"AZURE"` and no `clazz`.
yiguoleiforce-pushed
the
auto-pick-65052-branch-4.1
branch
from
July 3, 2026 07:43
d184e9e to
96c0b32Compareyiguolei
commented
Jul 3, 2026
Contributor
run buildall |
hello-stephen
commented
Jul 3, 2026
Contributor
FE Regression Coverage ReportIncrement line coverage |
yiguolei
commented
Jul 3, 2026
Contributor
skip buildall |
yiguolei
approved these changes
Jul 3, 2026
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-picked from #65052