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

Add support for S3 failover #4553

Merged
merged 6 commits into from
Sep 29, 2022
Merged

Add support for S3 failover #4553

merged 6 commits into from
Sep 29, 2022

Conversation

steven-sheehy
Copy link
Member

@steven-sheehy steven-sheehy commented Sep 26, 2022

Description:

  • Add a ConsensusNode abstraction and use it everywhere instead of node account IDs or calling the address book multiple times per file
  • Add a connection timeout property and increase it to 5s to avoid occasional connection errors.
  • Add hedera.mirror.importer.downloader.sources properties that grandfathers legacy hedera.mirror.importer.downloader properties as the primary source in list
  • Change stream file persistence to write files to a node ID based path
  • Increase downloader batch size to 100 to improve historical sync speed
  • Refactor Downloader to push S3 logic into StreamFileProvider abstraction
  • Replace hedera.mirror.importer.downloader.*.batchSize with generic hedera.mirror.importer.downloader.batchSize
  • Replace hedera.mirror.importer.downloader.*.threads with generic hedera.mirror.importer.downloader.threads
  • Remove hedera.mirror.importer.downloader.*.prefix in favor of existing StreamType properties

Related issue(s):

Fixes #54
Fixes #4538

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@steven-sheehy steven-sheehy added enhancement Type: New feature downloader Area: S3 downloader breaking Contains a breaking change that warrants mention in the release notes labels Sep 26, 2022
@steven-sheehy steven-sheehy added this to the 0.66.0 milestone Sep 26, 2022
@steven-sheehy steven-sheehy self-assigned this Sep 26, 2022
@codecov
Copy link

codecov bot commented Sep 26, 2022

Codecov Report

Base: 92.71% // Head: 92.51% // Decreases project coverage by -0.20% ⚠️

Coverage data is based on head (17fbb83) compared to base (a483c5b).
Patch coverage: 88.60% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4553      +/-   ##
============================================
- Coverage     92.71%   92.51%   -0.21%     
- Complexity     2895     2926      +31     
============================================
  Files           532      535       +3     
  Lines         17172    17188      +16     
  Branches       1805     1810       +5     
============================================
- Hits          15921    15901      -20     
- Misses          904      940      +36     
  Partials        347      347              
Impacted Files Coverage Δ
...era/mirror/importer/config/CacheConfiguration.java 100.00% <ø> (ø)
...ownloader/balance/BalanceDownloaderProperties.java 90.90% <ø> (-3.21%) ⬇️
...er/downloader/event/EventDownloaderProperties.java 90.90% <ø> (-3.21%) ⬇️
.../downloader/record/RecordDownloaderProperties.java 90.90% <ø> (-3.21%) ⬇️
...ror/importer/addressbook/ConsensusNodeWrapper.java 43.75% <43.75%> (ø)
...ror/importer/config/CloudStorageConfiguration.java 53.19% <53.33%> (-12.60%) ⬇️
...ror/importer/downloader/NodeSignatureVerifier.java 89.65% <66.66%> (+5.78%) ⬆️
...ra/mirror/importer/domain/FileStreamSignature.java 84.09% <78.57%> (-2.03%) ⬇️
...or/importer/downloader/ConsensusValidatorImpl.java 92.68% <80.00%> (-3.55%) ⬇️
.../hedera/mirror/importer/domain/StreamFileData.java 79.41% <87.50%> (+5.21%) ⬆️
... and 26 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Signed-off-by: Steven Sheehy <steven.sheehy@swirldslabs.com>
Signed-off-by: Steven Sheehy <steven.sheehy@swirldslabs.com>
Signed-off-by: Steven Sheehy <steven.sheehy@swirldslabs.com>
@steven-sheehy steven-sheehy marked this pull request as ready for review September 26, 2022 22:55
@steven-sheehy steven-sheehy requested a review from a team September 26, 2022 22:55
}
})
.filter(s -> s != null && s.getFileType() == SIGNATURE)
.collect(groupingBy(StreamFilename::getInstant, maxBy(StreamFilename.EXTENSION_COMPARATOR)));
Copy link
Member Author

@steven-sheehy steven-sheehy Sep 27, 2022

Choose a reason for hiding this comment

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

I removed the grouping by instant functionality. This would only occur when the account balance csv and pg.gz file were uploaded simultaneously for a short period of time.

It's fine to download either one as they're both equally valid so we can simplify our logic to just rely on the single layer of grouping by StreamFilename (which uses filename without compression suffix as distinct key) via the multimap. That way we don't pay the cost of nested grouping all files for a temporary window.

edwin-greene
edwin-greene previously approved these changes Sep 27, 2022
Copy link
Contributor

@edwin-greene edwin-greene 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 to me.

Signed-off-by: Steven Sheehy <steven.sheehy@swirldslabs.com>
Copy link
Collaborator

@xin-hedera xin-hedera 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!

Copy link
Collaborator

@xin-hedera xin-hedera left a comment

Choose a reason for hiding this comment

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

LGTM

@sonarcloud
Copy link

sonarcloud bot commented Sep 29, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

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

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Contributor

@edwin-greene edwin-greene 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

Copy link
Member

@mgoelswirlds mgoelswirlds left a comment

Choose a reason for hiding this comment

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

lgtm

@steven-sheehy steven-sheehy merged commit 7a96ddb into main Sep 29, 2022
@steven-sheehy steven-sheehy deleted the 54-s3-failover branch September 29, 2022 20:35
mgoelswirlds pushed a commit that referenced this pull request Oct 12, 2022
* Add a ConsensusNode abstraction and use it everywhere instead of node account IDs or calling the address book multiple times per file
* Add a connection timeout property and increase it to 5s to avoid occasional connection errors.
* Add hedera.mirror.importer.downloader.sources properties that grandfathers legacy hedera.mirror.importer.downloader properties as the primary source in list
* Change stream file persistence to write files to a node ID based path
* Increase downloader batch size to 100 to improve historical sync speed
* Refactor Downloader to push S3 logic into StreamFileProvider abstraction
* Replace hedera.mirror.importer.downloader.*.batchSize with generic hedera.mirror.importer.downloader.batchSize
* Replace hedera.mirror.importer.downloader.*.threads with generic hedera.mirror.importer.downloader.threads
* Remove hedera.mirror.importer.downloader.*.prefix in favor of existing StreamType properties

Signed-off-by: Steven Sheehy <steven.sheehy@swirldslabs.com>
Signed-off-by: mgoelswirlds <mugdha.goel@swirldslabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Contains a breaking change that warrants mention in the release notes downloader Area: S3 downloader enhancement Type: New feature
Projects
None yet
4 participants