Skip to content

Update sqlite optimize flags to match Firefox Desktop#7485

Open
shawnz wants to merge 1 commit into
mozilla:mainfrom
shawnz:shawnz/optimize-mask
Open

Update sqlite optimize flags to match Firefox Desktop#7485
shawnz wants to merge 1 commit into
mozilla:mainfrom
shawnz:shawnz/optimize-mask

Conversation

@shawnz

@shawnz shawnz commented Jul 20, 2026

Copy link
Copy Markdown

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 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!

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