Exposed annex.forward-retry git config

One reason is, 5 is an arbitrary number so ought to be configurable.

The real reason though, is I wanted to make the man page explain when
forward retry can override annex.retry, and having a config made the
man page easier to write.
This commit is contained in:
Joey Hess 2020-09-04 15:16:40 -04:00
parent 2bb933eb60
commit e36bae74da
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 26 additions and 8 deletions

View file

@ -217,13 +217,18 @@ stdRetry = combineRetryDeciders forwardRetry configuredRetry
- transfer left off, and so it would make sense to keep retrying forever, - transfer left off, and so it would make sense to keep retrying forever,
- other remotes restart each transfer from the beginning, and so even if - other remotes restart each transfer from the beginning, and so even if
- forward progress is being made, it's not real progress. So, retry a - forward progress is being made, it's not real progress. So, retry a
- maximum of 5 times - maximum of 5 times by default.
-} -}
forwardRetry :: RetryDecider forwardRetry :: RetryDecider
forwardRetry = \numretries old new -> pure $ and forwardRetry numretries old new
[ fromMaybe 0 (bytesComplete old) < fromMaybe 0 (bytesComplete new) | fromMaybe 0 (bytesComplete old) < fromMaybe 0 (bytesComplete new) =
, numretries <= 5 (numretries <=) <$> maybe globalretrycfg pure remoteretrycfg
] | otherwise = return False
where
globalretrycfg = fromMaybe 5 . annexForwardRetry
<$> Annex.getGitConfig
remoteretrycfg = remoteAnnexRetry =<<
(Remote.gitconfig <$> transferRemote new)
{- Retries a number of times with growing delays in between when enabled {- Retries a number of times with growing delays in between when enabled
- by git configuration. -} - by git configuration. -}

View file

@ -27,6 +27,8 @@ git-annex (8.20200815) UNRELEASED; urgency=medium
* Limit retrying of failed transfers when forward progress is being made * Limit retrying of failed transfers when forward progress is being made
to 5, to avoid some unusual edge cases where too much retrying could to 5, to avoid some unusual edge cases where too much retrying could
result in far more data transfer than makes sense. result in far more data transfer than makes sense.
* Exposed annex.forward-retry git config, to configure the forward retry
behavior that git-annex has had for a long time.
* Retry transfers to exporttree=yes remotes same as for other remotes. * Retry transfers to exporttree=yes remotes same as for other remotes.
* import: Retry downloads that fail, same as is done for downloads generally. * import: Retry downloads that fail, same as is done for downloads generally.

View file

@ -114,6 +114,7 @@ data GitConfig = GitConfig
, annexAddUnlocked :: Configurable (Maybe String) , annexAddUnlocked :: Configurable (Maybe String)
, annexSecureHashesOnly :: Bool , annexSecureHashesOnly :: Bool
, annexRetry :: Maybe Integer , annexRetry :: Maybe Integer
, annexForwardRetry :: Maybe Integer
, annexRetryDelay :: Maybe Seconds , annexRetryDelay :: Maybe Seconds
, annexAllowedUrlSchemes :: S.Set Scheme , annexAllowedUrlSchemes :: S.Set Scheme
, annexAllowedIPAddresses :: String , annexAllowedIPAddresses :: String
@ -196,6 +197,7 @@ extractGitConfig configsource r = GitConfig
fmap Just $ getmaybe (annexConfig "addunlocked") fmap Just $ getmaybe (annexConfig "addunlocked")
, annexSecureHashesOnly = getbool (annexConfig "securehashesonly") False , annexSecureHashesOnly = getbool (annexConfig "securehashesonly") False
, annexRetry = getmayberead (annexConfig "retry") , annexRetry = getmayberead (annexConfig "retry")
, annexForwardRetry = getmayberead (annexConfig "forward-retry")
, annexRetryDelay = Seconds , annexRetryDelay = Seconds
<$> getmayberead (annexConfig "retrydelay") <$> getmayberead (annexConfig "retrydelay")
, annexAllowedUrlSchemes = S.fromList $ map mkScheme $ , annexAllowedUrlSchemes = S.fromList $ map mkScheme $
@ -295,6 +297,7 @@ data RemoteGitConfig = RemoteGitConfig
, remoteAnnexSpeculatePresent :: Bool , remoteAnnexSpeculatePresent :: Bool
, remoteAnnexBare :: Maybe Bool , remoteAnnexBare :: Maybe Bool
, remoteAnnexRetry :: Maybe Integer , remoteAnnexRetry :: Maybe Integer
, remoteAnnexForwardRetry :: Maybe Integer
, remoteAnnexRetryDelay :: Maybe Seconds , remoteAnnexRetryDelay :: Maybe Seconds
, remoteAnnexAllowUnverifiedDownloads :: Bool , remoteAnnexAllowUnverifiedDownloads :: Bool
, remoteAnnexConfigUUID :: Maybe UUID , remoteAnnexConfigUUID :: Maybe UUID
@ -356,6 +359,7 @@ extractRemoteGitConfig r remotename = do
, remoteAnnexSpeculatePresent = getbool "speculate-present" False , remoteAnnexSpeculatePresent = getbool "speculate-present" False
, remoteAnnexBare = getmaybebool "bare" , remoteAnnexBare = getmaybebool "bare"
, remoteAnnexRetry = getmayberead "retry" , remoteAnnexRetry = getmayberead "retry"
, remoteAnnexForwardRetry = getmayberead "forward-retry"
, remoteAnnexRetryDelay = Seconds , remoteAnnexRetryDelay = Seconds
<$> getmayberead "retrydelay" <$> getmayberead "retrydelay"
, remoteAnnexAllowUnverifiedDownloads = (== Just "ACKTHPPT") $ , remoteAnnexAllowUnverifiedDownloads = (== Just "ACKTHPPT") $

View file

@ -1356,9 +1356,16 @@ Remotes are configured using these settings in `.git/config`.
* `remote.<name>.annex-retry`, `annex.retry` * `remote.<name>.annex-retry`, `annex.retry`
Configure retries of failed transfers on a per-remote and general Number of times a transfer that fails can be retried. (default 0)
basis, respectively. The value is the number of retries that can be
made of the same transfer. (default 0) * `remote.<name>.annex-forward-retry`, `annex.forward-retry`
If a transfer made some forward progress before failing,
this allows it to be retried even when `annex.retry` does not.
The value is the maximum number of times to do that. (default 5)
When both `annex.retry` and this are set, the maximum number of
retries is the larger of the two.
* `remote.<name>.annex-retry-delay`, `annex.retry-delay` * `remote.<name>.annex-retry-delay`, `annex.retry-delay`