You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "sashapolo (via GitHub)" <gi...@apache.org> on 2025/04/03 14:56:19 UTC

[PR] IGNITE-24397 Add tests for table removal for colocation [ignite-3]

sashapolo opened a new pull request, #5568:
URL: https://github.com/apache/ignite-3/pull/5568

   https://issues.apache.org/jira/browse/IGNITE-24397
   
   Thank you for submitting the pull request.
   
   To streamline the review process of the patch and ensure better code quality
   we ask both an author and a reviewer to verify the following:
   
   ### The Review Checklist
   - [ ] **Formal criteria:** TC status, codestyle, mandatory documentation. Also make sure to complete the following:  
   \- There is a single JIRA ticket related to the pull request.  
   \- The web-link to the pull request is attached to the JIRA ticket.  
   \- The JIRA ticket has the Patch Available state.  
   \- The description of the JIRA ticket explains WHAT was made, WHY and HOW.  
   \- The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
   - [ ] **Design:** new code conforms with the design principles of the components it is added to.
   - [ ] **Patch quality:** patch cannot be split into smaller pieces, its size must be reasonable.
   - [ ] **Code quality:** code is clean and readable, necessary developer documentation is added if needed.
   - [ ] **Tests code quality:** test set covers positive/negative scenarios, happy/edge cases. Tests are effective in terms of execution time and resources.
   
   ### Notes
   - [Apache Ignite Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Java+Code+Style+Guide)


-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-24397 Add tests for table removal for colocation [ignite-3]

Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #5568:
URL: https://github.com/apache/ignite-3/pull/5568#discussion_r2028640638


