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 "René Cordier (Jira)" <se...@james.apache.org> on 2020/02/28 03:17:00 UTC

[jira] [Closed] (JAMES-3059) Retry on step 2 (if fail) of mailbox creation

     [ https://issues.apache.org/jira/browse/JAMES-3059?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

René Cordier closed JAMES-3059.
-------------------------------
    Fix Version/s: 3.5.0
       Resolution: Done

> Retry on step 2 (if fail) of mailbox creation
> ---------------------------------------------
>
>                 Key: JAMES-3059
>                 URL: https://issues.apache.org/jira/browse/JAMES-3059
>             Project: James Server
>          Issue Type: Improvement
>          Components: mailbox
>            Reporter: René Cordier
>            Priority: Major
>             Fix For: 3.5.0
>
>
> Mailbox creation method in `CassandraMailboxMapper`:
> {code:java}
>     private boolean trySave(Mailbox cassandraMailbox, CassandraId cassandraId) {
>         boolean isCreated = mailboxPathV2DAO.save(cassandraMailbox.generateAssociatedPath(), cassandraId).block();
>         if (isCreated) {
>             Optional<Mailbox> simpleMailbox = retrieveMailbox(cassandraId).blockOptional();
>             simpleMailbox.ifPresent(mbx -> mailboxPathV2DAO.delete(mbx.generateAssociatedPath()).block());
>             mailboxDAO.save(cassandraMailbox).block();
>         }
>         return isCreated;
>     }
> {code}
> Shortly:
> 1. Persisting a mailboxPath
> 2. Persisting a mailbox.
> There's should be a case: after step 1 finishes, step 2 fails, it leads to the mailboxPath & mailbox inconsistent. To avoid this, you can perform retry on the step 2 to reduce the chance producing inconsistent.
> *DOD*: update the code, write unit tests to prove it `reduce the chance producing inconsistent` 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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