You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ro...@apache.org on 2019/05/17 12:25:39 UTC

[james-project] branch master updated (a2a5705 -> 8ca9339)

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

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


    from a2a5705  JAMES-2754 james-server-webadmin-data dependency is not required for external James
     new 9bdf4f0  JAMES-2761 get mailbox capabilities out of the loop on its messages
     new 1a70be1  JAMES-2761 remove dead code in AbstractSelectionProcessor.respond
     new 415ed29  Merge remote-tracking branch 'remk/JAMES-2761'
     new 9d23f84  JAMES-2772 serialize compute new mod seq and update flags using concatMap on the message flux
     new 8ca9339  Merge remote-tracking branch 'remk/JAMES-2772'

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../cassandra/mail/CassandraMessageMapper.java     |  3 +-
 .../imap/processor/AbstractMailboxProcessor.java   | 42 ++++++++++++----------
 .../imap/processor/AbstractSelectionProcessor.java | 18 ++--------
 3 files changed, 27 insertions(+), 36 deletions(-)


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


[james-project] 01/05: JAMES-2761 get mailbox capabilities out of the loop on its messages

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 9bdf4f0c09fd70d1a8e916ad5d762d67544090d3
Author: Rémi Kowalski <rk...@linagora.com>
AuthorDate: Mon May 13 11:22:53 2019 +0200

    JAMES-2761 get mailbox capabilities out of the loop on its messages
---
 .../imap/processor/AbstractMailboxProcessor.java   | 42 ++++++++++++----------
 1 file changed, 23 insertions(+), 19 deletions(-)

diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
index 22d7e17..731a3ac 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
@@ -53,7 +53,6 @@ import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MessageManager;
 import org.apache.james.mailbox.MessageManager.MetaData;
-import org.apache.james.mailbox.MessageManager.MetaData.FetchGroup;
 import org.apache.james.mailbox.MessageUid;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.exception.MessageRangeException;
@@ -202,12 +201,10 @@ public abstract class AbstractMailboxProcessor<M extends ImapRequest> extends Ab
     }
     
     private void addFlagsResponses(ImapSession session, SelectedMailbox selected, ImapProcessor.Responder responder, boolean useUid) {
-       
         try {
-  
             // To be lazily initialized only if needed, which is in minority of cases.
             MessageManager messageManager = null;
-
+            MetaData metaData = null;
             final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
 
             // Check if we need to send a FLAGS and PERMANENTFLAGS response before the FETCH response
@@ -216,48 +213,55 @@ public abstract class AbstractMailboxProcessor<M extends ImapRequest> extends Ab
             if (selected.hasNewApplicableFlags()) {
                 messageManager = getMailbox(session, selected);
                 flags(responder, selected);
-                permanentFlags(responder, messageManager.getMetaData(false, mailboxSession, MessageManager.MetaData.FetchGroup.NO_COUNT), selected);
+                metaData = messageManager.getMetaData(false, mailboxSession, MessageManager.MetaData.FetchGroup.NO_COUNT);
+
+                permanentFlags(responder, metaData, selected);
                 selected.resetNewApplicableFlags();
             }
             
             final Collection<MessageUid> flagUpdateUids = selected.flagUpdateUids();
             if (!flagUpdateUids.isEmpty()) {
                 Iterator<MessageRange> ranges = MessageRange.toRanges(flagUpdateUids).iterator();
+                if (messageManager == null) {
+                    messageManager = getMailbox(session, selected);
+                }
+                if (metaData == null) {
+                    metaData = messageManager.getMetaData(false, mailboxSession, MessageManager.MetaData.FetchGroup.NO_COUNT);
+                }
+                boolean isModSeqPermanent = metaData.isModSeqPermanent();
                 while (ranges.hasNext()) {
-                 if (messageManager == null) {
-                     messageManager = getMailbox(session, selected);
-                 }
-                    addFlagsResponses(session, selected, responder, useUid, ranges.next(), messageManager, mailboxSession);
+                    addFlagsResponses(session, selected, responder, useUid, ranges.next(), messageManager, isModSeqPermanent, mailboxSession);
                 }
-
             }
-            
+
         } catch (MailboxException e) {
             handleResponseException(responder, e, HumanReadableText.FAILURE_TO_LOAD_FLAGS, session);
         }
 
     }
     
