Cyrill commented on code in PR #7263:
URL: https://github.com/apache/ignite-3/pull/7263#discussion_r2635752604
##########
modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/handlers/TxStateCommitPartitionReplicaRequestHandler.java:
##########
@@ -106,19 +132,53 @@ private CompletableFuture<TransactionMeta>
triggerTxRecoveryOnTxStateResolutionI
TxMeta txMeta = txStatePartitionStorage.get(txId);
if (txMeta == null) {
+ InternalClusterNode coordinator = (txStateMeta == null ||
txStateMeta.txCoordinatorId() == null)
+ ? null
+ :
clusterNodeResolver.getById(txStateMeta.txCoordinatorId());
+
// This means the transaction is pending and we should trigger the
recovery if there is no tx coordinator in topology.
if (txStateMeta == null
|| txStateMeta.txState() == ABANDONED
|| txStateMeta.txCoordinatorId() == null
- ||
clusterNodeResolver.getById(txStateMeta.txCoordinatorId()) == null) {
+ || coordinator == null) {
// This means that primary replica for commit partition has
changed, since the local node doesn't have the volatile tx
// state; and there is no final tx state in txStateStorage, or
the tx coordinator left the cluster. But we can assume
// that as the coordinator (or information about it) is
missing, there is no need to wait a finish request from
// tx coordinator, the transaction can't be committed at all.
return txRecoveryEngine.triggerTxRecovery(txId, localNode.id())
.handle((v, ex) ->
CompletableFuture.<TransactionMeta>completedFuture(txManager.stateMeta(txId)))
- .thenCompose(v -> v);
+ .thenCompose(Function.identity());
+ } else if (coordinator != null) {
+ // If there is coordinator in the cluster we should fallback
to coordinator request. It's possible that coordinator
+ // was not seen in topology on another node which requested
the state from commit partition, but can be seen here.
+ HybridTimestamp timestamp = readTimestamp == null ?
HybridTimestamp.MIN_VALUE : readTimestamp;
+
+ return txMessageSender.resolveTxStateFromCoordinator(
+ coordinator,
+ txId,
+ timestamp,
+ senderCurrentConsistencyToken,
+ senderGroupId
+ )
+ .handle((response, e) -> {
+ if (e == null && response.txStateMeta() != null) {
+ TransactionMetaMessage transactionMetaMessage
= Objects.requireNonNull(response.txStateMeta(),
Review Comment:
requireNonNull seems excessive 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]