[jira] [Closed] (JAMES-4187) Drop Cassandra EmailQueryView lookup table by enriching FlagsUpdated with internalDate

"Benoit Tellier (Jira)" <[email protected]> Fri, 13 Mar 2026 21:33:00 +0000 (UTC)
Newsgroups gmane.comp.jakarta.james.devel
Message-ID <[email protected]>
     [ https://issues.apache.org/jira/browse/JAMES-4187?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benoit Tellier closed JAMES-4187.
---------------------------------
    Resolution: Fixed

This work is merged

> 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
>            Priority: Minor
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> *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)