This is an automated email from the ASF dual-hosted git repository. rpuch pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push: new dd5e635c4be IGNITE-26051 Ignore destroyed tables in write intent switch command (#6362) dd5e635c4be is described below commit dd5e635c4be3a4c3baf47d8b3ad7f3b54b7d0d6b Author: Roman Puchkovskiy <roman.puchkovs...@gmail.com> AuthorDate: Mon Aug 4 20:48:47 2025 +0400 IGNITE-26051 Ignore destroyed tables in write intent switch command (#6362) --- .../handlers/WriteIntentSwitchCommandHandler.java | 27 ++++++++++++++++------ .../partition/ItPartitionDestructionTest.java | 2 -- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/raft/handlers/WriteIntentSwitchCommandHandler.java b/modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/raft/handlers/WriteIntentSwitchCommandHandler.java index db734240fd3..b9407770de0 100644 --- a/modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/raft/handlers/WriteIntentSwitchCommandHandler.java +++ b/modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/raft/handlers/WriteIntentSwitchCommandHandler.java @@ -19,6 +19,8 @@ package org.apache.ignite.internal.partition.replicator.raft.handlers; import java.util.function.IntFunction; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.logger.IgniteLogger; +import org.apache.ignite.internal.logger.Loggers; import org.apache.ignite.internal.partition.replicator.network.command.WriteIntentSwitchCommand; import org.apache.ignite.internal.partition.replicator.network.command.WriteIntentSwitchCommandV2; import org.apache.ignite.internal.partition.replicator.raft.CommandResult; @@ -31,6 +33,8 @@ import org.jetbrains.annotations.Nullable; * Handler for {@link WriteIntentSwitchCommand}s. */ public class WriteIntentSwitchCommandHandler extends AbstractCommandHandler<WriteIntentSwitchCommand> { + private static final IgniteLogger LOG = Loggers.forClass(WriteIntentSwitchCommandHandler.class); + private final IntFunction<RaftTableProcessor> tableProcessorByTableId; private final RaftTxFinishMarker txFinishMarker; @@ -55,7 +59,20 @@ public class WriteIntentSwitchCommandHandler extends AbstractCommandHandler<Writ boolean applied = false; for (int tableId : ((WriteIntentSwitchCommandV2) switchCommand).tableIds()) { - CommandResult singleResult = raftTableProcessor(tableId) + RaftTableProcessor tableProcessor = raftTableProcessor(tableId); + + if (tableProcessor == null) { + // This can only happen if the table in question has already been dropped and destroyed. In such case, we simply + // don't need to do anything as the partition storage is already destroyed. + if (LOG.isDebugEnabled()) { + LOG.debug("Table processor for table ID {} not found. Command execution for the table will be ignored: {}", + tableId, switchCommand.toStringForLightLogging()); + } + + continue; + } + + CommandResult singleResult = tableProcessor .processCommand(switchCommand, commandIndex, commandTerm, safeTimestamp); applied = applied || singleResult.wasApplied(); @@ -64,11 +81,7 @@ public class WriteIntentSwitchCommandHandler extends AbstractCommandHandler<Writ return new CommandResult(null, applied); } - private RaftTableProcessor raftTableProcessor(int tableId) { - RaftTableProcessor raftTableProcessor = tableProcessorByTableId.apply(tableId); - - assert raftTableProcessor != null : "No RAFT table processor found by table ID " + tableId; - - return raftTableProcessor; + private @Nullable RaftTableProcessor raftTableProcessor(int tableId) { + return tableProcessorByTableId.apply(tableId); } } diff --git a/modules/table/src/integrationTest/java/org/apache/ignite/internal/partition/ItPartitionDestructionTest.java b/modules/table/src/integrationTest/java/org/apache/ignite/internal/partition/ItPartitionDestructionTest.java index 9b311c1eb24..92f9f82d46f 100644 --- a/modules/table/src/integrationTest/java/org/apache/ignite/internal/partition/ItPartitionDestructionTest.java +++ b/modules/table/src/integrationTest/java/org/apache/ignite/internal/partition/ItPartitionDestructionTest.java @@ -230,8 +230,6 @@ class ItPartitionDestructionTest extends ClusterPerTestIntegrationTest { */ @Test @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG, value = "true") - // TODO: enable after https://issues.apache.org/jira/browse/IGNITE-26051 is fixed. - @Disabled("https://issues.apache.org/jira/browse/IGNITE-26051") void partitionIsDestroyedOnTableDestructionOnNodeRecoveryWithColocation() throws Exception { testPartitionIsDestroyedOnTableDestructionOnNodeRecovery(true); }