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

Feature/shard downloader improvements #3252

Closed

Conversation

undertome
Copy link
Contributor

No description provided.

@codecov-io
Copy link

codecov-io commented Feb 10, 2020

Codecov Report

Merging #3252 into develop will increase coverage by 0.04%.
The diff coverage is 30.13%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3252      +/-   ##
===========================================
+ Coverage    70.62%   70.66%   +0.04%     
===========================================
  Files          676      683       +7     
  Lines        54340    54814     +474     
===========================================
+ Hits         38375    38737     +362     
- Misses       15965    16077     +112     
Impacted Files Coverage Δ
src/ripple/app/ledger/impl/LedgerMaster.cpp 42.07% <0.00%> (ø)
src/ripple/app/main/Main.cpp 40.13% <ø> (ø)
src/ripple/core/impl/JobQueue.cpp 89.85% <ø> (ø)
src/ripple/core/impl/Workers.h 100.00% <ø> (ø)
src/ripple/net/impl/RPCCall.cpp 94.91% <ø> (-0.16%) ⬇️
src/ripple/nodestore/DatabaseRotating.h 100.00% <ø> (ø)
src/ripple/nodestore/DatabaseShard.h 100.00% <ø> (+100.00%) ⬆️
src/ripple/nodestore/impl/DatabaseNodeImp.cpp 82.60% <ø> (ø)
src/ripple/nodestore/impl/DatabaseRotatingImp.h 45.45% <0.00%> (ø)
src/ripple/nodestore/impl/Shard.cpp 0.00% <0.00%> (ø)
... and 39 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b26ed94...234d149. Read the comment docs.

@carlhua carlhua requested a review from ximinez February 10, 2020 15:29
@undertome undertome force-pushed the feature/shard-downloader-improvements branch 2 times, most recently from 05c2943 to 6225b7c Compare February 11, 2020 15:27
@miguelportilla
Copy link
Contributor

miguelportilla commented Feb 12, 2020

Unit test failure.

ERR:ShardArchiveHandler async_connect: No connection could be made because the target machine actively refused it ERR:ShardArchiveHandler Downloading shard id 1 form URL 127.0.0.1/1.tar.lz4

@undertome
Copy link
Contributor Author

Unit test failure.

ERR:ShardArchiveHandler async_connect: No connection could be made because the target machine actively refused it ERR:ShardArchiveHandler Downloading shard id 1 form URL 127.0.0.1/1.tar.lz4

Yeah, that's an expected log message. As in when there are no failures in that test you'll get a bunch of error logs like that. Currently investigating the Xcode build errors rn though.

@undertome undertome force-pushed the feature/shard-downloader-improvements branch 3 times, most recently from 4e4aa83 to 69a1544 Compare February 13, 2020 16:01
miguelportilla
miguelportilla previously approved these changes Mar 5, 2020
Copy link
Contributor

@miguelportilla miguelportilla left a comment

Choose a reason for hiding this comment

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

Changes look good! 👍

ximinez
ximinez previously requested changes Mar 5, 2020
Comment on lines 1627 to 1630
auto handler = RPC::ShardArchiveHandler::getInstance(
*this,
*m_jobQueue);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why did you convert ShardArchiveHandler into a singleton? Especially since it has a reference to the Application, and is never destroyed once it's created, it seems like it should be owned by the Application and destroyed there.

I see that you're using getInstance in several unit tests, but that can be worked around with something like aShardArchiveHandler& Application::shardArchiveHandler(bool validate) function. Let that function do the logic of figuring out whether there's an instance to create, or just return the existing one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With my initial submission it actually was created and destroyed automatically based on the initiation and completion of downloads. With feedback I had to make it a stoppable which means no more destruction until application end.

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 I make the SAH a member of App, then would need synchronization around the construction of the thing. Is it ok to just add a new mutex to the AppImp for that purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deferring for now

Copy link
Collaborator

Choose a reason for hiding this comment

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

There's already a static instance_mutex_ in SAH, so I don't see any harm in moving it to AppImp. (There may be an argument for reusing AppImp::mut_ instead, since that's only used to determine when to stop running and isn't likely to conflict, but that's not a big decision either way.)

src/ripple/rpc/impl/ShardArchiveHandler.cpp Show resolved Hide resolved
src/ripple/app/main/Application.cpp Outdated Show resolved Hide resolved
src/ripple/net/README.md Outdated Show resolved Hide resolved
src/ripple/net/README.md Outdated Show resolved Hide resolved
src/test/rpc/ShardArchiveHandler_test.cpp Outdated Show resolved Hide resolved
src/test/rpc/ShardArchiveHandler_test.cpp Outdated Show resolved Hide resolved
src/test/rpc/ShardArchiveHandler_test.cpp Outdated Show resolved Hide resolved
src/test/rpc/ShardArchiveHandler_test.cpp Show resolved Hide resolved
src/test/rpc/ShardArchiveHandler_test.cpp Show resolved Hide resolved
@undertome
Copy link
Contributor Author

@miguelportilla Looks like your approval was automatically dismissed after I pushed new changes for Ed's comments? Didn't know about that feature...

@mDuo13
Copy link
Collaborator

mDuo13 commented Mar 10, 2020

Can someone summarize the user-facing changes from this PR for me? There's kind of a lot here for me to jump in and understand how usage or functionality has changed.

@miguelportilla
Copy link
Contributor

@mDuo13 There are no obvious user-facing changes from this PR. It was decided to remove the new RPC commands that were being proposed.

It may be worth documenting that with this PR, the RPC shard download command will pause an ongoing download upon the server shutting down and automatically resume that download where it left off on the server startup.

@undertome undertome force-pushed the feature/shard-downloader-improvements branch 2 times, most recently from 24c1cf9 to 234d149 Compare March 11, 2020 21:30
miguelportilla
miguelportilla previously approved these changes Mar 12, 2020
Copy link
Contributor

@miguelportilla miguelportilla left a comment

Choose a reason for hiding this comment

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

👍

NOTE: This PR is rebased on PR #3251 which should be merged first.

@miguelportilla miguelportilla added Dependencies Issues associated with 3rd party dependencies (RocksDB, SQLite, etc) Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required. labels Mar 12, 2020
@miguelportilla miguelportilla dismissed ximinez’s stale review March 12, 2020 19:33

Feedback addressed while reviewer on PTO

@miguelportilla
Copy link
Contributor

@mDuo13 I just realized, there is a small user facing change. With the download_shard command, the optional validate field has been deprecated. All imported shards are always validated.

@carlhua carlhua added the Documentation README changes, code comments, etc. label Mar 23, 2020
miguelportilla and others added 5 commits March 25, 2020 12:04
* Reduce lock scope on all public functions
* Use TaskQueue to process shard finalization in separate thread
* Store shard last ledger hash and other info in backend
* Use temp SQLite DB versus control file when acquiring
* Remove boost serialization from cmake files
* Make ShardArchiveHandler a singleton.
* Add state database for ShardArchiveHandler.
* Use temporary database for SSLHTTPDownloader downloads.
* Make ShardArchiveHandler a Stoppable class.
* Automatically resume interrupted downloads at server start.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dependencies Issues associated with 3rd party dependencies (RocksDB, SQLite, etc) Documentation README changes, code comments, etc. Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants