sanpwc commented on code in PR #2679:
URL: https://github.com/apache/ignite-3/pull/2679#discussion_r1362501767
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -3023,13 +3098,22 @@ private void scheduleTransactionRowAsyncCleanup(UUID
txId, RowId rowId, Transact
// Both normal cleanup and single row cleanup are using
txsPendingRowIds map to store write intents.
// So we don't need a separate method to handle single row case.
- txManager.executeCleanupAsync(() ->
- inBusyLock(busyLock, () ->
storageUpdateHandler.handleTransactionCleanup(txId, txState == COMMITED,
commitTimestamp))
- ).exceptionally(e -> {
- LOG.warn("Failed to complete transaction cleanup command [txId=" +
txId + ']', e);
+ CompletableFuture<?> future = rowCleanupMap.compute(rowId, (k, v) -> {
+ // The cleanup for this row has already been triggered. For
example, we are resolving a write intent for an RW transaction
+ // and a concurrent RO transaction resolves the same row.
+ // If the cleanup is already running - return it.
+ // If the cleanup ended with an exception - give it another try.
+ if (v != null && (!v.isDone() || !v.isCompletedExceptionally())) {
+ return v;
+ }
- return null;
+ return txManager.executeCleanupAsync(() ->
+ inBusyLock(busyLock, () ->
storageUpdateHandler.handleTransactionCleanup(txId, txState == COMMITED,
commitTimestamp))
+ ).whenComplete((unused, e) -> LOG.warn("Failed to complete
transaction cleanup command [txId=" + txId + ']', e));
Review Comment:
It seems incorrect to log warn if e is null.
--
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]