rpuch commented on code in PR #2055:
URL: https://github.com/apache/ignite-3/pull/2055#discussion_r1191261731
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -976,13 +983,34 @@ private CompletableFuture<Void>
processTxFinishAction(TxFinishReplicaRequest req
List<TablePartitionId> aggregatedGroupIds =
request.groups().values().stream()
.flatMap(List::stream)
.map(IgniteBiTuple::get1)
- .collect(Collectors.toList());
+ .collect(toList());
UUID txId = request.txId();
- boolean commit = request.commit();
+ return schemaCompatValidator.validateForwards(txId,
aggregatedGroupIds, request.commit(), request.commitTimestamp())
Review Comment:
I see two alternatives to the current approach.
One is to branch on `request.commit()` in the `PartitionReplicaListener`
and, if it's a commit, do what is done there now (validate, then invoke
`finishAndCleanup()`, then maybe throw); if it's an abort, just call
`finishAndCleanup()`. But the result is that `finishAndCleanup()` is called
twice in different branches, and this seems weird.
Another alternative is to build a method like `validateForwardsIfCommit()`,
but it would still produce a future of `ForwardValidationResult`, so we would
have to return `success()` if it's an abort. Still looks weird: we kinda did
not validate, but we returned a validation result. We could also add a third
state to the validation result, like 'no need for validation', but it would
work exactly like 'success', so this also looks weird.
What changes do you envision here?
--
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]