wernerdv commented on code in PR #13409:
URL: https://github.com/apache/ignite/pull/13409#discussion_r3690760754


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/metastorage/persistence/DistributedMetaStorageClusterNodeData.java:
##########
@@ -17,51 +17,88 @@
 
 package org.apache.ignite.internal.processors.metastorage.persistence;
 
-import java.io.Serializable;
+import java.io.Externalizable;
+import org.apache.ignite.internal.Order;
+import 
org.apache.ignite.internal.processors.cache.persistence.metastorage.MetaStorage;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
 
 /**
- * Distributed metastorage data that cluster sends to joining node.
+ * Distributed metastorage data that cluster sends to joining node. To reduce 
messages number, contains plain representation
+ * of {@link DistributedMetaStorageVersion}, arrays of plain representations 
of {@link DistributedMetaStorageKeyValuePair}.
+ * And wrapped {@link DistributedMetaStorageHistoryItem}s. The version and the 
full data holders are {@link Externalizable}s
+ * persistent by {@link MetaStorage} with the dedicated code-generated 
serializers. Thus, we do not make them directly a {@link Message}.
+ *
+ * @see DmsDataWriter#write(String, byte[])
+ * @see MetaStorage#write(String, Serializable)
  */
-@SuppressWarnings({"PublicField", "AssignmentOrReturnOfFieldWithMutableType"})
-class DistributedMetaStorageClusterNodeData implements Serializable {
-    /** */
-    private static final long serialVersionUID = 0L;
+public class DistributedMetaStorageClusterNodeData implements Message {
+    /** @see DistributedMetaStorageVersion#id */
+    @Order(0)
+    @GridToStringInclude
+    long dVerId;
 
-    /**
-     * Distributed metastorage version of cluster. If {@link #fullData} is not 
null then this version corresponds to
-     * its content.
-     */
-    public final DistributedMetaStorageVersion ver;
+    /** @see DistributedMetaStorageVersion#hash */
+    @Order(1)
+    @GridToStringInclude
+    long dVerHash;
 
     /**
-     * Full data is sent if there's not enough history items on local node.
+     * Array of the full data keys.
+     *
+     * @see DistributedMetaStorageKeyValuePair#key
      */
-    public final DistributedMetaStorageKeyValuePair[] fullData;
+    @GridToStringInclude
+    @Order(2)
+    @Nullable String[] fullDataKeys;
 
     /**
-     * Required updates for joining nodes or full available history of local 
node if {@link #fullData} is
-     * not {@code null}.
+     * Arrays of the full data bytes.
+     *
+     * @see DistributedMetaStorageKeyValuePair#valBytes
      */
-    public final DistributedMetaStorageHistoryItem[] hist;
+    @GridToStringInclude
+    @Order(3)
+    @Nullable byte[][] fullDataValsBytes;
 
-    /**
-     * Additional updates. Makes sence only if {@link #fullData} is not {@code 
null}.
-     */
-    public DistributedMetaStorageHistoryItem[] updates;
+    /** Required updates for joining nodes or full available history of local 
node if the full data is not {@code null}. */
+    @Order(4)
+    @Nullable DistributedMetaStorageHistoryItemMessage[] hist;
+
+    /** Additional updates. Makes sence only if the full data is not {@code 
null}. */
+    @Order(5)
+    @Nullable DistributedMetaStorageHistoryItemMessage[] updates;
+
+    /** Empty constructor for serialization purposes. */
+    public DistributedMetaStorageClusterNodeData() {
+        // No-op.
+    }
 
     /** */
     public DistributedMetaStorageClusterNodeData(
         DistributedMetaStorageVersion ver,
-        DistributedMetaStorageKeyValuePair[] fullData,
-        DistributedMetaStorageHistoryItem[] hist,
-        DistributedMetaStorageHistoryItem[] updates
+        @Nullable DistributedMetaStorageKeyValuePair[] fullData,

Review Comment:
   in InMemoryCachedDistributedMetaStorageBridge:
   ```
   public String[] localFullDataKeys() {
        return cache.keySet().toArray(EMPTY_STRING_ARRAY);
    }
   
   public byte[][] localFullDataValues() {
        return cache.values().toArray(EMPTY_BYTES_ARRAY);
    }
   ```
   
   And change the DistributedMetaStorageClusterNodeData constructor to accept 
parallel arrays.
   
   @Vladsz83 WDYT?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to