]> git.ipfire.org Git - thirdparty/public-inbox.git/commit
lei/store: auto-commit for long-running imports
authorEric Wong <e@80x24.org>
Fri, 15 Nov 2024 22:23:15 +0000 (22:23 +0000)
committerEric Wong <e@80x24.org>
Sun, 17 Nov 2024 18:54:07 +0000 (18:54 +0000)
commit807abf67e14d35270ed0957590cde0ed1eb68635
tree249b4f3306937cd4ca49266ea4afe73ea55f2cc4
parentf9744675cac27f2c4f40a59b77a87da7e1c3633c
lei/store: auto-commit for long-running imports

DBD::SQLite (not SQLite itself) sets a 30s busy_timeout which we
currently do not override.  This means readers can wait up to
30s for a writer to finish.  For long imports exceeding 30s,
SQLite readers (for deduplication during import) can die with a
"database is locked" message while the lei/store process holds a
long write transaction open.

Forcing commits every 5s ought to fix the problem in most cases,
assuming commits themselves happen in under 25s (which isn't
always true on slow devices).  5 seconds was chosen since it
matches the default commit interval on ext* filesystems and the
vm.dirty_writeback_centisecs sysctl.

Many (but not all) failures around long-running `lei import'
processes.
lib/PublicInbox/LeiStore.pm