git-annex/Database
Joey Hess 4fd71c125e
Improve performance when used with a local git remote that has a large working tree
git write-tree was being run once per file git-annex acts on when eg,
getting files, which is slow when the remote repository has a large
tree.

onLocal calls quiesce after each action, and quiesce closes the keys db
since [[!commit ba7ecbc6a9c]]. Which has a relevant comment about
performance. I have not addressed that, the keys db still gets closed and
reopened after each file.

Turns out that, since git write-tree was run by each call to
reconcileStaged, the .git/annex/keysdb.cache value was never the
same as the git index's inode. Because git write-tree updates the index's
mtime even when no changes have been made.

And so, when the database got closed and reopened, reconcileStaged would
see a changed index, and run git write-tree again. Over and over.

I considered writing the index's new inodecache after write-tree to the
keysdb.cache, but that would be vulnerable to a race, if the index was
changed just after write-tree.

The fix was to stop using keysb.cache at all. When the database is closed
and later reopened by the same process, avoid re-doing reconcileStaged.

Now that .git/annex/keysdb.cache is no longer used. It could be removed,
but the time overhead of removing it would be more than the space overhead
of keeping it. Defferred removal to the v11 upgrade.

Sponsored-by: unqueued
2025-09-10 12:08:11 -04:00
..
Keys Improve performance when used with a local git remote that has a large working tree 2025-09-10 12:08:11 -04:00
RepoSize remove stale live changes from reposize database 2024-08-28 13:57:25 -04:00
Benchmark.hs more OsPath conversion 2025-01-29 16:24:51 -04:00
ContentIdentifier.hs test suite now passes after OsPath conversion 2025-02-11 12:44:09 -04:00
Export.hs test suite now passes after OsPath conversion 2025-02-11 12:44:09 -04:00
Fsck.hs test suite now passes after OsPath conversion 2025-02-11 12:44:09 -04:00
Handle.hs more OsPath conversion 2025-01-25 11:56:35 -04:00
ImportFeed.hs test suite now passes after OsPath conversion 2025-02-11 12:44:09 -04:00
Init.hs more OsPath conversion 2025-02-11 14:03:20 -04:00
Keys.hs Improve performance when used with a local git remote that has a large working tree 2025-09-10 12:08:11 -04:00
Queue.hs more OsPath conversion 2025-01-25 11:56:35 -04:00
RawFilePath.hs OsPath build flag no longer depends on filepath-bytestring 2025-02-10 16:39:55 -04:00
RepoSize.hs test suite now passes after OsPath conversion 2025-02-11 12:44:09 -04:00
Types.hs sqlite datbase for importfeed 2023-10-23 16:46:22 -04:00
Utility.hs Sped up sqlite inserts 2x when built with persistent 2.14.5.0 2023-03-31 14:38:25 -04:00