git-annex/Build
Joey Hess ba7ecbc6a9
avoid flushing keys db queue after each Annex action
The flush was only done Annex.run' to make sure that the queue was flushed
before git-annex exits. But, doing it there means that as soon as one
change gets queued, it gets flushed soon after, which contributes to
excessive writes to the database, slowing git-annex down.
(This does not yet speed git-annex up, but it is a stepping stone to
doing so.)

Database queues do not autoflush when garbage collected, so have to
be flushed explicitly. I don't think it's possible to make them
autoflush (except perhaps if git-annex sqitched to using ResourceT..).
The comment in Database.Keys.closeDb used to be accurate, since the
automatic flushing did mean that all writes reached the database even
when closeDb was not called. But now, closeDb or flushDb needs to be
called before stopping using an Annex state. So, removed that comment.

In Remote.Git, change to using quiesce everywhere that it used to use
stopCoProcesses. This means that uses on onLocal in there are just as
slow as before. I considered only calling closeDb on the local git remotes
when git-annex exits. But, the reason that Remote.Git calls stopCoProcesses
in each onLocal is so as not to leave git processes running that have files
open on the remote repo, when it's on removable media. So, it seemed to make
sense to also closeDb after each one, since sqlite may also keep files
open. Although that has not seemed to cause problems with removable
media so far. It was also just easier to quiesce in each onLocal than
once at the end. This does likely leave performance on the floor, so
could be revisited.

In Annex.Content.saveState, there was no reason to close the db,
flushing it is enough.

The rest of the changes are from auditing for Annex.new, and making
sure that quiesce is called, after any action that might possibly need
it.

After that audit, I'm pretty sure that the change to Annex.run' is
safe. The only concern might be that this does let more changes get
queued for write to the db, and if git-annex is interrupted, those will be
lost. But interrupting git-annex can obviously already prevent it from
writing the most recent change to the db, so it must recover from such
lost data... right?

Sponsored-by: Dartmouth College's Datalad project
2022-10-12 14:12:23 -04:00
..
BuildVersion.hs type signature 2018-08-04 14:21:30 -04:00
BundledPrograms.hs include libmagic in windows installer 2020-10-26 13:24:37 -04:00
collect-ghc-options.sh Makefile: Pass LDFLAGS, CFLAGS, and CPPFLAGS through ghc and on to ld, cc, and cpp. 2015-08-19 13:53:57 -04:00
Configure.hs test borg special remote 2021-09-03 13:18:07 -04:00
DesktopFile.hs got configure working after Utility.Path ByteString conversion 2020-10-28 15:01:19 -04:00
DistributionUpdate.hs avoid flushing keys db queue after each Annex action 2022-10-12 14:12:23 -04:00
InstallDesktopFile.hs update licenses from GPL to AGPL 2019-03-13 15:48:14 -04:00
LinuxMkLibs.hs fix build 2022-09-05 13:20:23 -04:00
MakeMans.hs update licenses from GPL to AGPL 2019-03-13 15:48:14 -04:00
Mans.hs deal with cabal unpack not preserving execute bit 2021-02-08 14:32:24 -04:00
mdwn2man Don't escape leading dots in code blocks in manpage 2016-08-16 11:51:16 -04:00
NullSoftInstaller.hs Windows: Correct the path to the html help file for 64 bit build. 2021-02-24 13:19:42 -04:00
OSXMkLibs.hs assume @RPATH libs are present 2022-01-03 15:05:15 -04:00
Standalone.hs update after RawFilePath transition 2020-11-09 12:12:25 -04:00
TestConfig.hs add searchPathContents 2021-02-02 19:06:15 -04:00
Version.hs avoid strictness problem 2019-01-22 19:37:49 -04:00