Skip to content

fix(storage): the legacy profile migration is not atomic; a partial copy is taken for a finished one #1766

Closed

Description

@ZhuchkaTriplesix

Problem

`AppDataRoot.migrateLegacySupportIfNeeded` skips the migration when `/querya_desktop/querya.db` exists, and `_copyDirectory` copies straight into the final directory in directory-listing order. If the copy stops halfway (disk full, the app is closed, a permission error), `querya.db` may already be there but incomplete. The next start sees it, skips the migration, and opens a truncated database. The order is arbitrary, so the database can also be copied without its `-wal` / `-shm` files.

Fix

Copy into a temporary sibling directory, copy `querya.db` last (with its `-wal`/`-shm` before it, or checkpoint first), then rename into place. Leave the legacy directory untouched. Test: a copy that fails midway leaves no `querya.db` in the new location and the next start migrates again.

Found in the system-functions review (see #1764).

Activity

  1. added
    bug
    stability
    storage
    P2
    on Oct 25, 2026
  2. added a commit that references this issue on Oct 25, 2026
  3. ZhuchkaTriplesix commented on Oct 25, 2026

    @ZhuchkaTriplesix
    MemberAuthor

    Fixed on dev in #1787 (merged). Closing by hand: the PRs target dev, so GitHub would only close this when dev is merged into main.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2bugstabilitystorage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions