Arsnael commented on code in PR #2792:
URL: https://github.com/apache/james-project/pull/2792#discussion_r2318484593


##########
server/data/data-jmap-cassandra/src/main/java/org/apache/james/jmap/cassandra/projections/CassandraEmailQueryView.java:
##########
@@ -181,11 +227,17 @@ public CassandraEmailQueryView(CqlSession session) {
     public Flux<MessageId> listMailboxContentSortedBySentAt(MailboxId 
mailboxId, Limit limit, boolean collapseThreads) {
         Preconditions.checkArgument(!limit.isUnlimited(), "Limit should be 
defined");
 
+        Limit limitFetch = defineLimitFetch(limit, collapseThreads);

Review Comment:
   Cassandra is defo trickier :)
   
   I'm not sure here...
   I've been thinking quite a lot, this is a proposition among others. I feel 
like looping on cassandra requests until we meet the limit for collapseThreads 
would complexify greatly the code and for not such a great gain (more costly in 
perf too).
   
   I thought:
   - or we do like some requests that need to be post-sorted, just fetch all 
records, then collapsing threads and take the limit
   - or we fetch an upper limit (here 3 times the limit defined) and we 
collapse threads and then take up to the limit. We accept that maybe sometimes 
we could have a bit less than the limit (hopefully rare enough) but it should 
stay balanced in terms of perf and keep the code relatively simple.
   
   I tried to look at paging too but that would complexify a lot the code as 
well I believe (like looping).
   
   Well brain storming welcomed honestly



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to