Repository navigation
Conversation
The index server used os.IsNotExist to tell a missing index from a failure to read one, which only matches the error of a local store. For every other store a missing index was answered with 400. NoSuchObject now matches fs.ErrNotExist, the handler tests for that with errors.Is, and the SFTP, GCS and S3 index stores return NoSuchObject for an index that isn't there, like the HTTP and OCI ones. S3 only finds out when the object is read, so its reader reads ahead to report it.
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.
An index server answers a request for an index that doesn't exist with
400 Bad Requestunless its store is a local directory. A client reading from such a server getsunexpected status code 400instead of the missing-object error it gets from a server with a local store.The handler used
os.IsNotExistto tell a missing index from a failure to read one. That only matches the error a local store returns. The other index stores report a missing index in ways it doesn't recognise:NoSuchObject%vstorage.ErrObjectNotExist, wrappedGetIndexReader; the S3 error surfaces from the first readChanges:
NoSuchObjectmatchesfs.ErrNotExistthrough anIsmethod, soerrors.Is(err, fs.ErrNotExist)covers a missing index in any store, wrapped or not.GETandHEAD.NoSuchObjectfor a missing index.GetIndexReader, which is when the object is actually requested, and returnsNoSuchObjectforNoSuchKey. This takes no extra request. It also correctsHEADon an index server backed by S3, which answered200for any name since opening the reader never failed.Other failures to read an index are answered with
400as before.The handler, the S3 store and the SFTP store have tests for a missing index. The GCS change has none, there is no fake GCS backend in the tests.