Repository navigation
Storage retries - #1585
Merged
Merged
Storage retries#1585
Conversation
sschuberth
approved these changes
Oct 17, 2016
technoweenie
approved these changes
Oct 17, 2016
technoweenie
left a comment
Contributor
There was a problem hiding this comment.
Not sure why this needs another approval...
Contributor
Author
|
Only reviews from users with write-access count towards the decision. On Monday, October 17, 2016, risk danger olson [email protected]
Thanks, |
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Feb 26, 2026
In our "lfstest-gitserver" test utility program, the storageHandler() function is used to generate responses to HTTP requests which upload or download individual Git LFS objects. For both types of requests, if the content of an object matches a specific "magic" string value then the function simulates a set of conditions relevant for the current shell test by returning a particular status code or checking for a particular request header. When handling a PUT object upload request, the object's SHA-256 hash value as provided by the Git LFS client in the URL path is used to determine whether the object content matches a given special or "magic" key value. For these types of requests, the storageHandler() function first looks for an entry in the global oidHandlers map using the provided OID as the key. If an entry exists, its value is then checked against a series of keys, and if a match is found, the PUT upload handler simulates the relevant test conditions. By contrast, when handling a GET object download request, the same storageHandler() function does not refer to the oidHandlers map. Instead, if it finds a stored object matching the OID provided by the client, it then tries to match the object's content against each of a series of special key strings. Each match check is made by comparing the length of the string and the length of the byte array containing the object content, and then if those are equal, comparing the contents of the string and the byte array. This technique was first introduced to the object download handling logic in commit c9c457c of PR git-lfs#1297 and then copied every time another special object content key was added in later commits and PRs. While functional, the discrepancy between the object upload and download handling portions of the storageHandler() function somewhat obscures the similarities between the two code segments, and has also led to some confusion as to which special object content keys need to be defined in the global contentHandlers array, from which the oidHandlers map is populated. For instance, in commit 864beb8 of PR git-lfs#1585 the "storage-download-retry" string was added to the contentHandlers array, but the corresponding entry in the oidHandlers array is never utilized. As we expect to update and correct some of the specialized handling of object download test conditions in subsequent commits in this PR, we first revise the storageHandler() function so that it mirrors the design of the object upload handling section. When responding to a GET request, the function now checks for an entry in the oidHandlers map, and if an entry is found, then uses its value in a "switch" statement to search for a match against a specific string. To make this change successful, we also need to register several additional special object content keys in the contentHandlers array, specifically the "status-batch-retry", "storage-download-retry-later", and "storage-download-retry-later-no-header" strings.
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Feb 26, 2026
In PR git-lfs#1585 we added tests to our shell test suite to verify that the Git LFS client will retry object upload and download transfer requests when one or more initial requests fail due to HTTP errors. We placed these tests in a shell script named "t/t-batch-retries.sh". Then in PR git-lfs#3449 we updated the Git LFS client to respect HTTP responses with 429 status codes and optional Retry-After headers by delaying its subsequent retries, but we only implemented this change for individual object upload and download requests and not for requests to the Batch API endpoint itself. This PR included several new shell tests, which we placed in a script named "t/t-batch-retries-ratelimit.sh". Later, in PR git-lfs#4573, we revised the client to also respect Batch API responses with 429 status codes and optional Retry-After headers, and added an appropriate set of tests to the "t/t-batch-retries-ratelimit.sh" script, but only after moving the existing tests in that script into a new file named "t/t-batch-storage-retries-ratelimit.sh". As we noted in commit 32f571d when we made these changes: This commit ... moves the existing storage API endpoint tests ... for the same scenario to a more logical `t-batch-storage-retries-ratelimit.sh` file to not cause confusion with the actual batch API endpoint tests. Following the same rationale, we now rename the "t/t-batch-retries.sh" script to "t/t-batch-storage-retries.sh", since the tests it contains exercise the client's retry logic for object upload and download HTTP requests and not the retry logic for Batch API requests.
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Mar 1, 2026
In our "lfstest-gitserver" test utility program, the storageHandler() function is used to generate responses to HTTP requests which upload or download individual Git LFS objects. For both types of requests, if the content of an object matches a specific "magic" string value then the function simulates a set of conditions relevant for the current shell test by returning a particular status code or checking for a particular request header. When handling a PUT object upload request, the object's SHA-256 hash value as provided by the Git LFS client in the URL path is used to determine whether the object content matches a given special or "magic" key value. For these types of requests, the storageHandler() function first looks for an entry in the global oidHandlers map using the provided OID as the key. If an entry exists, its value is then checked against a series of keys, and if a match is found, the PUT upload handler simulates the relevant test conditions. By contrast, when handling a GET object download request, the same storageHandler() function does not refer to the oidHandlers map. Instead, if it finds a stored object matching the OID provided by the client, it then tries to match the object's content against each of a series of special key strings. Each match check is made by comparing the length of the string and the length of the byte array containing the object content, and then if those are equal, comparing the contents of the string and the byte array. This technique was first introduced to the object download handling logic in commit c9c457c of PR git-lfs#1297 and then copied every time another special object content key was added in later commits and PRs. While functional, the discrepancy between the object upload and download handling portions of the storageHandler() function somewhat obscures the similarities between the two code segments, and has also led to some confusion as to which special object content keys need to be defined in the global contentHandlers array, from which the oidHandlers map is populated. For instance, in commit 864beb8 of PR git-lfs#1585 the "storage-download-retry" string was added to the contentHandlers array, but the corresponding entry in the oidHandlers array is never utilized. As we expect to update and correct some of the specialized handling of object download test conditions in subsequent commits in this PR, we first revise the storageHandler() function so that it mirrors the design of the object upload handling section. When responding to a GET request, the function now checks for an entry in the oidHandlers map, and if an entry is found, then uses its value in a "switch" statement to search for a match against a specific string. To make this change successful, we also need to register several additional special object content keys in the contentHandlers array, specifically the "status-batch-retry", "storage-download-retry-later", and "storage-download-retry-later-no-header" strings.
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Mar 1, 2026
In PR git-lfs#1585 we added tests to our shell test suite to verify that the Git LFS client will retry object upload and download transfer requests when one or more initial requests fail due to HTTP errors. We placed these tests in a shell script named "t/t-batch-retries.sh". Then in PR git-lfs#3449 we updated the Git LFS client to respect HTTP responses with 429 status codes and optional Retry-After headers by delaying its subsequent retries, but we only implemented this change for individual object upload and download requests and not for requests to the Batch API endpoint itself. This PR included several new shell tests, which we placed in a script named "t/t-batch-retries-ratelimit.sh". Later, in PR git-lfs#4573, we revised the client to also respect Batch API responses with 429 status codes and optional Retry-After headers, and added an appropriate set of tests to the "t/t-batch-retries-ratelimit.sh" script, but only after moving the existing tests in that script into a new file named "t/t-batch-storage-retries-ratelimit.sh". As we noted in commit 32f571d when we made these changes: This commit ... moves the existing storage API endpoint tests ... for the same scenario to a more logical `t-batch-storage-retries-ratelimit.sh` file to not cause confusion with the actual batch API endpoint tests. Following the same rationale, we now rename the "t/t-batch-retries.sh" script to "t/t-batch-storage-retries.sh", since the tests it contains exercise the client's retry logic for object upload and download HTTP requests and not the retry logic for Batch API requests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull-request adds tests asserting retry behavior when both upload and download requests are made to the storage endpoint.
I will follow this PR up with another special-case handler guarding interactions with the batch API endpoint, which, once merged, will fully cover the new retry behavior at the integration level.
/cc @technoweenie @sschuberth