sanpwc commented on code in PR #3540:
URL: https://github.com/apache/ignite-3/pull/3540#discussion_r1553886872
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -394,6 +396,52 @@ public PartitionReplicaListener(
prepareIndexBuilderTxRwOperationTracker();
}
+ @Override
+ public CompletableFuture<Boolean>
onPrimaryElected(PrimaryReplicaEventParameters evt) {
+ assert replicationGroupId.equals(evt.groupId()) : format(
+ "The replication group listener does not match the event
[grp={}, eventGrp={}]",
+ replicationGroupId,
+ evt.groupId()
+ );
+
+ if (!localNode.id().equals(evt.leaseholderId())) {
+ return falseCompletedFuture();
+ }
+
+ schedulePersistentStorageScan();
+
+ // The future returned by this event handler can't wait for all
cleanups because it's not necessary and it can block
+ // meta storage notification thread for a while, preventing it from
delivering further updates (including leases) and therefore
+ // causing deadlock on primary replica waiting.
+ return falseCompletedFuture();
+ }
+
+ private void schedulePersistentStorageScan() {
+
txManager.executeWriteIntentSwitchAsync(this::runPersistentStorageScan);
+ }
+
+ private void runPersistentStorageScan() {
+ try (Cursor<IgniteBiTuple<UUID, TxMeta>> txs = txStateStorage.scan()) {
+ for (IgniteBiTuple<UUID, TxMeta> tx : txs) {
+ UUID txId = tx.getKey();
+ TxMeta txMeta = tx.getValue();
+
+ assert !txMeta.enlistedPartitions().isEmpty();
Review Comment:
What about ABANDONED -> ABORTED, do we adjust enlistedPartitions with the
one that triggered the recovery?
--
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]