denis-chudov commented on code in PR #2918:
URL: https://github.com/apache/ignite-3/pull/2918#discussion_r1422748162
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -731,27 +760,70 @@ private CompletableFuture<?> processOperationRequest(
* @param request Transaction state request.
* @return Result future.
*/
- private CompletableFuture<LeaderOrTxState>
processTxStateCommitPartitionRequest(TxStateCommitPartitionRequest request) {
+ private CompletableFuture<TransactionMeta>
processTxStateCommitPartitionRequest(TxStateCommitPartitionRequest request) {
return placementDriver.getPrimaryReplica(replicationGroupId,
hybridClock.now())
- .thenCompose(primaryReplicaMeta -> {
- if (primaryReplicaMeta == null) {
+ .thenCompose(replicaMeta -> {
+ if (replicaMeta == null || replicaMeta.getLeaseholder() ==
null) {
return failedFuture(new
PrimaryReplicaMissException(localNode.name(), null, null, null, null));
}
- if (!isLocalPeer(primaryReplicaMeta.getLeaseholder())) {
- return completedFuture(new
LeaderOrTxState(primaryReplicaMeta.getLeaseholder(), null));
+ if (!isLocalPeer(replicaMeta.getLeaseholder())) {
+ return failedFuture(
+ new
PrimaryReplicaMissException(localNode.name(), replicaMeta.getLeaseholder(),
null, null, null)
+ );
}
- TransactionMeta txMeta =
txManager.stateMeta(request.txId());
+ UUID txId = request.txId();
- if (txMeta == null) {
- txMeta = txStateStorage.get(request.txId());
- }
+ TxStateMeta txMeta = txManager.stateMeta(txId);
- return completedFuture(new LeaderOrTxState(null, txMeta));
+ if (txMeta != null && txMeta.txState() == FINISHING) {
+ assert txMeta instanceof TxStateMetaFinishing : txMeta;
+ return ((TxStateMetaFinishing)
txMeta).txFinishFuture();
+ } else if (txMeta == null ||
!isFinalState(txMeta.txState())) {
+ // Try to trigger recovery, if needed. If the
transaction will be aborted, the proper ABORTED state will be sent
+ // in response.
+ return
triggerTxRecoveryOnTxStateResolutionIfNeeded(txId, txMeta);
+ } else {
+ assert txMeta != null &&
isFinalState(txMeta.txState()) : txMeta;
Review Comment:
ok removed
--
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]