diff --git a/akka-distributed-data/src/main/scala/akka/cluster/ddata/protobuf/ReplicatorMessageSerializer.scala b/akka-distributed-data/src/main/scala/akka/cluster/ddata/protobuf/ReplicatorMessageSerializer.scala index 0ac0a2ff40..dd86e2fd01 100644 --- a/akka-distributed-data/src/main/scala/akka/cluster/ddata/protobuf/ReplicatorMessageSerializer.scala +++ b/akka-distributed-data/src/main/scala/akka/cluster/ddata/protobuf/ReplicatorMessageSerializer.scala @@ -267,7 +267,7 @@ class ReplicatorMessageSerializer(val system: ExtendedActorSystem) case (key, digest) => b.addEntries(dm.Status.Entry.newBuilder().setKey(key).setDigest(ByteString.copyFrom(digest.toArray))) } - b.setToSystemUid(status.toSystemUid.get) + status.toSystemUid.foreach(b.setToSystemUid) // can be None when sending back to a node of version 2.5.21 b.setFromSystemUid(status.fromSystemUid.get) b.build() } @@ -290,7 +290,7 @@ class ReplicatorMessageSerializer(val system: ExtendedActorSystem) case (key, data) => b.addEntries(dm.Gossip.Entry.newBuilder().setKey(key).setEnvelope(dataEnvelopeToProto(data))) } - b.setToSystemUid(gossip.toSystemUid.get) + gossip.toSystemUid.foreach(b.setToSystemUid) // can be None when sending back to a node of version 2.5.21 b.setFromSystemUid(gossip.fromSystemUid.get) b.build() } diff --git a/akka-distributed-data/src/test/scala/akka/cluster/ddata/protobuf/ReplicatorMessageSerializerSpec.scala b/akka-distributed-data/src/test/scala/akka/cluster/ddata/protobuf/ReplicatorMessageSerializerSpec.scala index 86675f9f35..b140d9ba49 100644 --- a/akka-distributed-data/src/test/scala/akka/cluster/ddata/protobuf/ReplicatorMessageSerializerSpec.scala +++ b/akka-distributed-data/src/test/scala/akka/cluster/ddata/protobuf/ReplicatorMessageSerializerSpec.scala @@ -117,12 +117,25 @@ class ReplicatorMessageSerializerSpec totChunks = 10, Some(17), Some(19))) + checkSerialization( + Status( + Map("A" -> ByteString.fromString("a"), "B" → ByteString.fromString("b")), + chunk = 3, + totChunks = 10, + None, // can be None when sending back to a node of version 2.5.21 + Some(19))) checkSerialization( Gossip( Map("A" -> DataEnvelope(data1), "B" → DataEnvelope(GSet() + "b" + "c")), sendBack = true, Some(17), Some(19))) + checkSerialization( + Gossip( + Map("A" -> DataEnvelope(data1), "B" → DataEnvelope(GSet() + "b" + "c")), + sendBack = true, + None, // can be None when sending back to a node of version 2.5.21 + Some(19))) checkSerialization( DeltaPropagation( address1,