Return loaded program entry from the cache after insert #30336
Merged
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.
Problem
LoadedPrograms::insert_entry()
checks if a program exists in the cache that matches deployment and effective slot number for the given program key. It currently returns false in such cases. However, it should return an existing program entry, as that is needed for deduplication in case two transaction batches load the same program simultaneously.Summary of Changes
This PR changes the return type to an enum
LoadedProgramEntry
, that conveys if the entry already existed, or was newly added. Also, it carries anArc
to the valid loaded program instance.Fixes #