-
Notifications
You must be signed in to change notification settings - Fork 9
Tree cleanup on Removal #292
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?
Conversation
| decrementParent(node->parent, key); | ||
| if (node->parent && node->parent->refCounter == 0) { | ||
| persistent_ptr<Node256> nodeParent; | ||
| pmemobj_free(nodeParent->children[0].raw_ptr()); |
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.
nodeParent is declared above, but not initialized. How can this work? Do I miss something?
| size_t keyCalc = key[tree->treeRoot->keySize - node->depth - 1]; | ||
| std::bitset<8> x(keyCalc); | ||
| node->children[keyCalc] = nullptr; | ||
| node->refCounter--; |
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 can see refCounter is atomic, shouldn't we initialize it when loading an existing tree?
| } | ||
|
|
||
| /* | ||
| * TODO: decrement value std::atomic<int> refCounter in parent and free it if |
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.
Todo can be removed? Also the one in line 378?
| std::bitset<8> x(keyCalc); | ||
| node->children[keyCalc] = nullptr; | ||
| node->refCounter--; | ||
| if (node->refCounter == 0) { |
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.
Shouldn't this be an compare and swap instruction? Otherwise we can have a situation in which two threads decrement refCounter in parallel before checking for zero in next line. In this situation, none will decrement the parent
| void ARTree::decrementParent(persistent_ptr<Node> node) {} | ||
| void ARTree::decrementParent(persistent_ptr<Node256> node, const char *key) { | ||
| size_t keyCalc = key[tree->treeRoot->keySize - node->depth - 1]; | ||
| std::bitset<8> x(keyCalc); |
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.
looks like x is not used for anything
| decrementParent(valPrstPtr->parent); | ||
| void ARTree::removeFromTree(persistent_ptr<NodeLeafCompressed> compressed, | ||
| const char *key) { | ||
| persistent_ptr<Node256> current = compressed->parent; |
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.
name "current" is confusing, maybe this variable should be called "parent"?
| // remove ValueWrapper | ||
| pmemobj_free(valPrstPtr.raw_ptr()); | ||
| } else if (valPrstPtr->location == DISK) { | ||
| // TODO: jradtke need to confirm if no extra action required here |
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 suppose that comment should be updated, for sure extra actions are needed, right?
Initial implementation of removal from ARTree using pmemobj_free.