You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "vldpyatkov (via GitHub)" <gi...@apache.org> on 2023/10/24 17:57:06 UTC

[PR] IGNITE-20609 Move last commit timestamp into BinaryRowMessage [ignite-3]

vldpyatkov opened a new pull request, #2749:
URL: https://github.com/apache/ignite-3/pull/2749

   https://issues.apache.org/jira/browse/IGNITE-20609


-- 
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-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-20609 Move last commit timestamp into BinaryRowMessage [ignite-3]

Posted by "vldpyatkov (via GitHub)" <gi...@apache.org>.
vldpyatkov commented on code in PR #2749:
URL: https://github.com/apache/ignite-3/pull/2749#discussion_r1376106513


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/command/UpdateCommand.java:
##########
@@ -36,28 +36,23 @@ public interface UpdateCommand extends PartitionCommand {
 
     UUID rowUuid();
 
-    @Nullable
-    BinaryRowMessage rowMessage();
+    @Nullable TimedBinaryRowMessage messageRowToUpdate();
 
     String txCoordinatorId();
 
     /** Returns the row to update or {@code null} if the row should be removed. */
-    @Nullable
-    default BinaryRow row() {
-        BinaryRowMessage message = rowMessage();
+    default @Nullable BinaryRow rowToUpdate() {
+        TimedBinaryRowMessage tsRoMsg = messageRowToUpdate();
 
-        return message == null ? null : message.asBinaryRow();
+        return tsRoMsg == null ? null : tsRoMsg.binaryRow();
     }
 
-    /**
-     * Returns the timestamp of the last committed entry.
-     */
-    long lastCommitTimestampLong();
-
     /**
      * Returns the timestamp of the last committed entry.
      */
     default @Nullable HybridTimestamp lastCommitTimestamp() {
-        return nullableHybridTimestamp(lastCommitTimestampLong());
+        TimedBinaryRowMessage tsRoMsg = messageRowToUpdate();
+
+        return nullableHybridTimestamp(tsRoMsg == null ? NULL_HYBRID_TIMESTAMP : tsRoMsg.timestamp());

Review Comment:
   Done.



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/PartitionListener.java:
##########
@@ -267,8 +271,7 @@ private void handleUpdateAllCommand(UpdateAllCommand cmd, long commandIndex, lon
                 storageUpdateHandler.handleUpdateAll(cmd.txId(), cmd.rowsToUpdate(), cmd.tablePartitionId().asTablePartitionId(),

Review Comment:
   Done.



-- 
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-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-20609 Move last commit timestamp into BinaryRowMessage [ignite-3]

Posted by "vldpyatkov (via GitHub)" <gi...@apache.org>.
vldpyatkov merged PR #2749:
URL: https://github.com/apache/ignite-3/pull/2749


-- 
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-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-20609 Move last commit timestamp into BinaryRowMessage [ignite-3]

Posted by "Cyrill (via GitHub)" <gi...@apache.org>.
Cyrill commented on code in PR #2749:
URL: https://github.com/apache/ignite-3/pull/2749#discussion_r1376086129


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/StorageUpdateHandler.java:
##########
@@ -188,15 +186,15 @@ public void handleUpdateAll(
                 List<RowId> rowIds = new ArrayList<>();
 
                 // Sort IDs to prevent deadlock. Natural UUID order matches RowId order within the same partition.
-                SortedMap<UUID, BinaryRowMessage> sortedRowsToUpdateMap = new TreeMap<>(rowsToUpdate);
+                SortedMap<UUID, TimedBinaryRow> sortedRowsToUpdateMap = new TreeMap<>(rowsToUpdate);
 
-                for (Map.Entry<UUID, BinaryRowMessage> entry : sortedRowsToUpdateMap.entrySet()) {
+                for (Map.Entry<UUID, TimedBinaryRow> entry : sortedRowsToUpdateMap.entrySet()) {
                     RowId rowId = new RowId(partitionId, entry.getKey());
-                    BinaryRow row = entry.getValue() == null ? null : entry.getValue().asBinaryRow();
+                    BinaryRow row = entry.getValue() == null ? null : entry.getValue().binaryRow();
 
                     locker.lock(rowId);
 
-                    performStorageCleanupIfNeeded(txId, rowId, lastCommitTsMap.get(entry.getKey()));
+                    performStorageCleanupIfNeeded(txId, rowId, entry.getValue().commitTimestamp());

Review Comment:
   At the line 193 we check if` entry.getValue() == null`. Either we don't need that check now or we need to add one here.



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/command/UpdateCommand.java:
##########
@@ -36,28 +36,23 @@ public interface UpdateCommand extends PartitionCommand {
 
     UUID rowUuid();
 
-    @Nullable
-    BinaryRowMessage rowMessage();
+    @Nullable TimedBinaryRowMessage messageRowToUpdate();
 
     String txCoordinatorId();
 
     /** Returns the row to update or {@code null} if the row should be removed. */
-    @Nullable
-    default BinaryRow row() {
-        BinaryRowMessage message = rowMessage();
+    default @Nullable BinaryRow rowToUpdate() {
+        TimedBinaryRowMessage tsRoMsg = messageRowToUpdate();
 
-        return message == null ? null : message.asBinaryRow();
+        return tsRoMsg == null ? null : tsRoMsg.binaryRow();
     }
 
-    /**
-     * Returns the timestamp of the last committed entry.
-     */
-    long lastCommitTimestampLong();
-
     /**
      * Returns the timestamp of the last committed entry.
      */
     default @Nullable HybridTimestamp lastCommitTimestamp() {
-        return nullableHybridTimestamp(lastCommitTimestampLong());
+        TimedBinaryRowMessage tsRoMsg = messageRowToUpdate();
+
+        return nullableHybridTimestamp(tsRoMsg == null ? NULL_HYBRID_TIMESTAMP : tsRoMsg.timestamp());

Review Comment:
   `return tsRoMsg == null ? null : nullableHybridTimestamp(tsRoMsg.timestamp());`



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/PartitionListener.java:
##########
@@ -267,8 +271,7 @@ private void handleUpdateAllCommand(UpdateAllCommand cmd, long commandIndex, lon
                 storageUpdateHandler.handleUpdateAll(cmd.txId(), cmd.rowsToUpdate(), cmd.tablePartitionId().asTablePartitionId(),

Review Comment:
   Alignment issues: not all params are on their own lines



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -3370,11 +3370,15 @@ private static UpdateCommand updateCommand(
                 .requiredCatalogVersion(catalogVersion);
 
         if (lastCommitTimestamp != null) {
-            bldr.lastCommitTimestampLong(lastCommitTimestamp.longValue());
+            bldr.messageRowToUpdate(MSG_FACTORY.timedBinaryRowMessage()

Review Comment:
   doesn't one call replace the results of another?



-- 
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-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-20609 Move last commit timestamp into BinaryRowMessage [ignite-3]

Posted by "vldpyatkov (via GitHub)" <gi...@apache.org>.
vldpyatkov commented on code in PR #2749:
URL: https://github.com/apache/ignite-3/pull/2749#discussion_r1377479219


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/StorageUpdateHandler.java:
##########
@@ -188,15 +186,15 @@ public void handleUpdateAll(
                 List<RowId> rowIds = new ArrayList<>();
 
                 // Sort IDs to prevent deadlock. Natural UUID order matches RowId order within the same partition.
-                SortedMap<UUID, BinaryRowMessage> sortedRowsToUpdateMap = new TreeMap<>(rowsToUpdate);
+                SortedMap<UUID, TimedBinaryRow> sortedRowsToUpdateMap = new TreeMap<>(rowsToUpdate);
 
-                for (Map.Entry<UUID, BinaryRowMessage> entry : sortedRowsToUpdateMap.entrySet()) {
+                for (Map.Entry<UUID, TimedBinaryRow> entry : sortedRowsToUpdateMap.entrySet()) {
                     RowId rowId = new RowId(partitionId, entry.getKey());
-                    BinaryRow row = entry.getValue() == null ? null : entry.getValue().asBinaryRow();
+                    BinaryRow row = entry.getValue() == null ? null : entry.getValue().binaryRow();
 
                     locker.lock(rowId);
 
-                    performStorageCleanupIfNeeded(txId, rowId, lastCommitTsMap.get(entry.getKey()));
+                    performStorageCleanupIfNeeded(txId, rowId, entry.getValue().commitTimestamp());

Review Comment:
   Fixed.



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -3370,11 +3370,15 @@ private static UpdateCommand updateCommand(
                 .requiredCatalogVersion(catalogVersion);
 
         if (lastCommitTimestamp != null) {
-            bldr.lastCommitTimestampLong(lastCommitTimestamp.longValue());
+            bldr.messageRowToUpdate(MSG_FACTORY.timedBinaryRowMessage()

Review Comment:
   Fixed.



-- 
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-unsubscribe@ignite.apache.org

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