Check manifest to check index report #1131
Draft
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 is a proposed solution to #1124. This is just a draft as I would like feedback as to whether this is the right approach and will add tests if this is along the right lines. The PR does two things:
Removes the retry logic from the Indexer's controller. The retry logic never actually triggered a retry, any request that may timeout also returned the Terminal next state which is processed after the
if retry
section to break out of the for loop and exit. Having the retry in there meant that empty index reports could be persisted if a query timed out incheckManifest
(see the issue description). There was then two optionsI opted for deleting the retry logic as it simplified the code. If you would prefer the retry logic was fixed then I think it would just need a
continue
adding to the loop and fixing the persisting of an empty manifest when this state occurs (probably with a retry check when callingSetIndexReport
). I don't know if consideration would also want to be given to how many times a retry happened to not get stuck in this state. All these thoughts made me think simpler code was better code so deleted it!If all
Scanner
s complete for a manifest then the index report should be persisted in theIndexFinished
state with all the required information in it for querying. If it does not end up in this state it will not be possible to query the manifest but the current implementation ofcheckManifest
would also not allow for a rescan. I have updatedcheckManifest
to make sure that the manifest is inIndexFinished
state and if not it will reprocess the whole image from scratch. My main question with this part of the change is whetherFetchLayers
is the right state to go into. By the time we have check the index report we know all theScanner
s have database information for them so would we be better skipping toCoalesce
so that we do not need to pull the image again? I opted forFetchLayers
for two reasons, both of which I suspect someone more familiar with the code may disagree with:ManifestScanned
returns true but not everything is in the database.Coalesce
that is only set in previous states rather than being in the database.Would love the thoughts of someone familiar with this code!