sergey-chugunov-1985 commented on code in PR #1235:
URL: https://github.com/apache/ignite-3/pull/1235#discussion_r1003284034
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/command/UpdateAllCommand.java:
##########
@@ -17,85 +17,91 @@
package org.apache.ignite.internal.table.distributed.command;
+import java.nio.ByteBuffer;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.apache.ignite.internal.schema.BinaryRow;
import org.apache.ignite.internal.storage.RowId;
+import org.apache.ignite.internal.table.distributed.TableMessageGroup;
import org.apache.ignite.internal.util.CollectionUtils;
+import org.apache.ignite.network.annotations.Transferable;
import org.jetbrains.annotations.NotNull;
/**
* State machine command for updating a batch of entries.
*/
-public class UpdateAllCommand extends PartitionCommand {
- /** Rows to update. */
- private transient HashMap<RowId, BinaryRow> rowsToUpdate;
-
- /** Bytes representation of a row to update map. */
- private byte[] rowsToUpdateBytes;
-
- /**
- * Constructor for batch remove.
- *
- * @param removeRows Ids to remove.
- * @param txId Transaction id.
- */
- public UpdateAllCommand(Collection<RowId> removeRows, @NotNull UUID txId) {
- this(removeRows, null, txId);
- }
-
- /**
- * Constructor for a batch update.
- *
- * @param rowsToUpdate Rows to update or insert.
- * @param txId Transaction id.
- */
- public UpdateAllCommand(Map<RowId, BinaryRow> rowsToUpdate, @NotNull UUID
txId) {
- this(null, rowsToUpdate, txId);
- }
-
- /**
- * The constructor.
- *
- * @param removeRows Ids to remove.
- * @param rowsToUpdate Rows to update or insert.
- * @param txId Transaction id.
- */
- private UpdateAllCommand(Collection<RowId> removeRows, Map<RowId,
BinaryRow> rowsToUpdate, @NotNull UUID txId) {
- super(txId);
-
- int size = (removeRows == null ? 0 : removeRows.size()) +
(rowsToUpdate == null ? 0 : rowsToUpdate.size());
-
- HashMap<RowId, BinaryRow> rows = new HashMap<>(size);
-
- if (!CollectionUtils.nullOrEmpty(removeRows)) {
- removeRows.forEach(rowId -> rows.put(rowId, null));
- }
-
- if (!CollectionUtils.nullOrEmpty(rowsToUpdate)) {
- rows.putAll(rowsToUpdate);
- }
-
- this.rowsToUpdate = rows;
-
- rowsToUpdateBytes = CommandUtils.rowMapToBytes(rows);
- }
-
-
- /**
- * Gets rows to update.
- *
- * @return Rows to update map.
- */
- public HashMap<RowId, BinaryRow> getRowsToUpdate() {
- if (rowsToUpdate == null) {
- rowsToUpdate = new HashMap();
-
- CommandUtils.readRowMap(rowsToUpdateBytes, rowsToUpdate::put);
- }
-
- return rowsToUpdate;
- }
+@Transferable(TableMessageGroup.Commands.UPDATE_ALL)
+public interface UpdateAllCommand extends PartitionCommand {
+// /** Rows to update. */
Review Comment:
I left it here just in case if I don't get something in the code using
UpdateAllCommand and will need to consult with old logic. But conversion went
smoothly, now I removed old code.
--
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]