Closed Bug 1998267 (SQLite3.51.2) Opened 1 year ago Closed 9 months ago

Upgrade to SQLite 3.51.2

Categories

(Core :: SQLite and Embedded Database Bindings, task, P1)

task

Tracking

()

RESOLVED FIXED
149 Branch
Tracking Status
firefox149 --- fixed

People

(Reporter: RyanVM, Assigned: mak)

References

(Regressed 1 open bug, )

Details

(Keywords: perf-alert)

Attachments

(3 external files)

Version 3.51.0 is a first major update to SQLite since the 25th anniversary release on 2025-05-29. Version 3.51.0 includes new features, new interfaces, and new optimizations.

SQLite Release 3.51.0 On 2025-11-04

  • New macros in sqlite3.h:
    • SQLITE_SCM_BRANCH β†’ the name of the branch from which the source code is taken.
    • SQLITE_SCM_TAGS β†’ space-separated list of tags on the source code check-in.
    • SQLITE_SCM_DATETIME β†’ ISO-8601 date and time of the source code check-in.
  • Two new JSON functions, jsonb_each() and jsonb_tree() work the same as the existing json_each() and json_tree() functions except that they return JSONB for the "value" column when the "type" is 'array' or 'object'.
  • The carray and percentile extensions are now built into the amalgamation, though they are disabled by default and must be activated at compile-time using the -DSQLITE_ENABLE_CARRAY and/or -DSQLITE_ENABLE_PERCENTILE options, respectively.
  • Enhancements to TCL Interface:
    • Add the -asdict flag to the eval command to have it set the row data as a dict instead of an array.
    • User-defined functions may now break to return an SQL NULL.
  • CLI enhancements:
    • Increase the precision of ".timer" to microseconds.
    • Enhance the "box" and "column" formatting modes to deal with double-wide characters.
    • The ".imposter" command provides read-only imposter tables that work with VACUUM and do not require the --unsafe-testing option.
    • Add the --ifexists option to the CLI command-line option and to the .open command.
    • Limit columns widths set by the ".width" command to 30,000 or less, as there is not good reason to have wider columns, but supporting wider columns provides opportunity to malefactors.
  • Performance enhancements:
    • Use fewer CPU cycles to commit a read transaction.
    • Early detection of joins that return no rows due to one or more of the tables containing no rows.
    • Avoid evaluation of scalar subqueries if the result of the subquery does not change the result of the overall expression.
    • Faster window function queries when using "BETWEEN :x FOLLOWING AND :y FOLLOWING" with a large :y.
  • Add the PRAGMA wal_checkpoint=NOOP; command and the SQLITE_CHECKPOINT_NOOP argument for sqlite3_wal_checkpoint_v2().
  • Add the sqlite3_set_errmsg() API for use by extensions.
  • Add the sqlite3_db_status64() API, which works just like the existing sqlite3_db_status() API except that it returns 64-bit results.
  • Add the SQLITE_DBSTATUS_TEMPBUF_SPILL option to the sqlite3_db_status() and sqlite3_db_status64() interfaces.
  • In the session extension add the sqlite3changeset_apply_v3() interface.
  • For the built-in printf() and the format() SQL function, omit the leading '-' from negative floating point numbers if the '+' flag is omitted and the "#" flag is present and all displayed digits are '0'. Use '%#f' or similar to avoid outputs like '-0.00' and instead show just '0.00'.
  • Improved error messages generated by FTS5.
  • Enforce STRICT typing on computed columns.
  • Improved support for VxWorks
  • JavaScript/WASM now supports 64-bit WASM. The canonical builds continue to be 32-bit but creating one's own 64-bit build is now as simple as running "make".
  • Improved resistance to database corruption caused by an application breaking Posix advisory locks using close().

Looks like carray.c got a pretty significant overhaul in this release. Also, carray.h is missing from the prepackaged sources, causing ./mach vendor to break. Obviously I can remove the carray.h move-file action in moz.yaml, but it seems likely we're going to need more extensive changes than that. Can you please take a look, Marco?

Flags: needinfo?(mak)

Ah, it looks like it was brought directly into the amalgamation now?

yes, carray is in the amalgamation and must be enabled through a flag. We were already building it as a static extension, so this should be easier, but we need a few changes for the build.
I'll look into that.

Assignee: ryanvm → mak
Severity: -- → N/A
Status: NEW → ASSIGNED
Flags: needinfo?(mak)
Priority: -- → P1

The carray extension is now part of the amalgamation.

Still awaiting for results with the patches https://treeherder.mozilla.org/jobs?repo=try&revision=cc694d75e2c5bedd149b600fc4ede7abfdbc903b
Will update if necessary.

Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 147 Branch
Regressions: 1999921

As mentioned at the end of https://bugzilla.mozilla.org/show_bug.cgi?id=1999921#c9 based on links provided by :janv and additional re-triggers to help confirm this before wpt14 for IndexedDB WPT on Android is fine but these after wpt14's are having a horrible horrible horrible day which seems to deterministically be the result of the upgrade.

