Skip to content
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

feat: stop performing transactional writes on single, unchanged items #23

Merged
merged 3 commits into from
Jul 22, 2021

Conversation

petergaultney
Copy link
Contributor

closes #22

@petergaultney petergaultney changed the title stop performing transactional writes on single, unchanged items feat: stop performing transactional writes on single, unchanged items Jul 22, 2021
@@ -133,7 +136,12 @@ def boto3_transact_multiple_but_optimize_single(TransactItems: List[dict], **kwa
if set(command) == {"Delete"}:
ddb_client.delete_item(**{**item_args, **kwargs})
return
# we don't (yet) support single writee optimization for things other than Put or Delete
if set(command) == {"ConditionCheck"}:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would we end up with a solitary ConditionCheck?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a put_item where the value is identical to what's currently in the items fetched.

Copy link
Contributor

@jwsloan jwsloan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of questions for my own edification. I have not tested it, but your test coverage looks solid.

@petergaultney
Copy link
Contributor Author

@jwsloan thanks for the feedback. I've changed the comments and logs to try to make some of this a little more self-explanatory.

@@ -71,14 +71,17 @@ def _write(
)

hashable_item_key = hashable_key(item_key)
if hashable_item_key in items and items[hashable_item_key] == item_or_none:
"""You've asked us to write an effect that would have no effect, and we are dropping it"""
Copy link
Contributor Author

@petergaultney petergaultney Jul 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an ideal language would allow these sorts of docstrings to automatically be logs. In fact, all logs would be docstrings - there would be no function or object to use for logging - the system would simply be aware of an active logger and pass these bare strings into the logger for processing.

@petergaultney petergaultney merged commit 50a7766 into develop Jul 22, 2021
@petergaultney petergaultney deleted the feature/no-single-unchanged-writes branch July 22, 2021 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

write_versioned put still writes the item even if the in-memory representation is identical
2 participants