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

Move shard store init to Application #2995

Closed
wants to merge 2 commits into from

Conversation

miguelportilla
Copy link
Contributor

This PR is a small step in preparation for self-contained portable shards. The initialization of the shard store is moved to the Application object. Once the shard store relieves the node store of duty, there will be no need for the SHAMapStore class and will be eventually removed.

@ripplelabs-jenkins
Copy link
Collaborator

ripplelabs-jenkins commented Jul 3, 2019

Jenkins Build Summary

Built from this commit

Built at 20190726 - 20:23:32

Test Results

Build Type Log Result Status
msvc.Debug logfile 1178 cases, 0 failed, t: 570s PASS ✅
gcc.Release
-Dassert=ON,
MANUAL_TESTS=true
logfile 915 cases, 0 failed, t: 4m55s PASS ✅
docs,
TARGET=docs
logfile 1 cases, 0 failed, t: 0m1s PASS ✅
gcc.Debug
-Dcoverage=ON,
TARGET=coverage_report,
SKIP_TESTS=true
logfile 1178 cases, 0 failed, t: 16m47s PASS ✅
clang.Debug logfile 1178 cases, 0 failed, t: 2m56s PASS ✅
msvc.Debug,
NINJA_BUILD=true
logfile 1178 cases, 0 failed, t: 604s PASS ✅
gcc.Debug logfile 1178 cases, 0 failed, t: 2m53s PASS ✅
clang.Debug
-Dunity=OFF
logfile 1177 cases, 0 failed, t: 11m13s PASS ✅
gcc.Debug
-Dunity=OFF
logfile 1177 cases, 0 failed, t: 8m43s PASS ✅
clang.Release
-Dassert=ON
logfile 1178 cases, 0 failed, t: 5m8s PASS ✅
msvc.Debug
-Dunity=OFF
logfile 1177 cases, 0 failed, t: 1100s PASS ✅
gcc.Release
-Dassert=ON
logfile 1178 cases, 0 failed, t: 4m57s PASS ✅
gcc.Debug
-Dstatic=OFF
logfile 1178 cases, 0 failed, t: 2m56s PASS ✅
msvc.Release logfile 1178 cases, 0 failed, t: 401s PASS ✅
gcc.Debug
-Dstatic=OFF -DBUILD_SHARED_LIBS=ON
logfile 1178 cases, 0 failed, t: 2m50s PASS ✅
gcc.Debug,
NINJA_BUILD=true
logfile 1178 cases, 0 failed, t: 2m50s PASS ✅
clang.Debug
-Dunity=OFF -Dsan=address,
PARALLEL_TESTS=false,
DEBUGGER=false
logfile 1177 cases, 0 failed, t: 1m6s PASS ✅
clang.Debug
-Dunity=OFF -Dsan=undefined,
PARALLEL_TESTS=false
logfile 1177 cases, 0 failed, t: 5m12s PASS ✅

src/ripple/app/main/Application.cpp Show resolved Hide resolved
src/ripple/app/main/Application.cpp Outdated Show resolved Hide resolved
src/ripple/nodestore/impl/DatabaseShardImp.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@mellery451 mellery451 left a comment

Choose a reason for hiding this comment

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

👍

std::vector<std::string>
getSchema (DatabaseCon& dbc, std::string const& dbName)
void
ApplicationImp::updateTxnDB()
Copy link
Contributor

Choose a reason for hiding this comment

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

This method looks like ancient database migration code dating back to 2013. I can't imagine we even support such an upgrade anymore. We should remove this migration code. If we don't want to do it here, I'd open an issue to track it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, removed. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The AccountTransactions has a primary key check can probably also be removed but I'll leave it in unless someone feels strongly about removing it.

@miguelportilla miguelportilla added the Passed Passed code review & PR owner thinks it's ready to merge. Perf sign-off may still be required. label Jul 12, 2019
@miguelportilla miguelportilla removed the Passed Passed code review & PR owner thinks it's ready to merge. Perf sign-off may still be required. label Jul 15, 2019
@miguelportilla
Copy link
Contributor Author

@mellery451 @jwbusch I added a new commit (to be folded) that has additional changes belonging to this PR. Apologies for adding the additional work, it was going to be a separate PR but the changes really belong here. Thanks!

Copy link

@jwbusch jwbusch left a comment

Choose a reason for hiding this comment

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

Mostly minor comments to avoid dynamic_cast in a few places.

src/ripple/app/main/Application.cpp Show resolved Hide resolved
src/ripple/app/misc/SHAMapStoreImp.cpp Outdated Show resolved Hide resolved
src/ripple/app/misc/SHAMapStoreImp.cpp Show resolved Hide resolved
src/ripple/app/misc/SHAMapStoreImp.cpp Outdated Show resolved Hide resolved
src/ripple/nodestore/impl/DatabaseShardImp.cpp Outdated Show resolved Hide resolved
src/ripple/nodestore/impl/DatabaseShardImp.cpp Outdated Show resolved Hide resolved
src/ripple/app/misc/SHAMapStoreImp.cpp Outdated Show resolved Hide resolved
src/ripple/app/misc/SHAMapStoreImp.cpp Outdated Show resolved Hide resolved
src/ripple/app/misc/SHAMapStoreImp.cpp Show resolved Hide resolved
@@ -21,6 +21,7 @@
#include <ripple/app/ledger/TransactionMaster.h>
#include <ripple/app/misc/NetworkOPs.h>
#include <ripple/app/misc/SHAMapStoreImp.h>
#include <ripple/app/misc/SHAMapStoreImp.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

