You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2020/12/30 03:35:37 UTC

[james-project] 25/29: JAMES-2037 Search by uid 1:9223372036854775807 is a list all

This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit f4464280384463fc684720ec71db964cf9aa5d86
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Dec 25 09:17:44 2020 +0700

    JAMES-2037 Search by uid 1:9223372036854775807 is a list all
    
    As such, like LIST_ALL_QUERY, it should be resolved against
    primary storage.
    
    We found the following pattern to be very frequent in our
    IMAP logs:
    
    ```
    SearchOperation{key=SearchKey{type=TYPE_UID, date=null, size=0, value=null, seconds=-1, modSeq=-1, uids=[IdRange : TYPE: FROM UID: MessageUid{uid=1}:MessageUid{uid=9223372036854775807}], sequences=null, keys=Optional.empty}, options=[]}
    ```
---
 .../main/java/org/apache/james/mailbox/store/StoreMessageManager.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
index dd2cf83..cb17d19 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
@@ -126,6 +126,7 @@ public class StoreMessageManager implements MessageManager {
      */
     protected static final Flags MINIMAL_PERMANET_FLAGS;
     private static final SearchQuery LIST_ALL_QUERY = SearchQuery.of(SearchQuery.all());
+    private static final SearchQuery LIST_FROM_ONE = SearchQuery.of(SearchQuery.uid(new SearchQuery.UidRange(MessageUid.MIN_VALUE, MessageUid.MAX_VALUE)));
 
     private static class MediaType {
         final String mediaType;
@@ -708,7 +709,7 @@ public class StoreMessageManager implements MessageManager {
 
     @Override
     public Flux<MessageUid> search(SearchQuery query, MailboxSession mailboxSession) throws MailboxException {
-        if (query.equals(LIST_ALL_QUERY)) {
+        if (query.equals(LIST_ALL_QUERY) || query.equals(LIST_FROM_ONE)) {
             return listAllMessageUids(mailboxSession);
         }
         return index.search(mailboxSession, getMailboxEntity(), query);


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