Skip to content

SQLite: fsync db.sqlite-shm before opening the database#13826

Merged
roberth merged 1 commit intoNixOS:masterfrom
xokdvium:sqlite-zfs-hack
Aug 25, 2025
Merged

SQLite: fsync db.sqlite-shm before opening the database#13826
roberth merged 1 commit intoNixOS:masterfrom
xokdvium:sqlite-zfs-hack

Conversation

@xokdvium
Copy link
Copy Markdown
Contributor

Motivation

This is a workaround for #13515 (opening the SQLite DB randomly taking a couple of seconds on ZFS).

(cherry picked from commit a7fceb5)

Context

Helps with #13515 and #13515 (comment)


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@xokdvium xokdvium requested a review from roberth August 25, 2025 21:14
@xokdvium xokdvium requested a review from Ericson2314 as a code owner August 25, 2025 21:14
@xokdvium xokdvium added the backport 2.31-maintenance Automatically creates a PR against the branch label Aug 25, 2025
{
// Work around a ZFS issue where SQLite's truncate() call on
// db.sqlite-shm can randomly take up to a few seconds. See
// https://github.com/openzfs/zfs/issues/14290#issuecomment-3074672917.
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.

Suggested change
// https://github.com/openzfs/zfs/issues/14290#issuecomment-3074672917.
// https://github.com/openzfs/zfs/issues/14290#issuecomment-3074672917.
// Remove this workaround when a fix is widely installed, perhaps 2027? Candidate:
// https://github.com/search?q=repo%3Aopenzfs%2Fzfs+%22Linux%3A+zfs_putpage%3A+complete+async+page+writeback+immediately%22&type=commits

idk about their merging / branches / rebasing, so I opted for a search URL

@roberth
Copy link
Copy Markdown
Member

roberth commented Aug 25, 2025

I'm dogfooding this, and it solves the problem!

This is a workaround for NixOS#13515
(opening the SQLite DB randomly taking a couple of seconds on ZFS).

(cherry picked from commit a7fceb5)
@roberth roberth enabled auto-merge August 25, 2025 21:49
@roberth roberth merged commit c1e2396 into NixOS:master Aug 25, 2025
14 checks passed
mergify bot added a commit that referenced this pull request Aug 25, 2025
…3826

SQLite: fsync db.sqlite-shm before opening the database (backport #13826)
@nixos-discourse
Copy link
Copy Markdown

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2025-08-25-nix-team-meeting-minutes-243/68497/1

@xokdvium xokdvium deleted the sqlite-zfs-hack branch October 12, 2025 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 2.31-maintenance Automatically creates a PR against the branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants