Skip to content

dynamo_request_parser: adding support for transactions#7244

Merged
mattklein123 merged 20 commits intoenvoyproxy:masterfrom
hallie:adding-support-for-transaction
Jul 3, 2019
Merged

dynamo_request_parser: adding support for transactions#7244
mattklein123 merged 20 commits intoenvoyproxy:masterfrom
hallie:adding-support-for-transaction

Conversation

@hallie
Copy link
Copy Markdown
Contributor

@hallie hallie commented Jun 12, 2019

Description:

  • Adds check for new types of dynamodb operations
    • TransactWriteItems
    • TransactGetItems
  • Adds awareness for three new types of dynamodb errors
    • IdempotentParameterMismatchException
    • TransactionCanceledException
    • TransactionInProgressException

Risk Level: Low
Testing: mostly just planning to copy existing tests for BATCH_OPERATIONS
Docs Changes: None
Release Notes:
Fixes #7240

@hallie hallie force-pushed the adding-support-for-transaction branch from 60dc23c to a956054 Compare June 12, 2019 03:20
@hallie hallie changed the title adding support for transactions to dynamo_request_parser dynamo_request_parser: adding support for transactions Jun 12, 2019
Signed-off-by: Hallie Lomax <hallie@lyft.com>

missing colon

Signed-off-by: Hallie Lomax <hallie@lyft.com>

missing colon..

Signed-off-by: Hallie Lomax <hallie@lyft.com>

adding test

Signed-off-by: Hallie Lomax <hallie@lyft.com>

another missing colon

Signed-off-by: Hallie Lomax <hallie@lyft.com>

attempt format fix

Signed-off-by: Hallie Lomax <hallie@lyft.com>

one more

Signed-off-by: Hallie Lomax <hallie@lyft.com>

fixing json

Signed-off-by: Hallie Lomax <hallie@lyft.com>
@hallie hallie force-pushed the adding-support-for-transaction branch from 89108a5 to 7746282 Compare June 12, 2019 16:35
@hallie hallie marked this pull request as ready for review June 12, 2019 20:16
hallie added 9 commits June 12, 2019 13:26
Signed-off-by: Hallie Lomax <hallie@lyft.com>
Signed-off-by: Hallie Lomax <hallie@lyft.com>
Signed-off-by: Hallie Lomax <hallie@lyft.com>
Signed-off-by: Hallie Lomax <hallie@lyft.com>
Signed-off-by: Hallie Lomax <hallie@lyft.com>
Signed-off-by: Hallie Lomax <hallie@lyft.com>
Signed-off-by: Hallie Lomax <hallie@lyft.com>
Signed-off-by: Hallie Lomax <hallie@lyft.com>
Signed-off-by: Hallie Lomax <hallie@lyft.com>
@junr03
Copy link
Copy Markdown
Member

junr03 commented Jun 18, 2019

@hallie thanks for working on this! Do you mind merging in master? I will do a pass now.

@hallie
Copy link
Copy Markdown
Contributor Author

hallie commented Jun 18, 2019

@junr03 will do!

Signed-off-by: Hallie Lomax <hallie@lyft.com>
junr03
junr03 previously requested changes Jun 18, 2019
Copy link
Copy Markdown
Member

@junr03 junr03 left a comment

Choose a reason for hiding this comment

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

Thanks for contributing @hallie! A few comments

}

TEST(DynamoRequestParser, parseTableNameTransactOperation) {
std::vector<std::string> supported_transact_operations{"TransactGetItems", "TransactWriteItems"};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You could use the statically defined constant vector RequestParser::TRANSACT_OPERATIONS to prevent drift, no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

true!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

so this list is private, meaning i can't call it outside of the class. and all the other operations vectors are private as well, meaning that i'd either have to convert them all to public or not follow the set convention, so i'm just reverting back to having a separate list in the test (which is what the other tests for this file do)

// 4xx
"AccessDeniedException",
"ConditionalCheckFailedException",
"IdempotentParameterMismatchException",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we add tests for the failure scenarios that lead to these type of errors?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Judging from the implementation of the function that uses this list, its just checking if this error name exists in the error string returned from dynamo. And the only tests for that function are passing a string with one of the error names in it, rather than actually mimicking the error itself. So is this necessary to add?

@junr03
Copy link
Copy Markdown
Member

junr03 commented Jun 18, 2019

/wait

Signed-off-by: Hallie Lomax <hallie@lyft.com>
@hallie hallie force-pushed the adding-support-for-transaction branch from b60e605 to 5988ebc Compare June 23, 2019 18:29
hallie added 5 commits June 23, 2019 11:39
Signed-off-by: Hallie Lomax <hallie@lyft.com>
Signed-off-by: Hallie Lomax <hallie@lyft.com>
Signed-off-by: Hallie Lomax <hallie@lyft.com>
Signed-off-by: Hallie Lomax <hallie@lyft.com>
Signed-off-by: Hallie Lomax <hallie@lyft.com>
Signed-off-by: Hallie Lomax <hallie@lyft.com>
@stale
Copy link
Copy Markdown

stale bot commented Jul 1, 2019

This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Jul 1, 2019
@hallie
Copy link
Copy Markdown
Contributor Author

hallie commented Jul 1, 2019

@junr03 could I get another review? :0

@stale stale bot removed the stale stalebot believes this issue/PR has not been touched recently label Jul 1, 2019
Copy link
Copy Markdown
Member

@junr03 junr03 left a comment

Choose a reason for hiding this comment

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

Thanks @hallie for the changes. @zuercher can you take a last pass?

for (const Json::ObjectSharedPtr& transact_item : transact_items) {
next_table_name = getTableNameFromTransactItem(*transact_item);
if (next_table_name.empty()) {
auto next_table_name = getTableNameFromTransactItem(*transact_item);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

convention for the envoy codebase is to explicitly add the type here. Also I would add const here as you don't expect to change the table name.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's ok to make this const auto.

Copy link
Copy Markdown
Member

@zuercher zuercher left a comment

Choose a reason for hiding this comment

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

Looks good. Let's switch the one type to const, and then I'll approve.

for (const Json::ObjectSharedPtr& transact_item : transact_items) {
next_table_name = getTableNameFromTransactItem(*transact_item);
if (next_table_name.empty()) {
auto next_table_name = getTableNameFromTransactItem(*transact_item);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's ok to make this const auto.

@zuercher zuercher dismissed junr03’s stale review July 2, 2019 17:11

Agree with @hallie that the existing tests are sufficient.

Signed-off-by: Hallie Lomax <hallie@lyft.com>
@hallie
Copy link
Copy Markdown
Contributor Author

hallie commented Jul 2, 2019

@zuercher updated! :D

Signed-off-by: Hallie Lomax <hallie@lyft.com>
@mattklein123 mattklein123 merged commit 80194c9 into envoyproxy:master Jul 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dynamodb Filters for all table operations

4 participants