ivanzlenko commented on code in PR #4664:
URL: https://github.com/apache/ignite-3/pull/4664#discussion_r1824666294


##########
modules/core/src/test/java/org/apache/ignite/internal/hlc/HybridTimestampTest.java:
##########
@@ -158,4 +163,34 @@ void 
roundUpIncrementsPhysicalPartWhenLogicalPartIsNonZero() {
 
         assertThat(ts.roundUpToPhysicalTick(), is(new HybridTimestamp(2, 0)));
     }
+
+    @Test
+    void serializationAndDeserializationForNonNull() throws Exception {
+        HybridTimestamp originalTs = new 
HybridTimestamp(System.currentTimeMillis(), 2);
+
+        IgniteDataOutput out = new IgniteUnsafeDataOutput(100);
+
+        originalTs.writeTo(out);
+
+        IgniteDataInput in = new IgniteUnsafeDataInput(out.array());
+
+        HybridTimestamp restoredTs = HybridTimestamp.readFrom(in);
+
+        assertThat(restoredTs, is(originalTs));
+
+        assertThat(in.available(), is(0));
+    }
+
+    @Test
+    void serializationAndDeserializationForNull() throws Exception {

Review Comment:
   Make sense to add a test for readFrom()



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/index/IndexMetaSerializer.java:
##########
@@ -46,8 +47,7 @@ protected void writeExternalData(IndexMeta meta, 
IgniteDataOutput out) throws IO
 
             MetaIndexStatusChange change = entry.getValue();
             out.writeVarInt(change.catalogVersion());
-            // Writing long and not varlong as the latter requires 9 bytes.
-            out.writeLong(change.activationTimestamp());
+            
HybridTimestamp.hybridTimestamp(change.activationTimestamp()).writeTo(out);

Review Comment:
   Same with static import



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/ManualGroupRestartRequestSerializer.java:
##########
@@ -41,8 +42,7 @@ protected void writeExternalData(ManualGroupRestartRequest 
request, IgniteDataOu
         out.writeVarInt(request.tableId());
         writeVarIntSet(request.partitionIds(), out);
         writeStringSet(request.nodeNames(), out);
-        // Writing long and not a varlong as the latter requires 9 bytes for 
hybrid timestamps.
-        out.writeLong(request.assignmentsTimestamp());
+        
HybridTimestamp.hybridTimestamp(request.assignmentsTimestamp()).writeTo(out);

Review Comment:
   Same with static import



##########
modules/partition-distribution/src/main/java/org/apache/ignite/internal/partitiondistribution/AssignmentsSerializer.java:
##########
@@ -39,8 +40,7 @@ protected void writeExternalData(Assignments assignments, 
IgniteDataOutput out)
         }
 
         out.writeBoolean(assignments.force());
-        // Writing long and not varlong as the latter will take 9 bytes for 
timestamps.
-        out.writeLong(assignments.timestamp());
+        HybridTimestamp.hybridTimestamp(assignments.timestamp()).writeTo(out);

Review Comment:
   For the clarity sake I would've add static import. Not insisting though.



-- 
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