ibessonov commented on code in PR #4530:
URL: https://github.com/apache/ignite-3/pull/4530#discussion_r1798965192


##########
modules/metastorage/src/main/java/org/apache/ignite/internal/metastorage/server/raft/MetaStorageWriteHandler.java:
##########
@@ -172,49 +178,55 @@ private void 
handleNonCachedWriteCommand(CommandClosure<WriteCommand> clo) {
      *
      * @param clo Command closure.
      * @param command Command.
+     * @param index Command index.
+     * @param term Command term.
      */
-    private void handleWriteWithTime(CommandClosure<WriteCommand> clo, 
MetaStorageWriteCommand command) {
+    private void handleWriteWithTime(CommandClosure<WriteCommand> clo, 
MetaStorageWriteCommand command, long index, long term) {
         HybridTimestamp opTime = command.safeTime();
 
+        KeyValueUpdateContext context = new KeyValueUpdateContext(index, term, 
opTime);
+
         if (command instanceof PutCommand) {
             PutCommand putCmd = (PutCommand) command;
 
-            storage.put(toByteArray(putCmd.key()), 
toByteArray(putCmd.value()), opTime);
+            storage.put(toByteArray(putCmd.key()), 
toByteArray(putCmd.value()), context);
 
             clo.result(null);
         } else if (command instanceof PutAllCommand) {
             PutAllCommand putAllCmd = (PutAllCommand) command;
 
-            storage.putAll(toByteArrayList(putAllCmd.keys()), 
toByteArrayList(putAllCmd.values()), opTime);
+            storage.putAll(toByteArrayList(putAllCmd.keys()), 
toByteArrayList(putAllCmd.values()), context);
 
             clo.result(null);
         } else if (command instanceof RemoveCommand) {
             RemoveCommand rmvCmd = (RemoveCommand) command;
 
-            storage.remove(toByteArray(rmvCmd.key()), opTime);
+            storage.remove(toByteArray(rmvCmd.key()), context);
 
             clo.result(null);
         } else if (command instanceof RemoveAllCommand) {
             RemoveAllCommand rmvAllCmd = (RemoveAllCommand) command;
 
-            storage.removeAll(toByteArrayList(rmvAllCmd.keys()), opTime);
+            storage.removeAll(toByteArrayList(rmvAllCmd.keys()), context);
 
             clo.result(null);
         } else if (command instanceof InvokeCommand) {
             InvokeCommand cmd = (InvokeCommand) command;
 
-            clo.result(storage.invoke(toCondition(cmd.condition()), 
cmd.success(), cmd.failure(), opTime, cmd.id()));
+            clo.result(storage.invoke(toCondition(cmd.condition()), 
cmd.success(), cmd.failure(), context, cmd.id()));
         } else if (command instanceof MultiInvokeCommand) {
             MultiInvokeCommand cmd = (MultiInvokeCommand) command;
 
-            clo.result(storage.invoke(toIf(cmd.iif()), opTime, cmd.id()));
+            clo.result(storage.invoke(toIf(cmd.iif()), context, cmd.id()));
         } else if (command instanceof SyncTimeCommand) {
-            storage.advanceSafeTime(command.safeTime());
+            storage.setIndexAndTerm(index, term);
+
+            storage.advanceSafeTime(opTime);

Review Comment:
   Maybe, I'll try and see how it goes



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