-    protected void addFlagsResponses(ImapSession session, SelectedMailbox selected, ImapProcessor.Responder responder, boolean useUid, MessageRange messageSet, MessageManager mailbox, MailboxSession mailboxSession) throws MailboxException {
-
+    private void addFlagsResponses(ImapSession session,
+                                   SelectedMailbox selected,
+                                   ImapProcessor.Responder responder,
+                                   boolean useUid,
+                                   MessageRange messageSet, MessageManager mailbox,
+                                   boolean isModSeqPermanent,
+                                   MailboxSession mailboxSession) throws MailboxException {
         final MessageResultIterator it = mailbox.getMessages(messageSet, FetchGroupImpl.MINIMAL,  mailboxSession);
+        final boolean qresyncEnabled = EnableProcessor.getEnabledCapabilities(session).contains(ImapConstants.SUPPORTS_QRESYNC);
+        final boolean condstoreEnabled = EnableProcessor.getEnabledCapabilities(session).contains(ImapConstants.SUPPORTS_CONDSTORE);
         while (it.hasNext()) {
             MessageResult mr = it.next();
             final MessageUid uid = mr.getUid();
             int msn = selected.msn(uid);
             if (msn == SelectedMailbox.NO_SUCH_MESSAGE) {
                 LOGGER.debug("No message found with uid {} in the uid<->msn mapping for mailbox {}. This may be because it was deleted by a concurrent session. So skip it..", uid, selected.getPath().asString());
-                    
-
                 // skip this as it was not found in the mapping
                 // 
                 // See IMAP-346
                 continue;
             }
 
-            boolean qresyncEnabled = EnableProcessor.getEnabledCapabilities(session).contains(ImapConstants.SUPPORTS_QRESYNC);
-            boolean condstoreEnabled = EnableProcessor.getEnabledCapabilities(session).contains(ImapConstants.SUPPORTS_CONDSTORE);
-
             final Flags flags = mr.getFlags();
             final MessageUid uidOut;
             if (useUid || qresyncEnabled) {
@@ -274,7 +278,7 @@ public abstract class AbstractMailboxProcessor<M extends ImapRequest> extends Ab
             
             // Check if we also need to return the MODSEQ in the response. This is true if CONDSTORE or
             // if QRESYNC was enabled, and the mailbox supports the permant storage of mod-sequences
-            if ((condstoreEnabled || qresyncEnabled) && mailbox.getMetaData(false, mailboxSession, FetchGroup.NO_COUNT).isModSeqPermanent()) {
+            if ((condstoreEnabled || qresyncEnabled) && isModSeqPermanent) {
                 response = new FetchResponse(msn, flags, uidOut, mr.getModSeq(), null, null, null, null, null, null);
             } else {
                 response = new FetchResponse(msn, flags, uidOut, null, null, null, null, null, null, null);


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


[james-project] 05/05: Merge remote-tracking branch 'remk/JAMES-2772'

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 8ca93399c344c612d155d1db8ac19f14a9079b1c
Merge: 415ed29 9d23f84
Author: Raphael Ouazana <ra...@linagora.com>
AuthorDate: Fri May 17 14:25:22 2019 +0200

    Merge remote-tracking branch 'remk/JAMES-2772'

 .../apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java    | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)


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


[james-project] 03/05: JAMES-2772 serialize compute new mod seq and update flags using concatMap on the message flux

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 9d23f8431a92f815b5bc92dcc61fadb4a8dc610d
Author: Rémi Kowalski <rk...@linagora.com>
AuthorDate: Thu May 16 14:17:22 2019 +0200

    JAMES-2772 serialize compute new mod seq and update flags using concatMap on the message flux
---
 .../apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java    | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java
index 7603319..bdbf91b 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java
@@ -319,8 +319,7 @@ public class CassandraMessageMapper implements MessageMapper {
     private Mono<FlagsUpdateStageResult> runUpdateStage(CassandraId mailboxId, Flux<ComposedMessageIdWithMetaData> toBeUpdated, FlagsUpdateCalculator flagsUpdateCalculator) {
         Mono<Long> newModSeq = computeNewModSeq(mailboxId);
         return toBeUpdated
-            .limitRate(1)
-            .flatMapSequential(metadata -> newModSeq.flatMap(modSeq -> tryFlagsUpdate(flagsUpdateCalculator, modSeq, metadata)))
+            .concatMap(metadata -> newModSeq.flatMap(modSeq -> tryFlagsUpdate(flagsUpdateCalculator, modSeq, metadata)))
             .reduce(FlagsUpdateStageResult.none(), FlagsUpdateStageResult::merge)
             .flatMap(result -> updateIndexesForUpdatesResult(mailboxId, result));
     }


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


[james-project] 02/05: JAMES-2761 remove dead code in AbstractSelectionProcessor.respond

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 1a70be10206c330f953acdd3f4aafa2148cdc84b
Author: Rémi Kowalski <rk...@linagora.com>
AuthorDate: Tue May 14 10:09:51 2019 +0200

    JAMES-2761 remove dead code in AbstractSelectionProcessor.respond
---
 .../imap/processor/AbstractSelectionProcessor.java     | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
index d7f0197..0f55716 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
@@ -53,7 +53,6 @@ import org.apache.james.mailbox.exception.MailboxNotFoundException;
 import org.apache.james.mailbox.exception.MessageRangeException;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.model.MessageRange;
-import org.apache.james.mailbox.model.SearchQuery;
 import org.apache.james.metrics.api.MetricFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -115,9 +114,7 @@ abstract class AbstractSelectionProcessor<M extends AbstractMailboxSelectionRequ
             taggedBad(command, tag, responder, HumanReadableText.QRESYNC_NOT_ENABLED);
             return;
         }
-        
-        
-        
+
         final MessageManager.MetaData metaData = selectMailbox(fullMailboxPath, session);
         final SelectedMailbox selected = session.getSelected();
         MessageUid firstUnseen = metaData.getFirstUnseen();
@@ -161,17 +158,14 @@ abstract class AbstractSelectionProcessor<M extends AbstractMailboxSelectionRequ
                 final MailboxManager mailboxManager = getMailboxManager();
                 final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
                 final MessageManager mailbox = mailboxManager.getMailbox(fullMailboxPath, mailboxSession);
-               
-                
+
                 //  If the provided UIDVALIDITY matches that of the selected mailbox, the
                 //  server then checks the last known modification sequence.
                 //
                 //  The server sends the client any pending flag changes (using FETCH
                 //  responses that MUST contain UIDs) and expunges those that have
                 //  occurred in this mailbox since the provided modification sequence.
-                SearchQuery sq = new SearchQuery();
-                sq.andCriteria(SearchQuery.modSeqGreaterThan(request.getKnownModSeq()));
-                
+
                 UidRange[] uidSet = request.getUidSet();
 
                 if (uidSet == null) {
@@ -219,8 +213,6 @@ abstract class AbstractSelectionProcessor<M extends AbstractMailboxSelectionRequ
                                 knownUidsList.add(uid);
                             }
                         }
-                       
-                        
                         
                         // loop over the known sequences and check the UID for MSN X again the known UID X 
                         MessageUid firstUid = MessageUid.MIN_VALUE;
@@ -248,7 +240,6 @@ abstract class AbstractSelectionProcessor<M extends AbstractMailboxSelectionRequ
                                     done = true;
                                     break;
                                 }
-
                             }
 
                             // We found the first uid to start with 
@@ -272,7 +263,6 @@ abstract class AbstractSelectionProcessor<M extends AbstractMailboxSelectionRequ
                             }
                         }
                         
-                        
                     }
                     
                     List<MessageRange> ranges = new ArrayList<>();
@@ -284,8 +274,6 @@ abstract class AbstractSelectionProcessor<M extends AbstractMailboxSelectionRequ
                         }
                     }
                     
-                    
-                    
                     // TODO: Reconsider if we can do something to make the handling better. Maybe at least cache the triplets for the expunged
                     //       while have the server running. This could maybe allow us to not return every expunged message all the time
                     //  


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


[james-project] 04/05: Merge remote-tracking branch 'remk/JAMES-2761'

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 415ed291e0e854d4a30006ff8a560ac21799cc08
Merge: a2a5705 1a70be1
Author: Raphael Ouazana <ra...@linagora.com>
AuthorDate: Fri May 17 14:25:07 2019 +0200

    Merge remote-tracking branch 'remk/JAMES-2761'

 .../imap/processor/AbstractMailboxProcessor.java   | 42 ++++++++++++----------
 .../imap/processor/AbstractSelectionProcessor.java | 18 ++--------
 2 files changed, 26 insertions(+), 34 deletions(-)


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