alievmirza commented on code in PR #4594:
URL: https://github.com/apache/ignite-3/pull/4594#discussion_r1818773751


##########
modules/distribution-zones/src/integrationTest/java/org/apache/ignite/internal/distributionzones/ItIgniteDistributionZoneManagerNodeRestartTest.java:
##########
@@ -642,6 +653,14 @@ public void 
testCreationZoneWhenDataNodesAreDeletedIsNotSuccessful() throws Exce
         assertThat(metastore.get(new 
ByteArray(dataNodeKey[0])).thenApply(Entry::tombstone), willBe(true));
     }
 
+    private static Map<Node, Integer> deserializeDataNodesMap(byte[] bytes) {

Review Comment:
   Why can't we use `DistributionZonesUtil#deserializeDataNodesMap`? The same 
with `deserializeLogicalTopologySet`, I see that you have several copies of 
this method in different test classes, could we us general method? We could add 
it to this class as well. 



##########
modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DistributionZoneManager.java:
##########
@@ -831,18 +849,27 @@ private CompletableFuture<Void> 
saveRecoverableStateToMetastorage(
     ) {
         Operation[] puts = new Operation[3 + zoneIds.size()];
 
-        puts[0] = put(zonesNodesAttributes(), toBytes(nodesAttributes()));
+        puts[0] = put(zonesNodesAttributes(), 
VersionedSerialization.toBytes(nodesAttributes(), 
NodesAttributesSerializer.INSTANCE));
 
         puts[1] = put(zonesRecoverableStateRevision(), 
longToBytesKeepingOrder(revision));
 
-        puts[2] = put(zonesLastHandledTopology(), toBytes(newLogicalTopology));
+        puts[2] = put(
+                zonesLastHandledTopology(),
+                VersionedSerialization.toBytes(newLogicalTopology, 
LogicalTopologySetSerializer.INSTANCE)
+        );
 
         int i = 3;
 
         // TODO: https://issues.apache.org/jira/browse/IGNITE-19491 Properly 
utilise topology augmentation map. Also this map
         // TODO: can be saved only once for all zones.
         for (Integer zoneId : zoneIds) {
-            puts[i++] = put(zoneTopologyAugmentation(zoneId), 
toBytes(zonesState.get(zoneId).topologyAugmentationMap()));
+            puts[i++] = put(
+                    zoneTopologyAugmentation(zoneId),
+                    VersionedSerialization.toBytes(

Review Comment:
   Constructions like 
   ```
                       VersionedSerialization.toBytes(
                               zonesState.get(zoneId).topologyAugmentationMap(),
                               TopologyAugmentationMapSerializer.INSTANCE
                       )
   ```
   look a bit overloaded. 
   
   Maybe, we could hide it inside `TopologyAugmentationMapSerializer`, so it 
could look like 
   ```
   
TopologyAugmentationMapSerializer.toBytes(zonesState.get(zoneId).topologyAugmentationMap())
   ``` 
   ?
   WDYT? Could this idea be adapted to all Serializers/Deserializers? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to