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

Enhance parity for DynamoDB to Kinesis stream integration #10143

Merged
merged 4 commits into from Jan 31, 2024

Conversation

whummer
Copy link
Member

@whummer whummer commented Jan 30, 2024

Motivation

Following a customer request, it seems that our integration between DynamoDB tables and Kinesis streams is not fully working for certain DDB operations, in particular when using the transact_write_items operation. (Apparently it worked for older versions prior to 3.0, but I haven't confirmed).

🚧 At this point, the PR only adds a snapshot test to illustrate the behavior - proper logic still needs to be implemented. (may need some help from service owners here, if possible 🙌 )

Wondering if this TODO comment could be related (as I know @bentsku has been working on some pretty significant performance enhancements recently 🚀 ):

# TODO: refactor to apply the same logic as in `BatchWriteItem`: don't prep records if not stream enabled

Update: After discussing with @bentsku , the TODO above is not related - the fix was essentially related to converting a table ARN to the table name.

Changes

  • enhance logic in has_streams_enabled(..) to extract the table name from incoming table ARN
  • fix attributes in forwarded records, for better parity
  • add a de_dynamize_record util function and refactor dynamize_value to use boto TypeSerializer utils
  • add a test_enable_kinesis_streaming_destination snapshot test to cover the functionality

@whummer whummer added the semver: patch Non-breaking changes which can be included in patch releases label Jan 30, 2024
@@ -238,55 +238,6 @@ def test_list_tags_of_resource(self, aws_client):

aws_client.dynamodb.delete_table(TableName=table_name)

@markers.aws.only_localstack
Copy link
Member Author

Choose a reason for hiding this comment

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

Moving this test to a new test_dynamodb_streams.py file (only refactoring, no functional changes)..

@whummer whummer requested a review from bentsku January 30, 2024 10:58
Copy link

github-actions bot commented Jan 30, 2024

LocalStack Community integration with Pro

    2 files      2 suites   1h 21m 21s ⏱️
2 616 tests 2 367 ✅ 249 💤 0 ❌
2 618 runs  2 367 ✅ 251 💤 0 ❌

Results for commit 66b875a.

♻️ This comment has been updated with latest results.

@bentsku
Copy link
Contributor

bentsku commented Jan 30, 2024

I can add a comment related to the comment: for BatchWriteItem, we always prepped the records as if they would be sent down to a stream, which took time. I've refactored BatchWriteItem as it was the affected operation at the time, and introduced logic to not prep records if no streams were attached to the targeted tables.

The comment was the only change in TransactWriteItems, so I'm not aware of anything that would have broken it. I think the only changes around 3.0 were multi accounts and the performance work. I hope I did not break anything with unrelated changes, but as the other operations still "stream", I suppose it could be a minor issue.

Refactoring TransactWriteItems to follow the same kind of model as BatchWriteItems would be good I think, and a first step in trying to fix the issue.

@coveralls
Copy link

coveralls commented Jan 30, 2024

Coverage Status

coverage: 83.793% (-0.03%) from 83.825%
when pulling 66b875a on ddb-kinesis-stream
into 45d39ed on master.

@whummer whummer changed the title [wip] Enhance parity for DynamoDB to Kinesis stream integration Enhance parity for DynamoDB to Kinesis stream integration Jan 31, 2024
@whummer whummer marked this pull request as ready for review January 31, 2024 08:53
@whummer
Copy link
Member Author

whummer commented Jan 31, 2024

@bentsku Kudos for fixing the tests and pushing the PR over the line! 🚀 I cannot approve my own PR, but LGTM! :)

Copy link
Member

@giograno giograno left a comment

Choose a reason for hiding this comment

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

🚀

Copy link
Contributor

@bentsku bentsku left a comment

Choose a reason for hiding this comment

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

I'll also approve my own work 😄 the -ext pipeline is also all green for this PR!
Also, thanks @whummer for updating the PR description with my changes as well. Nice to see boto made it much cleaner about the dynamize util function, we also have some unit tests for it and they are still passing!

@whummer whummer merged commit e1ee84e into master Jan 31, 2024
33 checks passed
@whummer whummer deleted the ddb-kinesis-stream branch January 31, 2024 21:42
maxhoheiser pushed a commit that referenced this pull request Feb 5, 2024
Co-authored-by: Benjamin Simon <benjh.simon@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants