Skip to content

docs(technical-design): global database - #11472

Merged
wmontwe merged 6 commits into
thunderbird:mainfrom
wmontwe:docs-technical-design-global-database
Sep 4, 2026
Merged

docs(technical-design): global database#11472
wmontwe merged 6 commits into
thunderbird:mainfrom
wmontwe:docs-technical-design-global-database

Conversation

@wmontwe

@wmontwe wmontwe commented Aug 31, 2026

Copy link
Copy Markdown
Member

Contribution Summary

Linked Issue/Ticket: resolves #11293
RFC / Technical Design (if applicable): #11104

Description

Technical design for the Global Database

AI Disclosure

Select one of the following (mandatory)

  • This contribution does not include any changes created or assisted by AI.
  • This contribution includes changes assisted by AI. -> proof read the technical design and suggested edits
  • This contribution includes changes created by AI.

@wmontwe
wmontwe requested a review from a team as a code owner August 31, 2026 16:05
@wmontwe
wmontwe requested a review from dani-zilla August 31, 2026 16:05
@wmontwe
wmontwe deployed to botmobile August 31, 2026 16:05 — with GitHub Actions Active
@wmontwe
wmontwe deployed to botmobile August 31, 2026 16:05 — with GitHub Actions Active
@github-actions github-actions Bot added the tb-team Tasks and features handled by project maintainers label Aug 31, 2026
@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Validation Passed: All report and feature-flag labels are correctly set.

@wmontwe wmontwe added pr: stacked Must be used on a PR that is stacked on top of other(s) report: include Include changes in user-facing reports. labels Aug 31, 2026
@wmontwe
wmontwe requested a review from rafaeltonholo August 31, 2026 16:13
@wmontwe
wmontwe deployed to botmobile August 31, 2026 16:13 — with GitHub Actions Active
@wmontwe wmontwe changed the title Docs technical design global database docs(technical-design): global database Aug 31, 2026
- **The global mail database** owns the legacy-compatible mail schema, migration metadata, and derived data.
It is one physical database for the application, not one database per account.
- **The attachment store** remains file-backed for content that legacy already held on disk, which is every body part
above a size threshold. Parts at or below it stay `message_parts` BLOBs, as in legacy. Database records and attachment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parts at or below it stay message_parts BLOBs, as in legacy.

I wonder what the benefits are of having two sources for attachments. Why not store everything as files on disk instead of storing them as BLOBs in the database?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to keep the existing behavior, if it's not too much work, the migration could change that too, but adds complexity.

- Technical design: [Global Database](../technical-designs/0003-global-database.md)
- Repository pattern: [ADR 0010 proposal](https://github.com/thunderbird/thunderbird-android/pull/11452)
- Portable data format: [RFC 0008: Portable Profile Data Format](0008-portable-profile-data-format.md)
- Status: **Proposed**

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a stacked PR, and this PR will only be merged once the #11471 is reviewed and accepted, you could change the Status here to accepted.

downloaded attachments. Legacy keeps a body part on disk above a size threshold and as a `message_parts` BLOB at or
below it. The migration preserves that split rather than changing where content lives.

## Migration

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to ensure that the migration process can take place even when the app is running in the background. Users with large email accounts may require minutes or even hours to migrate all their data.

It's important to recognize that we cannot rely on users to keep the app in the foreground while the migration is occurring.

I recommend starting the migration process as a data synchronization foreground service. This will notify the user when the migration is complete, and we can keep the progress updated through a persistent notification.

If the user remains in the app while the migration is ongoing, the screen should continuously update to reflect the migration's progress. However, if the user switches to the background or closes the app, we must ensure that the migration continues to run until it is fully completed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a section for that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Along with that, I'd say we want to figure out when we'll tell users to update. Perhaps we can run a few tests of our own and figure out, in general, how long a transfer might take on a midrange device. Obviously it would be hard to predict this with any accuracy unless we test on a great deal of different hardware and DB sizes, but we may be able to tell them something like, "This migration could take an hour, would you prefer to be reminded tonight?"
The goal would be that users never notice the down time. They tap the notification we may send them at a chosen time, go to bed, and wake up to their app using the new database with the report and success message.
I don't think this needs to be detailed here, necessarily, but we should consider a possible stretch goal of scheduling the upgrade so it can happen when the user isn't going to be using the app.

@wmontwe
wmontwe force-pushed the docs-technical-design-global-database branch 2 times, most recently from a7b52e1 to 89217a9 Compare September 2, 2026 13:37
@wmontwe wmontwe removed the pr: stacked Must be used on a PR that is stacked on top of other(s) label Sep 3, 2026
… model

(cherry picked from commit db3649d9706e78f6d2c982f4e63f7e6c6070a70c)
…covery, and cleanup procedures for migration

(cherry picked from commit b54d7166bbcc4e63e180b75d319b3c38ece713ae)
…l database migration

(cherry picked from commit 65b1fb8058e6c4242155d4bd50d8c41094b8a1ab)
@wmontwe
wmontwe force-pushed the docs-technical-design-global-database branch from 89217a9 to a787446 Compare September 3, 2026 09:21
downloaded attachments. Legacy keeps a body part on disk above a size threshold and as a `message_parts` BLOB at or
below it. The migration preserves that split rather than changing where content lives.

## Migration

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Along with that, I'd say we want to figure out when we'll tell users to update. Perhaps we can run a few tests of our own and figure out, in general, how long a transfer might take on a midrange device. Obviously it would be hard to predict this with any accuracy unless we test on a great deal of different hardware and DB sizes, but we may be able to tell them something like, "This migration could take an hour, would you prefer to be reminded tonight?"
The goal would be that users never notice the down time. They tap the notification we may send them at a chosen time, go to bed, and wake up to their app using the new database with the report and success message.
I don't think this needs to be detailed here, necessarily, but we should consider a possible stretch goal of scheduling the upgrade so it can happen when the user isn't going to be using the app.

data, SQLite transaction and temporary-file growth, and a safety margin. If an RFC 0008 archive is written to the same
volume, its estimated size is also included.

Migration starts only when available space on the target volume meets the calculated headroom. If it does not, the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to inform users who can't do the update not to upgrade to a newer version of the app and turn off auto-update until they can. I doubt we'd have many users who could not transfer their database over but also have auto update turned on, a feature that could increase the storage space used, but it's still perhaps worth mentioning to users who can't update the DB due to storage space.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this to #11468

@wmontwe
wmontwe merged commit b6ccb4c into thunderbird:main Sep 4, 2026
5 checks passed
@wmontwe
wmontwe deleted the docs-technical-design-global-database branch September 4, 2026 08:45
@thunderbird-botmobile thunderbird-botmobile Bot added this to the Thunderbird 25 milestone Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

report: include Include changes in user-facing reports. tb-team Tasks and features handled by project maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Global Database 0.1.3 - Write technical design

3 participants