-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enhancement] Support large json in image (backport #48569) #49895
Conversation
Signed-off-by: gengjun-git <[email protected]> (cherry picked from commit 78715a7) # Conflicts: # fe/fe-core/src/main/java/com/starrocks/authentication/AuthenticationMgr.java # fe/fe-core/src/main/java/com/starrocks/http/meta/MetaService.java # fe/fe-core/src/main/java/com/starrocks/leader/Checkpoint.java # fe/fe-core/src/main/java/com/starrocks/server/LocalMetastore.java
Cherry-pick of 78715a7 has failed:
To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
@mergify[bot]: Backport conflict, please reslove the conflict and resubmit the pr |
Signed-off-by: gengjun-git <[email protected]>
Quality Gate passedIssues Measures |
Why I'm doing:
Currently, JSON serialization supports a maximum of 2G, because serialization converts the object into a JSON string first, and then writes the string into the image file, and the maximum size of a string in Java is only 2G.
What I'm doing:
To support large json string, we can use the stream api of GSON:
JsonWriter
andJsonReader
.Since we cannot know the length of the string in advance, so a new image file format is introduced: a json string must begin with "{" or "[", so primitive type is not supported, and there is nothing between the json string. To support rollback, we use a double write solution. The dir format is as follows
meta/image/image.111
is the old format image file, andmeta/image/v2/image.111
is the new format image file. Since the JsonReader will cache some chars in advance, so we cannot calculate the checksum of the specific meta-block, and the checksum is put into another filechecksum.111
;What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check:
This is an automatic backport of pull request #48569 done by [Mergify](https://mergify.com). ## Why I'm doing: Currently, JSON serialization supports a maximum of 2G, because serialization converts the object into a JSON string first, and then writes the string into the image file, and the maximum size of a string in Java is only 2G.
What I'm doing:
To support large json string, we can use the stream api of GSON:
JsonWriter
andJsonReader
.Since we cannot know the length of the string in advance, so a new image file format is introduced: a json string must begin with "{" or "[", so primitive type is not supported, and there is nothing between the json string. To support rollback, we use a double write solution. The dir format is as follows
meta/image/image.111
is the old format image file, andmeta/image/v2/image.111
is the new format image file. Since the JsonReader will cache some chars in advance, so we cannot calculate the checksum of the specific meta-block, and the checksum is put into another filechecksum.111
;What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist: