Commit graph

10 commits

Author SHA1 Message Date
Joey Hess
88d1907278 where indentation 2012-10-31 02:34:03 -04:00
Joey Hess
0c584bf70d split ScanRemotes and lifted 2012-10-29 19:14:30 -04:00
Joey Hess
ae52efc673 scan multiple remotes in one pass
The expensive transfer scan now scans a whole set of remotes in one pass.
So at startup, or when network comes up, it will run only once.

Note that this can result in transfers from/to higher cost remotes being
queued before other transfers of other content from/to lower cost remotes.
Before, low cost remotes were scanned first and all their transfers came
first. When multiple transfers are queued for a key, the lower cost ones
are still queued first. However, this could result in transfers from slow
remotes running for a long time while transfers of other data from faster
remotes waits.

I expect to make the transfer queue smarter about ordering
and/or make it allow multiple transfers at a time, which should eliminate
this annoyance. (Also, it was already possible to get into that situation,
for example if the network was up, lots of transfers from slow remotes
might be queued, and then a disk is mounted and its faster transfers have
to wait.)

Also note that this means I don't need to improve the code in
Assistant.Sync that currently checks if any of the reconnected remotes
have diverged, and if so, queues scans of all of them. That had been very
innefficient, but now doesn't matter.
2012-08-26 14:09:02 -04:00
Joey Hess
0b1015370b fix priority inversion
low cost ==> high priority
2012-08-24 13:59:35 -04:00
Joey Hess
e58d19b533 run full transfer scan on all remotes at startup
Or when a remote first becomes available after startup.
2012-08-24 13:46:10 -04:00
Joey Hess
9fafddc7eb make higher priorities and full scans be preserved when adding 2012-08-24 13:28:20 -04:00
Joey Hess
715a9a2f8e keep logs of failed transfers, and requeue them when doing a non-full scan
of a remote
2012-08-23 15:24:15 -04:00
Joey Hess
ab8cb05989 scan cheapest remotes first
This way, we get transfers from cheapest remotes.
2012-08-23 13:41:38 -04:00
Joey Hess
7478872a09 fix crash when just one remote needs to be scanned
The TMVar is supposed to be left empty once the map is empty, but the code
neglected to do that, so the next time takeMVar got an empty map, which
is not handled since that was supposed to never happen..

Also, avoid any possibility of this crash. If an empty map somehow creeps
in, just retry.
2012-08-05 15:18:56 -04:00
Joey Hess
522f568450 add TransferScanner thread
Efficiently finding transfers that need to be done to get two repos back
in sync seems like an interesting problem.
2012-07-22 23:16:56 -04:00