Skip to content
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

Add Cluster.Sharding DData backward compatibility wire format mode #6775

Merged
merged 5 commits into from
May 29, 2023

Conversation

Arkatufus
Copy link
Contributor

@Arkatufus Arkatufus commented May 25, 2023

Fixes #6704

Changes

  • Add akka.cluster.sharding.distributed-data.backward-compatible-wire-format to allow v1.5 to talk with v1.4
  • Add DData hack to convert v1.4 to v1.5 data structure serialization

NOTES

  • When backward-compatible-wire-format is set to true, Cluster.Sharding will not be able to talk to any Cluster.Sharding v1.5.0-v1.5.7, so if Cluster.Sharding were to talk to v1.4.x, all v1.5 nodes have to be updated to the version with this fix.

Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add a simple regression test to the sharding message serializer to ensure that this fix works?

@Arkatufus
Copy link
Contributor Author

The fix was not in the sharding serializer, its in the DData LWWRegister<T> serializer

@Aaronontheweb
Copy link
Member

@Arkatufus is it feasible to unit test this fix?

@Arkatufus
Copy link
Contributor Author

Well, the target class does not exist in v1.5 binary anymore, testing would require a v1.4 binary protobuf loaded from disk and see if the serializer can deserialize it?

@Arkatufus
Copy link
Contributor Author

Arkatufus commented May 26, 2023

Actually, we can probably test the ToProto methods to see if it generates the correct TypeInfo, but that would require us to change the method from private to internal

@Arkatufus
Copy link
Contributor Author

Done

Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -735,6 +739,11 @@ private Proto.Msg.LWWRegister LWWToProto<T>(ILWWRegister r)
pLww.State = _ser.OtherMessageToProto(register.Value);
pLww.Timestamp = register.Timestamp;
pLww.TypeInfo = GetTypeDescriptor(r.RegisterType);

// HACK: Really really ugly hack to make sure that v1.5 DData cluster sharding works with v1.4
if(_backwardCompatWireFormat && pLww.TypeInfo.TypeName == "Akka.Cluster.Sharding.ShardCoordinator+CoordinatorState, Akka.Cluster.Sharding")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aaronontheweb Aaronontheweb merged commit c0dc716 into akkadotnet:dev May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants