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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]