Dubbo serialization stepping pit record-the provider DTO added fields, the relying party reported an error

background

Service A calls service B through dubbo, and the serialization method is kryo. Service A and service B also rely on a DTO of the C project.
The DTO of the C project adds a new field, deploy, and the B service introduces the latest dependencies. But the A service does not.
This field is not used by the A service and does not care.
At this time, if service A calls service B, the following serialization error will appear
Insert picture description here

Troubleshoot

This mDTO has changed

Solution one

By letting the C DTO use the release package, package it, and not use the snapshot version, in this way, we change the frequency slowly and are very active.
Otherwise, every time we deploy, we will have a headache.

Solution two

Change the dubbo version between B service and A service, and then when publishing online, first send half of the B service, then send out the A service, and then send out the B service.
The advantage of this is that the online A service can be released compatible, otherwise it will report a bunch of serialization errors.

Solution three

Switch the serialization method to protobuf

In the end, the first plan was passed, which was a symptom rather than a permanent solution, and it was a normative problem.
The second plan can be maintained for a short period of time.
The third option has more related parties and is time-consuming, but it is good for generations to come.

Practical action: make the second plan temporarily and promote the third plan for a long time.

Guess you like

Origin blog.csdn.net/xx897115293/article/details/108636157