This should be backed out and I'll ask sheriffs for help on that now in matrix.

Pushed by chorotan@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/24531c8fa553 https://hg.mozilla.org/integration/autoland/rev/dfe8430bc2c9 Revert "Bug 1998267 - Fix compilation of the carray SQLite extension. r=RyanVM,asuth" on request for causing Bug 1999921
Status: RESOLVED → REOPENED
Flags: needinfo?(mak)
Resolution: FIXED → ---
Target Milestone: 147 Branch → ---
Depends on: 2000865

(In reply to Cristina Horotan [:chorotan] from comment #12)

Backed out here: https://hg.mozilla.org/integration/autoland/rev/dfe8430bc2c923fef067a7a06a5174d67a39372b for causing multiple failures on Bug 1999921

Perfherder has detected a browsertime performance change from push dfe8430bc2c923fef067a7a06a5174d67a39372b.

No action is required from the author; this comment is provided for informational purposes only.

Regressions:

Ratio Test Platform Options Absolute values (old vs new) Performance Profiles
6% idb-open-many-seq open_duration windows11-64-24h2-shippable fission webrender 6,477.64 -> 6,850.67 Before/After
6% idb-open-many-seq time_duration windows11-64-24h2-shippable fission webrender 6,485.58 -> 6,858.38 Before/After

Need Help or Information?

If you have any questions, please reach out to fbilt@mozilla.com. Alternatively, you can find help on Slack by joining #perf-help, and on Matrix you can find help by joining #perftest.

Details of the alert can be found in the alert summary, including links to graphs and comparisons for each of the affected tests.

Keywords: perf-alert

Interesting. So I wonder if bug 2000865 is just pointing to a general IDB slowdown from this update exacerbated on slower platforms like Android.

It would be good to know whether there was actually a perf alert indicating an improvement after the upgrade, or perhaps we should wait a bit and see how the metric looks in the coming days or weeks.

But it could also be that the newer SQLite is faster in some cases. In any case, that’s something we should probably investigate after the regressions are resolved?

Oh right, the regression in comment 13 was on the backout (and the graph does show an improvement around the time it landed too).

There's a few "Performance enhancements" in the update notes, that are likely to shift some of the timings.
There's not much to investigate out of the perf notifications we got, I mean it's nice to know this update may improve perf in some cases, and the backout shows they are real.
But we're still blocked on actual test failures in bug 2000865.

Flags: needinfo?(mak)
Blocks: 2002569

Changes in this specific patch release, version 3.51.1 (2025-11-28)

  • Fix incorrect results from nested EXISTS queries caused by the optimization in item 6b in the 3.51.0 release.
  • Fix a latent bug in fts5vocab virtual table, exposed by new optimizations in the 3.51.0 release

No change in Try results. However, D271612 needs updating to address a newly-added linter check looking for unused includes:

TEST-UNEXPECTED-ERROR | /builds/worker/checkouts/gecko/toolkit/xre/AutoSQLiteLifetime.cpp:X | /builds/worker/checkouts/gecko/toolkit/xre/AutoSQLiteLifetime.cpp includes DebugOnly.h but does not reference any of its API (includes)

Alias: SQLite3.51.0 → SQLite3.51.1
Summary: Upgrade to SQLite 3.51.0 → Upgrade to SQLite 3.51.1

Changes in this specific patch release, version 3.51.2 (2026-01-09):

  • Fix an obscure deadlock in the new broken-posix-lock detection logic in item 17 above.
  • Fix multiple problems in the EXISTS-to-JOIN optimization that was added as part of optimization item 6b above.
  • Other minor bug fixes.
Alias: SQLite3.51.1 → SQLite3.51.2
Summary: Upgrade to SQLite 3.51.1 → Upgrade to SQLite 3.51.2
Attachment #9525075 - Attachment description: Bug 1998267 - Upgrade to SQLite 3.51.0. r=ryanvm → Bug 1998267 - Upgrade to SQLite 3.51.2. r=ryanvm

We're bringing on the discussion in Bug 2000865 for the idb failures.

I'll try landing 3.51.2.
Try runs show the fixes in 3.51.2 solved the indexeddb issue.
I also pushed 3.51.1 to Try again to check if we had fixed something on our side in the meanwhile, and it still showed failures in idb tests.
Also Ryan made independent Try pushes and they didn't show any failures in idb tests.

PS: There may be a 3.51.3 shortly, though the fixes are not relevant to us

Status: REOPENED → RESOLVED
Closed: 1 year ago → 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → 149 Branch
Regressions: 2016438
QA Whiteboard: [qa-triage-done-c150/b149]
Blocks: SQLite3.53.0
Depends on: SQLite3.51.3
No longer blocks: SQLite3.53.0
Blocks: SQLite3.51.3
No longer depends on: SQLite3.51.3
Regressions: 2044020
Regressions: 2052152
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: