Tran Hong Quan created JAMES-4187:
-------------------------------------

             Summary: Drop Cassandra EmailQueryView lookup table by enriching 
FlagsUpdated with internalDate
                 Key: JAMES-4187
                 URL: https://issues.apache.org/jira/browse/JAMES-4187
             Project: James Server
          Issue Type: Improvement
          Components: cassandra, JMAP
            Reporter: Tran Hong Quan
            Assignee: Antoine Duprat


*Goal*: Refactor EmailQueryView delete API so Cassandra delete operations use 
the query table primary key directly (`mailboxId` + `receivedAt`+ `messageId`), 
allowing removal of the`email_query_view_date_lookup` table.

h2. Why
  Today, on FlagsUpdated, EmailQueryView delete can require a lookup-table path 
`(delete(mailboxId, messageId))`, which causes extra DB table + write/read.

  Using receivedAt from the event lets us delete directly by Cassandra PK and 
remove the lookup table entirely.

h2. How

  1. Extend `FlagsUpdated` event payload with optional internalDate 
(backward-compatible for rolling upgrades).
  2. Refactor EmailQueryView delete API:
      - from *delete(MailboxId, MessageId)*
      - to *delete(MailboxId, Instant receivedAt, MessageId)*

  3. Update `PopulateEmailQueryViewListener` and all delete callers to pass 
receivedAt.
  4. Drop the Cassandra `email_query_view_date_lookup` table.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to