prosgarz35 opened a new pull request, #3202:
URL: https://github.com/apache/james-project/pull/3202

       ### Rationale & Context
   
       Currently, in `PostgresMessageMapper.addReactive`, 
`setNewUidAndModSeq(message)` was invoked before calling 
`saveBodyContent(message)`.
       `setNewUidAndModSeq` immediately commits an increment to 
`mailbox_last_uid` and `mailbox_highest_modseq` in PostgreSQL.
   
       If the subsequent external blob storage save fails (e.g. S3 timeout, 
transient disk failure, quota exceeded), the operation terminates with an 
error, but the allocated UID/ModSeq in PostgreSQL has already been committed. 
This
     creates gaps in the mailbox UID sequence (`UID gap`), which may cause 
strict IMAP clients to report synchronization issues or trigger cache 
invalidation.
   
       Furthermore, `move` and `move(Mailbox, List<MailboxMessage>)` in 
`PostgresMessageMapper` contained redundant blocking overrides when default 
reactive implementations in `MessageMapper` already handle batch moves cleanly.
   
       ### Changes
   
       1. **Reorder storage steps in `PostgresMessageMapper.addReactive`**:
          - Save body content to `BlobStore` *first*.
          - Only allocate and increment `UID`/`ModSeq` once blob persistence 
succeeds.
          - If blob upload fails, no UID gaps or database modifications are 
left behind.
       2. **Clean up `move` contract in `PostgresMessageMapper`**:
          - Delegate single-message blocking `move` via 
`MailboxReactorUtils.block(moveReactive(mailbox, original))`.
          - Remove redundant `move(Mailbox, List<MailboxMessage>)` override to 
let the default interface method handle batch processing reactively.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to