Commit Graph
1 Commits
Author SHA1 Message Date
Lauri Ojansivu 804004e9e8 Snap: comparing the two databases reads the one that is already running.
`snap run wekan.database-compare` answered "MongoDB: <unreadable>" and
"FerretDB: <unreadable>" on a live instance whose wekan.sqlite was 85 MB and
whose site was up at the time.

FerretDB was unreadable BECAUSE it was up: SQLite has one writer, so the second
FerretDB the comparison started against the same directory did not get the data.
The tool then reported the database it had been talking to all along as
unreadable, and refused to choose.

The live one is asked first now - `db-eval evidence` only counts and sorts - and
a second copy is started only for a database that is not running. Both speak the
MongoDB wire protocol on the same port, so which one is answering is asked
rather than assumed: `db-eval kind` reads buildInfo, where FerretDB names itself
and a mongod does not. Reading one as the other would be a wrong answer given
with confidence, which is worse than "unreadable".

database-compare is autopick with --dry-run, so the automatic choice at startup
and the command an admin runs by hand both get it.

tests/snapCompareReadsLiveDatabase.test.cjs pins all of it.

Thanks to waltermhl and xet7 !

#6583 comment 5291730920
2026-08-14 13:50:19 +03:00