git-annex/Assistant
Joey Hess 68a49adcda
Improve behavior when -J transfers multiple files that point to the same key
After a false start, I found a fairly non-intrusive way to deal with it.
Although it only handles transfers -- there may be issues with eg
concurrent dropping of the same key, or other operations.

There is no added overhead when -J is not used, other than an added
inAnnex check. When -J is used, it has to maintain and check a small
Set, which should be negligible overhead.

It could output some message saying that the transfer is being done by
another thread. Or it could even display the same progress info for both
files that are being downloaded since they have the same content. But I
opted to keep it simple, since this is rather an edge case, so it just
doesn't say anything about the transfer of the file until the other
thread finishes.

Since the deferred transfer action still runs, actions that do more than
transfer content will still get a chance to do their other work. (An
example of something that needs to do such other work is P2P.Annex,
where the download always needs to receive the content from the peer.)
And, if the first thread fails to complete a transfer, the second thread
can resume it.

But, this unfortunately means that there's a risk of redundant work
being done to transfer a key that just got transferred.
That's not ideal, but should never cause breakage; the same
thing can occur when running two separate git-annex processes.

The get/move/copy/mirror --from commands had extra inAnnex checks added,
inside the download actions. Without those checks, the first thread
downloaded the content, and then the second thread woke up and
downloaded the same content redundantly.

move/copy/mirror --to is left doing redundant uploads for now. It
would need a second checkPresent of the remote inside the upload
to avoid them, which would be expensive. A better way to avoid
redundant work needs to be found..

This commit was supported by the NSF-funded DataLad project.
2017-10-17 17:10:50 -04:00
..
Alert remove 163 lines of code without changing anything except imports 2016-01-20 16:36:33 -04:00
Install avoid warnings about not exported System.Directory.isSymbolicLink 2016-04-28 15:18:11 -04:00
Pairing avoid the dashed ssh hostname class of security holes 2017-08-17 22:11:31 -04:00
Threads assistant: update export db after mergeing git-annex branch changes 2017-09-20 16:34:29 -04:00
Types Improve behavior when -J transfers multiple files that point to the same key 2017-10-17 17:10:50 -04:00
WebApp Improve behavior when -J transfers multiple files that point to the same key 2017-10-17 17:10:50 -04:00
Alert.hs fix tricky warning with ghc 8 2016-11-15 18:51:07 -04:00
BranchChange.hs update my email address and homepage url 2015-01-21 12:50:09 -04:00
Changes.hs update my email address and homepage url 2015-01-21 12:50:09 -04:00
Commits.hs add exporter thread to assistant 2017-09-20 15:29:13 -04:00
Common.hs remove 163 lines of code without changing anything except imports 2016-01-20 16:36:33 -04:00
CredPairCache.hs update my email address and homepage url 2015-01-21 12:50:09 -04:00
DaemonStatus.hs first pass at assistant knowing about export remotes 2017-09-20 13:58:27 -04:00
DeleteRemote.hs AssociatedFile newtype 2017-03-10 13:35:31 -04:00
Drop.hs add VerifiedCopy data type 2015-10-08 16:55:11 -04:00
Fsck.hs Relicense 5 source files that are not part of the webapp from AGPL to GPL. 2016-11-21 23:46:59 -04:00
Gpg.hs Relicense 5 source files that are not part of the webapp from AGPL to GPL. 2016-11-21 23:46:59 -04:00
Install.hs make assistant not write wrappers when GIT_ANNEX_PACKAGE_INSTALL is set 2016-04-27 14:05:46 -04:00
MakeRemote.hs implement exporttree=yes configuration 2017-09-04 13:09:38 -04:00
Monad.hs add exporter thread to assistant 2017-09-20 15:29:13 -04:00
NamedThread.hs remove 163 lines of code without changing anything except imports 2016-01-20 16:36:33 -04:00
Pairing.hs remove 163 lines of code without changing anything except imports 2016-01-20 16:36:33 -04:00
Pushes.hs add exporter thread to assistant 2017-09-20 15:29:13 -04:00
RemoteControl.hs update my email address and homepage url 2015-01-21 12:50:09 -04:00
Repair.hs Relicense 5 source files that are not part of the webapp from AGPL to GPL. 2016-11-21 23:46:59 -04:00
RepoProblem.hs update my email address and homepage url 2015-01-21 12:50:09 -04:00
Restart.hs Relicense 5 source files that are not part of the webapp from AGPL to GPL. 2016-11-21 23:46:59 -04:00
ScanRemotes.hs update my email address and homepage url 2015-01-21 12:50:09 -04:00
Ssh.hs avoid the dashed ssh hostname class of security holes 2017-08-17 22:11:31 -04:00
Sync.hs assistant: update export db after mergeing git-annex branch changes 2017-09-20 16:34:29 -04:00
TransferQueue.hs first pass at assistant knowing about export remotes 2017-09-20 13:58:27 -04:00
TransferrerPool.hs Always use filesystem encoding for all file and handle reads and writes. 2016-12-24 14:46:31 -04:00
TransferSlots.hs AssociatedFile newtype 2017-03-10 13:35:31 -04:00
Unused.hs remove 163 lines of code without changing anything except imports 2016-01-20 16:36:33 -04:00
Upgrade.hs adeiu, MissingH 2017-05-16 01:03:52 -04:00
WebApp.hs unified AuthToken type between webapp and tor 2016-11-22 14:18:34 -04:00