sashapolo commented on code in PR #5134:
URL: https://github.com/apache/ignite-3/pull/5134#discussion_r1936826624


##########
modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/ZonePartitionRaftListener.java:
##########
@@ -51,47 +70,121 @@ public void onRead(Iterator<CommandClosure<ReadCommand>> 
iterator) {
 
     @Override
     public void onWrite(Iterator<CommandClosure<WriteCommand>> iterator) {
-        iterator.forEachRemaining((CommandClosure<? extends WriteCommand> clo) 
-> {
-            Command command = clo.command();
-
-            Serializable result = null;
-
+        iterator.forEachRemaining(clo -> {
             try {
-                if (command instanceof FinishTxCommand) {
-                    FinishTxCommand cmd = (FinishTxCommand) command;
-
-                    result = new TransactionResult(cmd.commit() ? COMMITTED : 
ABORTED, cmd.commitTimestamp());
-                } else {
-                    LOG.debug("Message type " + command.getClass() + " is not 
supported by the zone partition RAFT listener yet");
-                }
+                processWriteCommand(clo);
             } catch (Throwable t) {
                 LOG.error(
                         "Unknown error while processing command 
[commandIndex={}, commandTerm={}, command={}]",
                         t,
-                        clo.index(), clo.index(), command
+                        clo.index(), clo.index(), clo.command()
                 );
 
                 clo.result(t);
 
                 throw t;
             }
-
-            clo.result(result);
         });
     }
 
+    private void processWriteCommand(CommandClosure<WriteCommand> clo) {
+        Command command = clo.command();
+
+        if (command instanceof FinishTxCommand) {
+            FinishTxCommand cmd = (FinishTxCommand) command;
+
+            clo.result(new TransactionResult(cmd.commit() ? COMMITTED : 
ABORTED, cmd.commitTimestamp()));
+        } else if (command instanceof PrimaryReplicaChangeCommand) {
+            // This is a hack for tests, this command is not issued in 
production because no zone-wide placement driver exists yet.

Review Comment:
   I don't know which ticket to use here and I don't expect us to miss this 
place, because it will likely not work properly when we will implement the 
placement driver.



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