Refactor SOCI Init logic#1504
Merged
Merged
Conversation
sondavidb
reviewed
Apr 4, 2025
This change moves most of the SOCI init logic out of `SociContext.Init` into `fs.fetchSociIndex`. This is to reduce the number of args we need to sent to `SociContext.Init`. There are 2 logic changes here: 1. Remove the cached error lock on `SociContext`. `sync.Once` guarantees that no call to `Do` will return until exactly 1 executes the function. Therefore, there was never any concurrent access as the write to the cached error will always happen before any read. 2. The SOCI index digest is parsed rather than casted to a digest.Digest. Signed-off-by: Kern Walster <walster@amazon.com>
1ea1671 to
0d8d0de
Compare
austinvazquez
approved these changes
Apr 9, 2025
Contributor
|
LGTM, TIL you could wrap multiple errors in the same error format. :) |
Shubhranshu153
approved these changes
Apr 9, 2025
Contributor
|
LGTM |
sondavidb
approved these changes
Apr 9, 2025
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.
Issue #, if available:
Description of changes:
This change moves most of the SOCI init logic out of
SociContext.Initintofs.fetchSociIndex. This is to reduce the number of args we need to sent toSociContext.Init.There are 3 logic changes here:
SociContext.sync.Onceguarantees that no call toDowill return until exactly 1 executes the function. Therefore, there was never any concurrent access as the write to the cached error will always happen before any read.FetchSociArtifacts now uses the Mount context instead ofalready merged in Always use namespace from request context #1509fs.ctx.fs.ctxis tied to the lifetime of the fs object which is the fs object which is the lifetime of the snapshotter. The mount ctx is tied to the lifetime of thesnapshot.Preparecall.Testing performed:
make test && make integrationBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.