-
Notifications
You must be signed in to change notification settings - Fork 103
Add the possibility to explicitly allocate blank node blocks #2574
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
base: master
Are you sure you want to change the base?
Add the possibility to explicitly allocate blank node blocks #2574
Conversation
Signed-off-by: Johannes Kalmbach <[email protected]>
Signed-off-by: Johannes Kalmbach <[email protected]>
…out providing any unit tests yet. Signed-off-by: Johannes Kalmbach <[email protected]>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2574 +/- ##
==========================================
+ Coverage 91.14% 91.20% +0.06%
==========================================
Files 469 473 +4
Lines 40181 40338 +157
Branches 5376 5390 +14
==========================================
+ Hits 36622 36791 +169
+ Misses 2021 2009 -12
Partials 1538 1538 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
RobinTF
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Started a first review. I still don't quite understand all the quirks.
src/util/BlankNodeManager.h
Outdated
| // is assigned a UUID. This map keeps track of the currently active sets, | ||
| // but does not participate in their (shared) ownership, hence the | ||
| // `weak_ptr`. | ||
| std::unordered_map<boost::uuids::uuid, std::weak_ptr<Blocks>, UuidHash> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not a adu::HashMap?
Signed-off-by: Johannes Kalmbach <[email protected]>
Signed-off-by: Johannes Kalmbach <[email protected]>
Signed-off-by: Johannes Kalmbach <[email protected]>
Signed-off-by: Johannes Kalmbach <[email protected]>
Signed-off-by: Johannes Kalmbach <[email protected]>
RobinTF
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're getting there. Didn't have an in depth look at the individual tests in test/BlankNodeManagerTest.cpp, but they all look reasonable.
|
|
||
| // _____________________________________________________________________________ | ||
| auto LocalVocab::getOwnedLocalBlankNodeBlocks() const | ||
| -> std::vector<LocalBlankNodeManager::OwnedBlocksEntry> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason why the auto -> syntax is used instead of a directly specified return type?
src/util/BlankNodeManager.cpp
Outdated
| // We unfortunately cannot make this an `AD_CORRECTNESS_CHECK`, because then | ||
| // we might have a deadlock wrt the `Blocks` destructor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But why? Doesn't AD_CORRECTNESS_CHECK also just throw an exception?
src/util/BlankNodeManager.cpp
Outdated
| auto ptr = isNew ? std::shared_ptr<Blocks>() : it->second.lock(); | ||
| if (isNew || ptr == nullptr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two lines are confusing. Would it be incorrect to just do
| auto ptr = isNew ? std::shared_ptr<Blocks>() : it->second.lock(); | |
| if (isNew || ptr == nullptr) { | |
| auto ptr = it->second.lock(); | |
| if (ptr == nullptr) |
in particular, I find it really hard to reason about this since the value of ptr also depends on isNew
test/BlankNodeManagerTest.cpp
Outdated
| return lbnm; | ||
| } | ||
|
|
||
| // Helper to perform a round-trip serialization/deserialization |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add full stops to all of these.
test/BlankNodeManagerTest.cpp
Outdated
| // Helper to verify all IDs are contained in the LocalBlankNodeManager | ||
| static void verifyIdsContained( | ||
| const BlankNodeManager::LocalBlankNodeManager& lbnm, | ||
| const std::vector<uint64_t>& ids) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a source location + location trace here. Same for all the other functions containing EXPECT/ASSERT.
test/BlankNodeManagerTest.cpp
Outdated
| // Verify new IDs can still be allocated and don't conflict | ||
| auto newId = lbnm2->getId(); | ||
| EXPECT_TRUE(lbnm2->containsBlankNodeIndex(newId)); | ||
| // The new ID should be in a new block (primary blocks now has 1 block) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here with full stops.
test/BlankNodeManagerTest.cpp
Outdated
| auto originalIds = allocateIdsAcrossBlocks(*lbnm, 3); | ||
| ASSERT_EQ(getPrimaryBlocks(*lbnm).size(), 3); | ||
|
|
||
| // Serialize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duh. :D
Signed-off-by: Johannes Kalmbach <[email protected]>
Signed-off-by: Johannes Kalmbach <[email protected]>
RobinTF
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think your automatic changes went a bit too far.
test/BlankNodeManagerTest.cpp
Outdated
| BlankNodeManager::LocalBlankNodeManager::OwnedBlocksEntry>& entries) { | ||
| BlankNodeManager::LocalBlankNodeManager::OwnedBlocksEntry>& entries, | ||
| ad_utility::source_location loc = AD_CURRENT_SOURCE_LOC()) { | ||
| auto t = generateLocationTrace(loc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
test/BlankNodeManagerTest.cpp
Outdated
| BlankNodeManager* bnm, | ||
| const BlankNodeManager::LocalBlankNodeManager& source, | ||
| ad_utility::source_location loc = AD_CURRENT_SOURCE_LOC()) { | ||
| auto t = generateLocationTrace(loc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
Signed-off-by: Johannes Kalmbach <[email protected]>
RobinTF
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the remaining comment (and consider the reference) then this is good to go 👍🏼
test/BlankNodeManagerTest.cpp
Outdated
| //[[maybe_unused]] uint64_t id = lbnm.getId(); | ||
| // EXPECT_EQ(bnm.state_.rlock()->usedBlocksSet_.size(), 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this comment.
src/util/Synchronized.h
Outdated
| ptr_type s() const { | ||
| AD_CORRECTNESS_CHECK(s_ != nullptr); | ||
| return s_; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you consider at one point to return a reference here?
Signed-off-by: Johannes Kalmbach <[email protected]>
RobinTF
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Overview
Conformance check passed ✅No test result changes. |
|




This will be used for reading the
updateTriplesand serialized cached results.