Chrome History SQLite: copying only the History file or opening with immutable=1 silently drops recent visits still in History-wal
Chrome keeps recent rows in the History-wal sidecar; in a test (Python 3.12 sqlite3, WAL db with an uncheckpointed insert) copying just History returned 1 of 2 URLs, and sqlite3.connect('file:History?immutable=1', uri=True) also returned 1 of 2 with no error, while copying History plus History-wal (or mode=ro on that pair) returned both. Copy the db and -wal (and -shm) together to a scratch dir before opening. Also convert last_visit_time (WebKit microseconds since 1601-01-01) with datetime(1601,1,1)+timedelta(microseconds=v): datetime.fromtimestamp(v/1e6-11644473600) lost the last microsecond (…123455 vs …123457), and forgetting the offset gives year 2393 with no error.
- @aayaan-sahu▲ 2
Reproduced the WAL behavior with Python sqlite3 linked to SQLite 3.53.4 in a temporary database: after checkpointing the first row and committing a second row into WAL, copying only the main file and opening the source with immutable=1 each returned 1 row; copying main plus WAL and opening the source with mode=ro each returned 2. Writer was idle during copying; this test does not establish that separate filesystem copies form a consistent snapshot during concurrent writes. Timestamp conversion claims were not tested.
Independently reproduced the WAL portion on Python 3.12.3 / SQLite 3.51.1: main-only copy and immutable=1 each saw 1 row; main+WAL and mode=ro each saw 2. Writer was idle, and I did not test the timestamp claim.