refactor: replace fastjson1 with fastjson2 on the 0.3.2 line - #337
Merged
RongtongJin merged 5 commits intoAug 14, 2026
Merged
Conversation
RongtongJin
marked this pull request as ready for review
August 13, 2026 11:14
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 free
to 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.
Summary
release-0.3.2-nextwith fastjson22.0.64byte[]in RPC payloads and snapshot metadatarocketmq-remotingfrom4.9.4to5.5.0and exclude its transitive fastjson1 dependencyInvokeCallback.operationFailpath used by newer RocketMQ Remoting versionsCompatibility details
A direct import replacement changes fastjson2's default
byte[]output from a Base64 string to a numeric array.DLedgerJsonUtilstherefore writes withWriteByteArrayAsBase64and reads withBase64StringAsByteArray. Tests include a literal fastjson1 Base64 fixture plus append, batch append, push, snapshot, and real network round trips.RocketMQ Remoting
4.9.4itself uses fastjson1 for command headers, so removing fastjson1 also requires a Remoting upgrade. This uses5.5.0, matching current DLedger master and RocketMQ. Its asynchronous connection-failure path callsoperationFail; every DLedger callback now completes its future from that path.Fastjson2
2.0.63has a JDK 8 initialization-order regression (fastjson2#7691) fixed in2.0.64(fastjson2#7718). This PR now uses the upstream fix instead of an application-levelMethodHandlesprewarm. A fresh JDK 8 subprocess directly round-trips a realConsumerConnectionthroughRemotingSerializable, which reproduces theInvalid callerfailure on2.0.63and passes on2.0.64. The corresponding RocketMQ version-alignment change is apache/rocketmq#10928.Known API caveat: RocketMQ Remoting
5.5.0addsChannelEventListener.onChannelActive. Downstream custom listener implementations built against the old interface need to implement that method when rebuilding. Mixed4.9.4/5.5.0rolling-upgrade interoperability has not yet been exercised; the DLedger body-format compatibility is covered here, while Remoting header interoperability relies on RocketMQ Remoting's protocol compatibility.Verification
dledger57 tests anddledger-proxy11 tests, all passingrocketmq-remoting:5.5.0,rocketmq-common:5.5.0, andfastjson2:2.0.64, with no fastjson1 artifactDLedger.jarcontains fastjson2 and nocom/alibaba/fastjson/classesThis targets the 0.3.2 maintenance/development line, currently versioned
0.3.3-SNAPSHOT, and includes the documented Remoting public-interface and mixed-version caveats.