-
Notifications
You must be signed in to change notification settings - Fork 56
most recent provider and provider stores #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…and version explosion
provider = self._cache.get(version) | ||
except KeyError: | ||
try: | ||
provider = self._provider_store.provider(self._material_name, version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This version only works with a single material name. While this is the default in the Java one, this behavior can be override in Java. Can this class be modified (possibly post launch) to support this additional functionality?
Please see this commit for additional context: aws/aws-dynamodb-encryption-java@5045e9f#diff-61178aa9fd65f26315b84815e46913fb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
return TtlActions.EXPIRED | ||
|
||
def _can_use_current(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why doesn't this delegate to _ttl_action
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I forgot to remove that method when I replaced it with _ttl_action
:/
Removing
|
||
try: | ||
version = self._get_max_version() | ||
provider = self._get_provider(version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If old version is the same as new version, this still hits DynamoDB (including decryption costs) rather than just continuing to use the version in the cache.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point. Adding a cache attempt after getting the max version.
|
||
actual_version, provider = self._get_most_recent_version(allow_local) | ||
|
||
self._cache.put(actual_version, provider) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it an issue that this (and the next line) are not done in the same lock as was acquired in _get_most_recent_version
?
In general, I'm worried about this being split across multiple lock calls. It seems like this my result in multiple threads calling DynamoDB for a single refresh (when it isn't necessary).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, that's a good point. I had originally split it up for simplicity, but with how the locking has changed since then I agree, this could create unintended side effects.
…e provider store * move local version, last updated, and cache update into _get_most_recent_version to keep them inside the same lock acquisition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IANAPD
LGTM
Description of changes:
Introduction of
MostRecentProvider
, provider stores, andMetaStore
.BLOCKED BY #46
NOTE
To ease parallelization of efforts, this PR is based on the
DELETE-9
fork. Prior to looking over this PR, #46 should be merged tomaster
and the base for this PR be changed tomaster
.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.