##########
modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerTest.java:
##########
@@ -448,9 +446,9 @@ public void testDropTable() throws Exception {
         assertNull(tableManager.table(DYNAMIC_TABLE_FOR_DROP_NAME));
         assertEquals(0, tableManager.tables().size());
 
-        verify(mvTableStorage, atMost(0)).destroy();
-        verify(txStateStorage, atMost(0)).destroy();
-        verify(replicaMgr, atMost(0)).stopReplica(any());
+        verify(mvTableStorage, never()).destroy();
+        verify(txStateStorage, never()).destroy();
+        verify(replicaMgr, never()).stopReplica(any());

Review Comment:
   yes, but this test is for the non-colocation case. But I get your point, I'll adapt it to work for both cases 



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-24397 Add tests for table removal for colocation [ignite-3]

Posted by "rpuch (via GitHub)" <gi...@apache.org>.
rpuch commented on code in PR #5568:
URL: https://github.com/apache/ignite-3/pull/5568#discussion_r2028635544


##########
modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerTest.java:
##########
@@ -448,9 +446,9 @@ public void testDropTable() throws Exception {
         assertNull(tableManager.table(DYNAMIC_TABLE_FOR_DROP_NAME));
         assertEquals(0, tableManager.tables().size());
 
-        verify(mvTableStorage, atMost(0)).destroy();
-        verify(txStateStorage, atMost(0)).destroy();
-        verify(replicaMgr, atMost(0)).stopReplica(any());
+        verify(mvTableStorage, never()).destroy();
+        verify(txStateStorage, never()).destroy();
+        verify(replicaMgr, never()).stopReplica(any());

Review Comment:
   Let me be more precise: it should be called only for non-colocation case. In case of colocation, tx state storage belongs to the zone, not the table, and this test does not destroy the zone.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-24397 Add tests for table removal for colocation [ignite-3]

Posted by "sk0x50 (via GitHub)" <gi...@apache.org>.
sk0x50 commented on code in PR #5568:
URL: https://github.com/apache/ignite-3/pull/5568#discussion_r2028614673


##########
modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItAbstractColocationTest.java:
##########
@@ -301,6 +302,10 @@ static void createTable(Node node, String zoneName, String tableName, String sto
                 List.of("KEY"),
                 storageProfile
         );
+
+        Integer tableId = getTableId(node.catalogManager, tableName, node.hybridClock.nowLong());

Review Comment:
   You can use `TableTestUtils.getTableIdStrict` here. Anyway, it's up to you.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-24397 Add tests for table removal for colocation [ignite-3]

Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #5568:
URL: https://github.com/apache/ignite-3/pull/5568#discussion_r2028606793


##########
modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/ZonePartitionReplicaListener.java:
##########
@@ -239,10 +239,24 @@ private CompletableFuture<ReplicaResult> processTableAwareRequest(
             ReplicaPrimacy replicaPrimacy,
             UUID senderId
     ) {
-        int tableId = ((TableAware) request).tableId();
-
         return tableAwareReplicaRequestPreProcessor.preProcessTableAwareRequest(request, replicaPrimacy, senderId)
-                .thenCompose(ignored -> replicas.get(tableId).process(request, replicaPrimacy, senderId));
+                .thenCompose(ignored -> {
+                    int tableId = ((TableAware) request).tableId();
+
+                    ReplicaTableProcessor replicaProcessor = replicaProcessors.get(tableId);
+
+                    if (replicaProcessor == null) {
+                        // Most of the times this condition should be false. This logging message is added in case a request got stuck
+                        // somewhere while being replicated and arrived on this node after the target table had been removed. In this case
+                        // we ignore the command, which should be safe to do, because the underlying storage was destroyed anyway.
+                        LOG.warn("Replica processor for table ID {} not found. Command will be ignored: {}", tableId,

Review Comment:
   What do you propose to do? Should we comment this and fail with an NPE for now?



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-24397 Add tests for table removal for colocation [ignite-3]

Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #5568:
URL: https://github.com/apache/ignite-3/pull/5568#discussion_r2028609217


##########
modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerTest.java:
##########
@@ -448,9 +446,9 @@ public void testDropTable() throws Exception {
         assertNull(tableManager.table(DYNAMIC_TABLE_FOR_DROP_NAME));
         assertEquals(0, tableManager.tables().size());
 
-        verify(mvTableStorage, atMost(0)).destroy();
-        verify(txStateStorage, atMost(0)).destroy();
-        verify(replicaMgr, atMost(0)).stopReplica(any());
+        verify(mvTableStorage, never()).destroy();
+        verify(txStateStorage, never()).destroy();
+        verify(replicaMgr, never()).stopReplica(any());

Review Comment:
   Why shouldn't it be called?



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-24397 Add tests for table removal for colocation [ignite-3]

Posted by "rpuch (via GitHub)" <gi...@apache.org>.
rpuch commented on code in PR #5568:
URL: https://github.com/apache/ignite-3/pull/5568#discussion_r2028572841


##########
modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItReplicaLifecycleTest.java:
##########
@@ -669,6 +671,28 @@ public void testReplicaSafeTimeSyncRequest() throws Exception {
         checkSafeTimeWasAdjustedForZoneGroup(node1, zoneId, partId);
     }
 
+    @Test
+    public void testListenersAreRemovedOnTableDrop() throws Exception {

Review Comment:
   ```suggestion
       public void testListenersAreRemovedOnTableDestruction() throws Exception {
   ```



##########
modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/raft/ZonePartitionRaftListener.java:
##########
@@ -297,7 +297,18 @@ private CommandResult processTableAwareCommand(
             long commandTerm,
             @Nullable HybridTimestamp safeTimestamp
     ) {
-        return tableProcessors.get(tableId).processCommand(command, commandIndex, commandTerm, safeTimestamp);
+        RaftTableProcessor tableProcessor = tableProcessors.get(tableId);
+
+        if (tableProcessor == null) {

Review Comment:
   Same concern as with replica requests



##########
modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerTest.java:
##########
@@ -448,9 +446,9 @@ public void testDropTable() throws Exception {
         assertNull(tableManager.table(DYNAMIC_TABLE_FOR_DROP_NAME));
         assertEquals(0, tableManager.tables().size());
 
-        verify(mvTableStorage, atMost(0)).destroy();
-        verify(txStateStorage, atMost(0)).destroy();
-        verify(replicaMgr, atMost(0)).stopReplica(any());
+        verify(mvTableStorage, never()).destroy();
+        verify(txStateStorage, never()).destroy();
+        verify(replicaMgr, never()).stopReplica(any());

Review Comment:
   On line 456, `txStateStorage.destroy()` should not be called, but it is, according to the verification



##########
modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/ZonePartitionReplicaListener.java:
##########
@@ -239,10 +239,24 @@ private CompletableFuture<ReplicaResult> processTableAwareRequest(
             ReplicaPrimacy replicaPrimacy,
             UUID senderId
     ) {
-        int tableId = ((TableAware) request).tableId();
-
         return tableAwareReplicaRequestPreProcessor.preProcessTableAwareRequest(request, replicaPrimacy, senderId)
-                .thenCompose(ignored -> replicas.get(tableId).process(request, replicaPrimacy, senderId));
+                .thenCompose(ignored -> {
+                    int tableId = ((TableAware) request).tableId();
+
+                    ReplicaTableProcessor replicaProcessor = replicaProcessors.get(tableId);
+
+                    if (replicaProcessor == null) {
+                        // Most of the times this condition should be false. This logging message is added in case a request got stuck
+                        // somewhere while being replicated and arrived on this node after the target table had been removed. In this case
+                        // we ignore the command, which should be safe to do, because the underlying storage was destroyed anyway.
+                        LOG.warn("Replica processor for table ID {} not found. Command will be ignored: {}", tableId,

Review Comment:
   Currently, it seems that there is a bug (maybe this one https://issues.apache.org/jira/browse/IGNITE-24991) because of which a request arrives not AFTER removal, but BEFORE addition. We still need this to trigger an NPE. If we apply your change, we'll stop seeing these NPEs. I'm not sure this is what we should do



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-24397 Add tests for table removal for colocation [ignite-3]

Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo merged PR #5568:
URL: https://github.com/apache/ignite-3/pull/5568


-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-24397 Add tests for table removal for colocation [ignite-3]

Posted by "rpuch (via GitHub)" <gi...@apache.org>.
rpuch commented on code in PR #5568:
URL: https://github.com/apache/ignite-3/pull/5568#discussion_r2028634283


##########
modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/ZonePartitionReplicaListener.java:
##########
@@ -239,10 +239,24 @@ private CompletableFuture<ReplicaResult> processTableAwareRequest(
             ReplicaPrimacy replicaPrimacy,
             UUID senderId
     ) {
-        int tableId = ((TableAware) request).tableId();
-
         return tableAwareReplicaRequestPreProcessor.preProcessTableAwareRequest(request, replicaPrimacy, senderId)
-                .thenCompose(ignored -> replicas.get(tableId).process(request, replicaPrimacy, senderId));
+                .thenCompose(ignored -> {
+                    int tableId = ((TableAware) request).tableId();
+
+                    ReplicaTableProcessor replicaProcessor = replicaProcessors.get(tableId);
+
+                    if (replicaProcessor == null) {
+                        // Most of the times this condition should be false. This logging message is added in case a request got stuck
+                        // somewhere while being replicated and arrived on this node after the target table had been removed. In this case
+                        // we ignore the command, which should be safe to do, because the underlying storage was destroyed anyway.
+                        LOG.warn("Replica processor for table ID {} not found. Command will be ignored: {}", tableId,

Review Comment:
   I think we should still fail for now. If we know that the failed test drops tables, we'll have a suspicion what is to blame...



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-24397 Add tests for table removal for colocation [ignite-3]

Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #5568:
URL: https://github.com/apache/ignite-3/pull/5568#discussion_r2028635613


##########
modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/ZonePartitionReplicaListener.java:
##########
@@ -239,10 +239,24 @@ private CompletableFuture<ReplicaResult> processTableAwareRequest(
             ReplicaPrimacy replicaPrimacy,
             UUID senderId
     ) {
-        int tableId = ((TableAware) request).tableId();
-
         return tableAwareReplicaRequestPreProcessor.preProcessTableAwareRequest(request, replicaPrimacy, senderId)
-                .thenCompose(ignored -> replicas.get(tableId).process(request, replicaPrimacy, senderId));
+                .thenCompose(ignored -> {
+                    int tableId = ((TableAware) request).tableId();
+
+                    ReplicaTableProcessor replicaProcessor = replicaProcessors.get(tableId);
+
+                    if (replicaProcessor == null) {
+                        // Most of the times this condition should be false. This logging message is added in case a request got stuck
+                        // somewhere while being replicated and arrived on this node after the target table had been removed. In this case
+                        // we ignore the command, which should be safe to do, because the underlying storage was destroyed anyway.
+                        LOG.warn("Replica processor for table ID {} not found. Command will be ignored: {}", tableId,

Review Comment:
   ok, let's comment this for now



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-24397 Add tests for table removal for colocation [ignite-3]

Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #5568:
URL: https://github.com/apache/ignite-3/pull/5568#discussion_r2028660287


##########
modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerTest.java:
##########
@@ -448,9 +446,9 @@ public void testDropTable() throws Exception {
         assertNull(tableManager.table(DYNAMIC_TABLE_FOR_DROP_NAME));
         assertEquals(0, tableManager.tables().size());
 
-        verify(mvTableStorage, atMost(0)).destroy();
-        verify(txStateStorage, atMost(0)).destroy();
-        verify(replicaMgr, atMost(0)).stopReplica(any());
+        verify(mvTableStorage, never()).destroy();
+        verify(txStateStorage, never()).destroy();
+        verify(replicaMgr, never()).stopReplica(any());

Review Comment:
   Actually, this is not true, because this tx storage is still the per-table storage, which should be destroyed. It will be removed completely for the colocation case.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org