Skip to content

Update sqlite optimize flags to match Firefox Desktop#7485

Merged
mhammond merged 2 commits into
mozilla:mainfrom
shawnz:shawnz/optimize-mask
Jul 23, 2026
Merged

Update sqlite optimize flags to match Firefox Desktop#7485
mhammond merged 2 commits into
mozilla:mainfrom
shawnz:shawnz/optimize-mask

Conversation

@shawnz

@shawnz shawnz commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

This PR aims to address cause 1 identified in bug https://bugzilla.mozilla.org/show_bug.cgi?id=2056115, alongside #7484 which addressed cause 2.

For the run_maintenance_optimize background task, we add the 0x10000 flag in addition to the default 0x12. This causes optimization of all tables even if they were never queried by the provided connection. This fixes a rare scenario where Firefox for Android can get stuck with incorrect table stats on the moz_origins table, leading to poor address bar autocomplete performance.

For the Drop implementation on PlacesDb, we add the now-default flag 0x10, which previously didn't exist, and was being explicitly overridden in the current implementation. This adds a row limit on analyze which can help to prevent poor shutdown performance, matching the change made in the fix for bug https://bugzilla.mozilla.org/show_bug.cgi?id=2017227.

I used Claude to assist with this investigation, and also this is my first contribution to a Mozilla project. So this change may warrant some scruitiny from those more experienced with the codebase. But to the best of my knowledge, it seems to be a positive change which helps in part to address the original issue I faced.

Thanks, Shawn

Pull Request checklist

  • Breaking changes: This PR follows our breaking change policy
    • This PR follows the breaking change policy:
      • This PR has no breaking API changes, or
      • There are corresponding PRs for our consumer applications that resolve the breaking changes and have been approved
  • Quality: This PR builds and tests run cleanly
    • Note:
      • For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
      • If this pull request includes a breaking change, consider cutting a new release after merging.
  • Tests: This PR includes thorough tests or an explanation of why it does not
    • No tests added: this codepath wasn't tested before and I think is out of scope for us to test. It's an sqlite feature and should be tested in the sqlite codebase.
  • Changelog: This PR includes a changelog entry in CHANGELOG.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
    • No changelog entry: Not a user-facing change and historically changes around this part of the code didn't get changelog entries.
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due diligence applied in selecting them.

For the run_maintenance_optimize background task, we add the 0x10000 flag in addition to the default 0x12. This causes optimization of all tables even if they were never queried by the provided connection. This fixes a rare scenario where Firefox for Android can get stuck with incorrect table stats on the moz_origins table, leading to poor address bar autocomplete performance.

For the Drop implementation on PlacesDb, we add the now-default flag 0x10, which previously didn't exist, and was being explicitly overridden in the current implementation. This adds a row limit on analyze which can help to prevent poor shutdown performance, matching the change made in the fix for bug 2017227.
mhammond
mhammond previously approved these changes Jul 20, 2026

@mhammond mhammond left a comment

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.

This looks great, thanks!

@mergify
mergify Bot dismissed mhammond’s stale review July 22, 2026 23:23

The pull request has been modified, dismissing previous reviews.

@mhammond
mhammond added this pull request to the merge queue Jul 22, 2026
@shawnz

shawnz commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Just checking: do I need to do anything more here? I.e trigger the tests or merge manually?

Merged via the queue into mozilla:main with commit b5f89b3 Jul 23, 2026
14 checks passed
@mhammond

Copy link
Copy Markdown
Member

thanks! I thought I queued it a few days ago and not sure what happened, so did it again and it's all merged - thanks!

@shawnz

shawnz commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

there was a github API incident when I first posted this, perhaps that jammed things up. regardless, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants