Skip to content

[ISSUE #9396] Use fastjson2 in all modules #9397

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

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

yx9o
Copy link
Contributor

@yx9o yx9o commented May 10, 2025

Fixes #9396 .

@codecov-commenter
Copy link

codecov-commenter commented May 10, 2025

Codecov Report

Attention: Patch coverage is 63.82979% with 17 lines in your changes missing coverage. Please review.

Project coverage is 49.49%. Comparing base (53a3f69) to head (c5455a4).

Files with missing lines Patch % Lines
...mq/tools/command/export/ExportMetadataCommand.java 0.00% 3 Missing ⚠️
...mon/fastjson/GenericMapSuperclassDeserializer.java 85.71% 1 Missing and 1 partial ⚠️
...ache/rocketmq/common/utils/FastJsonSerializer.java 0.00% 2 Missing ⚠️
...tmq/remoting/protocol/heartbeat/HeartbeatData.java 0.00% 2 Missing ⚠️
...command/export/ExportMetadataInRocksDBCommand.java 0.00% 2 Missing ⚠️
...s/command/metadata/RocksDBConfigToJsonCommand.java 0.00% 2 Missing ⚠️
...mmand/broker/GetColdDataFlowCtrInfoSubCommand.java 0.00% 1 Missing ⚠️
...tmq/tools/command/export/ExportConfigsCommand.java 0.00% 1 Missing ⚠️
...tmq/tools/command/export/ExportMetricsCommand.java 0.00% 1 Missing ⚠️
.../tools/command/queue/QueryConsumeQueueCommand.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #9397      +/-   ##
=============================================
+ Coverage      48.14%   49.49%   +1.35%     
- Complexity     12022    12438     +416     
=============================================
  Files           1308     1307       -1     
  Lines          92253    92252       -1     
  Branches       11808    11810       +2     
=============================================
+ Hits           44413    45658    +1245     
+ Misses         42352    41032    -1320     
- Partials        5488     5562      +74     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fuyou001
Copy link
Contributor

1、Could you provide the performance benchmark data for the original Fastjson 1?
2、Could you provide compatibility test results with Fastjson 1, particularly when the object contains camel-case properties?

@yx9o
Copy link
Contributor Author

yx9o commented May 29, 2025

1、Could you provide the performance benchmark data for the original Fastjson 1? 2、Could you provide compatibility test results with Fastjson 1, particularly when the object contains camel-case properties?

Thank you for your review. The data for the two questions are as follows:
1.
image

image image image

Regarding question 2, I encountered the camel case problem of getCId during the replacement test. The solution is to move the @JSONField(name = "c") annotation from the attribute to the get/set method. All the replaced codes are covered by unit tests.

@hill007299 hill007299 requested a review from fuyou001 May 30, 2025 01:45
@fuyou001
Copy link
Contributor

fuyou001 commented Jun 8, 2025

Could you develop a tool to validate whether objects with camelCase properties are compatible with Fastjson 2, so we can check compatibility? @yx9o

@yx9o
Copy link
Contributor Author

yx9o commented Jun 9, 2025

Could you develop a tool to validate whether objects with camelCase properties are compatible with Fastjson 2, so we can check compatibility? @yx9o

Let me understand. We need to develop a tool to test all objects in the project that have irregular camel case naming to ensure that fastjson1 and fastjson2 serialization are compatible, right?

@fuyou001
Copy link
Contributor

Could you develop a tool to validate whether objects with camelCase properties are compatible with Fastjson 2, so we can check compatibility? @yx9o

Let me understand. We need to develop a tool to test all objects in the project that have irregular camel case naming to ensure that fastjson1 and fastjson2 serialization are compatible, right?

Yes, but we should only validate classes involved in JSON serialization/deserialization.

@yx9o
Copy link
Contributor Author

yx9o commented Jun 13, 2025

Hi @fuyou001 , please help review again. According to your review, I added the following serialization compatibility test tool class: RemotingSerializableCompatTest. It mainly does the following:

  1. Construct objects with default parameters for all subclasses of RemotingSerializable
  2. Use fastjson1 to serialize the object obtained in the first step
  3. Use fastjson2 to deserialize the json string obtained in the second step
  4. Compare the object deserialized in the third step with the object constructed in the first step, and compare all attribute values. Their comparisons are all passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement] Use fastjson2 in all modules
3 participants