tkalkirill commented on code in PR #2701:
URL: https://github.com/apache/ignite-3/pull/2701#discussion_r1363565146


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -484,22 +484,22 @@ private CompletableFuture<?> 
processOperationRequest(ReplicaRequest request, @Nu
      */
     private CompletableFuture<LeaderOrTxState> 
processTxStateCommitPartitionRequest(TxStateCommitPartitionRequest request) {
         return placementDriver.getPrimaryReplica(replicationGroupId, 
hybridClock.now())
-                .thenCompose(primaryReplica -> {
-                    if (primaryReplica == null) {
-                        return failedFuture(new 
PrimaryReplicaMissException(localNode.name(), null));
+                .thenCompose(primaryReplicaMeta -> {
+                    if (primaryReplicaMeta == null) {
+                        return failedFuture(new 
PrimaryReplicaMissException(localNode.name(), null, null, null, null));
                     }
 
-                    if (isLocalPeer(primaryReplica.getLeaseholder())) {
-                        TransactionMeta txMeta = 
txManager.stateMeta(request.txId());
+                    if (!isLocalPeer(primaryReplicaMeta.getLeaseholder())) {

Review Comment:
   For me, it reads better:
   1. if the meta is zero, then there is an error
   2. if the replica is not a local node, then an immediate response
   3. something more complicated
   
   I also find it easier to read because you keep less context in head.



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