René Cordier created JAMES-3059:
-----------------------------------
Summary: 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
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: [email protected]
For additional commands, e-mail: [email protected]