[ 
https://issues.apache.org/jira/browse/JAMES-3059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17038923#comment-17038923
 ] 

Benoit Tellier commented on JAMES-3059:
---------------------------------------

Code change proposal: https://github.com/linagora/james-project/pull/3119

Current work is limited by the testing strategy (mocking mono to simulate a 
count of failure - a defer is needed to force mono regeneration from "mockito" 
upon retries).

Proposals for alternatives are welcome (and avoid using defer()).

> 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
>
> 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-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to