components/sqlite_migration_vfs)This component provides a Virtual File System (VFS) and supporting primitives for online SQLite database migration in Chromium.
Filesystem operations heavily favor sequential, contiguous I/O. Instead of tracking migration status on individual database pages, database migration operates on contiguous 64-page blocks (Block).
Migrating contiguous blocks reduces disk seeks, simplifies progress tracking, and ensures predictable I/O patterns.
PageMigrationTrackerPageMigrationTracker is an in-memory, thread-safe tracker that manages the migration state across a database's pages.
The public interface provides only the exact methods needed by the two operational paths:
xRead / xWrite)IsMigrated(page):xWrite to decide whether to write to the source only (not yet migrated) or double-write to both databases (already migrated).xRead to decide whether to perform optional double-read verification.page > total_pages_ (pages allocated after migration started), returns true so new pages are immediately double-written.page >= 1 (SQLite pages are 1-based).xWrite during in-flight block migration without blocking. Introduce a needs_migration_retry flag set by xWrite when touching an active block, followed by a post-migration retry pass and full read-through comparison before handover.GetNextBlockToMigrateAndLockIt(previous_block):previous_block if provided, wrapping around if needed), acquires its lock, and returns the Block (containing start_page and end_page).std::nullopt when all blocks have been migrated or are in-flight.MarkMigrationAsCompletedAndUnlockIt(Block, result):result == BlockMigrationResult::kSuccess, increments the completion counter, and releases the block's lock.kReadError, kWriteError, or kEncryptionError) to release the lock without marking the block as migrated.IsMigrationComplete():