You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by GitBox <gi...@apache.org> on 2021/06/15 10:46:15 UTC

[GitHub] [james-project] Arsnael commented on a change in pull request #498: JAMES-3601 Piggy back content cleaning upon browse start update

Arsnael commented on a change in pull request #498:
URL: https://github.com/apache/james-project/pull/498#discussion_r651619305



##########
File path: server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/CassandraMailQueueViewModule.java
##########
@@ -120,6 +127,15 @@
             .addPartitionKey(BrowseStartTable.QUEUE_NAME, text())
             .addColumn(BrowseStartTable.BROWSE_START, timestamp()))
 
+        .table(ContentStartTable.TABLE_NAME)
+        .comment("this table allows to find the starting point of content from the table: "
+            + EnqueuedMailsTable.TABLE_NAME + " in order to make a browse operations through mail queues. Strictly " +

Review comment:
       ```suggestion
               + EnqueuedMailsTable.TABLE_NAME + " in order to make a browse operation through mail queues. Strictly " +
   ```

##########
File path: server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/CassandraMailQueueViewModule.java
##########
@@ -120,6 +127,15 @@
             .addPartitionKey(BrowseStartTable.QUEUE_NAME, text())
             .addColumn(BrowseStartTable.BROWSE_START, timestamp()))
 
+        .table(ContentStartTable.TABLE_NAME)
+        .comment("this table allows to find the starting point of content from the table: "
+            + EnqueuedMailsTable.TABLE_NAME + " in order to make a browse operations through mail queues. Strictly " +
+            "before browse start, it enables aueue cleanup.")

Review comment:
       ```suggestion
               "before browse start, it enables queue cleanup.")
   ```

##########
File path: server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQMailQueueTest.java
##########
@@ -288,6 +292,51 @@ void browseAndDequeueShouldCombineWellWhenDifferentSlices() throws Exception {
                 .containsExactly("3-4", "3-5", "5-1", "5-2", "5-3", "5-4", "5-5");
         }
 
+        @Test
+        void enqueuedEmailsShouldEventuallyBeCleaned() {
+            ManageableMailQueue mailQueue = getManageableMailQueue();
+            int emailCount = 5;
+
+            clock.setInstant(IN_SLICE_1);
+            enqueueSomeMails(namePatternForSlice(1), emailCount);
+
+            clock.setInstant(IN_SLICE_2);
+            enqueueSomeMails(namePatternForSlice(2), emailCount);
+
+            clock.setInstant(IN_SLICE_3);
+            enqueueSomeMails(namePatternForSlice(3), emailCount);
+
+            clock.setInstant(IN_SLICE_5);
+            enqueueSomeMails(namePatternForSlice(5), emailCount);
+
+            clock.setInstant(IN_SLICE_7);
+            dequeueMails(5);
+            dequeueMails(5);
+            dequeueMails(5);
+            dequeueMails(5);
+
+            // ensure slice 1 was cleaned
+            EnqueuedMailsDAO mailsDAO = new EnqueuedMailsDAO(cassandraCluster.getCassandraCluster().getConf(), new HashBlobId.Factory());
+            MailQueueName queueName = MailQueueName.fromString(mailQueue.getName().asString());
+            Slice slice = Slice.of(Instant.parse("2007-12-03T10:15:00.00Z")).allSlicesTill(IN_SLICE_2, ONE_HOUR_SLICE_WINDOW).findFirst()

Review comment:
       ```suggestion
               Slice slice = Slice.of(IN_SLICE_1).allSlicesTill(IN_SLICE_2, ONE_HOUR_SLICE_WINDOW).findFirst()
   ```

##########
File path: server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/EnqueuedMailsDaoTest.java
##########
@@ -148,4 +148,43 @@ void selectEnqueuedMailsShouldWork() throws Exception {
                 });
             });
     }
+
+    @Test
+    void selectShouldNotRemoveDeletedSlice() throws Exception {

Review comment:
       I don't think the test name is correct 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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org