this include got repeated for some reason

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bizarre, thanks. 👍

@miguelportilla miguelportilla force-pushed the shardstore_init branch 3 times, most recently from c72bef7 to 85da4d4 Compare July 17, 2019 21:35
else
boost::filesystem::create_directories(dir_);

if (!get_if_exists<std::uint64_t>(section, "max_size_gb", maxDiskSpace_))
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm pretty sure the existing comparisons with this value are in terms of bytes, but this value is gb. The old code converted to bytes before passing to this class, so we should probably do it here after reading and checking overflow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! 👍

@codecov-io
Copy link

Codecov Report

Merging #2995 into develop will decrease coverage by 0.01%.
The diff coverage is 53.24%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2995      +/-   ##
===========================================
- Coverage    69.46%   69.45%   -0.02%     
===========================================
  Files          709      709              
  Lines        56448    56271     -177     
===========================================
- Hits         39211    39081     -130     
+ Misses       17237    17190      -47
Impacted Files Coverage Δ
src/ripple/app/consensus/RCLValidations.h 86.66% <ø> (-0.44%) ⬇️
src/ripple/nodestore/impl/DatabaseShardImp.h 0% <ø> (ø) ⬆️
src/ripple/nodestore/impl/Shard.h 0% <ø> (ø) ⬆️
src/ripple/app/misc/SHAMapStore.h 100% <ø> (ø) ⬆️
src/ripple/nodestore/DatabaseShard.h 0% <ø> (ø) ⬆️
src/ripple/nodestore/Database.h 100% <ø> (ø) ⬆️
src/ripple/app/consensus/RCLValidations.cpp 79.38% <ø> (-5.53%) ⬇️
src/ripple/app/ledger/Ledger.cpp 82.14% <ø> (-0.14%) ⬇️
src/ripple/app/main/DBInit.cpp 100% <ø> (ø) ⬆️
src/ripple/nodestore/impl/Shard.cpp 0.39% <0%> (ø) ⬆️
... and 14 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 caa5c9e...9030162. Read the comment docs.

if (!get_if_exists<std::uint64_t>(section, "max_size_gb", maxDiskSpace_))
return fail("'max_size_gb' missing");

if (maxDiskSpace_ < minDiskSpace_)
Copy link

Choose a reason for hiding this comment

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

is minDiskSpace also in GB? does it need to be converted to bytes too?

Copy link

Choose a reason for hiding this comment

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

Might be helpful to use labels for units -> minDiskSpace_ means it's in bytes, minDiskSpaceGB_ means it's in gigabytes... since we don't have any types for these units afaik. Maybe we need some std::chrono-like system :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My bad, minDiskSpace is always in GB and before the conversion (at this point), so is maxDiskSpace_. So the code is correct as is. I am not a fan of the label idea but using a temp here and assigning a converted value to maxDiskSpace_ will help avoid confusion. I'll also narrow minDiskSpace's scope to be local since its only used in one place.

@miguelportilla miguelportilla force-pushed the shardstore_init branch 2 times, most recently from 3a1ff20 to 5e4215e Compare July 23, 2019 20:29
@jwbusch jwbusch self-requested a review July 23, 2019 20:36
parent.isStopping() ||
std::addressof(m_root) != std::addressof(parent.m_root))
{
LogicError("Invalid parent");
Copy link
Contributor

Choose a reason for hiding this comment

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

can you elaborate on the switch from assert to LogicError? I feel like these would be the result of programming errors and should still be asserts but I might be thinking about it wrong.

Copy link

Choose a reason for hiding this comment

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

I suggested it, as it's not something that could get accidentally #ifdef'd out. As soon as the programmer tried to run their program w/ the wrong code they'd hit the crash and have to fix it. But if they happened to be running w/ asserts off, they might miss it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jwbusch That applies to all asserts. Nice thing is they get optimized away when turned off. I am leaning to asserting.

@mellery451
Copy link
Contributor

still 👍 with latest commit

@miguelportilla miguelportilla added the Passed Passed code review & PR owner thinks it's ready to merge. Perf sign-off may still be required. label Jul 26, 2019
@miguelportilla
Copy link
Contributor Author

Thanks for the excellent feedback and review! @mellery451 @jwbusch

@nbougalis
Copy link
Contributor

This PR includes & closes #2978.

This was referenced Aug 5, 2019
@miguelportilla miguelportilla deleted the shardstore_init branch September 5, 2019 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Passed Passed code review & PR owner thinks it's ready to merge. Perf sign-off may still be required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants