{
  "slug": "sqlite-online-backup",
  "term": "SQLite Online Backup API",
  "aliases": [
    "SQLite backup API",
    "sqlite3_backup"
  ],
  "definition": "The SQLite Online Backup API copies one named database between distinct connections using an explicit initialization, page-copy and cleanup sequence.",
  "note": "A step returning SQLITE_OK leaves pages to copy; SQLITE_DONE marks completion. Finishing early rolls back an active destination transaction, yet finish can return SQLITE_OK. Keep completion evidence separate from cleanup status. [api]\n\nIn a four-case experiment on SQLite 3.45.1, no-step and partial-copy abandonment both ended with SQLITE_OK while preserving old destination rows. All four reopened destinations passed integrity_check and had equal row counts; only the completed case matched the source. [experiment]\n\nThe lock-abandonment case returned SQLITE_BUSY from both step and finish. This matches the version-pinned implementation but differs from the API prose about transient lock results. It is a build-scoped observation, not a corruption claim. [implementation] [api]",
  "related": [
    "backup",
    "backup-verification",
    "restore-test",
    "sqlite-wal-end-mark",
    "rollback-journal",
    "snapshot",
    "sqlite-rowid",
    "sqlite-autoincrement"
  ],
  "citations": [
    {
      "id": "api",
      "title": "SQLite C API: Online Backup API.",
      "url": "https://www.sqlite.org/c3ref/backup_finish.html",
      "accessed": "2026-10-17"
    },
    {
      "id": "guide",
      "title": "SQLite: Using the Online Backup API.",
      "url": "https://www.sqlite.org/backup.html",
      "accessed": "2026-10-17"
    },
    {
      "id": "implementation",
      "title": "SQLite version-3.45.1: backup.c, step status and finish return.",
      "url": "https://github.com/sqlite/sqlite/blob/version-3.45.1/src/backup.c",
      "accessed": "2026-10-17"
    },
    {
      "id": "experiment",
      "title": "Hesela: SQLite lock-abandonment experiment and controls.",
      "url": "https://hesela.com/analyses/backup-verification-is-not-a-restore-test/#sqlite-lock-abandonment",
      "accessed": "2026-10-17"
    },
    {
      "id": "receipt",
      "title": "Hesela: native API experiment receipt and runtime identity.",
      "url": "https://hesela.dev/research/sqlite-backup-abandonment.json",
      "accessed": "2026-10-17"
    }
  ],
  "provenance": [
    "Constructed data; native C API calls through Python ctypes. Full build identity and hashes are in the receipt. [receipt]",
    "The experiment tests controlled abandonment, not process crashes, power failures, whole-application recovery or source freshness."
  ],
  "status": "shipping",
  "advantages": [],
  "limitations": [],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-10-18"
}
