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

Adds count, scanned count and consumed capacity to DDB Enhanced Page #4444

Merged
merged 2 commits into from
Sep 21, 2023

Conversation

cenedhryn
Copy link
Contributor

@cenedhryn cenedhryn commented Sep 18, 2023

Motivation and Context

This PR addresses the issue of missing metadata fields in the response of DDB Enhanced Scan and Query operations, as described in

In addition, this PR adds Count and ScannedCount to the response to aid users who want to understand the results of their queries.

Scan and Query are paginated operations where each page is represented by a backend call to DDB. The consumed capacity and count metric metadata is specific per page; therefore this metadata is exposed to the user per page. The new response values are available on both table and index operations.

Modifications

  • Adds the parameter to request returning consumed capacity to the EnhancedScanRequest and EnhancedQueryRequest
  • Adds ConsumedCapacity to the Page class
  • Adds Count and ScannedCount to the Page class
  • Refactors the existing integration tests into fewer classes that use less resources and let maintainers scan through the tests quicker.

Testing

Functional testing, integration testing

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@cenedhryn cenedhryn requested a review from a team as a code owner September 18, 2023 18:37
@cenedhryn cenedhryn force-pushed the salande/ddb-enh-add-consumedcapacity-scan-query branch from ca21a0e to eb8220d Compare September 19, 2023 16:20
@@ -33,30 +36,47 @@
public final class Page<T> {
private final List<T> items;
private final Map<String, AttributeValue> lastEvaluatedKey;
private final Integer count;
private final Integer scannedCount;
private final ConsumedCapacity consumedCapacity;
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we can't just include a service response here since it could be QueryResponse and ScanResponse. :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we really wanted to, we could make it a metadata field, then we'd get
page.responseMetadata().count() instead of
page.count().

I find the current version a more natural, but if DDB would add many more metadata fields we'd be glad we had a containing object. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking about including the whole responsescanResponse, so page.sdkResponse().count(), but that doesn't seem to be possible.

@sonarcloud
Copy link

sonarcloud bot commented Sep 20, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 10 Code Smells

53.8% 53.8% Coverage
9.9% 9.9% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@cenedhryn cenedhryn merged commit 824e670 into master Sep 21, 2023
6 of 7 checks passed
@cenedhryn cenedhryn deleted the salande/ddb-enh-add-consumedcapacity-scan-query branch September 21, 2023 23:32
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.

2 participants