-
Notifications
You must be signed in to change notification settings - Fork 1
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 orphan node check #90
Conversation
Signed-off-by: yichen88 <[email protected]>
e6c83d4
to
155edac
Compare
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.
Good but we also need to handle associated data when deleting the oprhan node!
statements.add(delete().from(CHILDREN_BY_NAME_AND_CLASS) | ||
.where(eq(ID, fakeParentId))); | ||
issue.setRepaired(true); | ||
issue.setResolutionDescription("Delete row and its parent row"); |
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 can provide a more explicit message like "Deleted node [name=, id=] and reference to absent node [id=]"
.setDescription(nodeName + "(" + nodeId + ") is an orphan node. Its fake parent id:" + fakeParentId); | ||
if (options.isRepair()) { | ||
statements.add(delete().from(CHILDREN_BY_NAME_AND_CLASS) | ||
.where(eq(ID, nodeId))); |
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.
This will not be enough, because we need to also delete all associated date, like for a normal node delete:
- delete its children
- delete the associated data
- etc.
afs-cassandra/src/test/java/com/powsybl/afs/cassandra/CassandraAppStorageTest.java
Show resolved
Hide resolved
afs-cassandra/src/main/java/com/powsybl/afs/cassandra/CassandraAppStorage.java
Show resolved
Hide resolved
Signed-off-by: yichen88 <[email protected]>
An example table which contains an orphan node.
Created by code like final NodeInfo orphanNodes = storage.createNode(UUIDs.timeBased().toString(), "orphanNodes", FOLDER_PSEUDO_CLASS, "", 0, new NodeGenericMetadata());
storage.setConsistent(orphanNodes.getId());
NodeInfo orphanChild = storage.createNode(orphanNodes.getId(), "orphanChild", FOLDER_PSEUDO_CLASS, "", 0, new NodeGenericMetadata());
storage.setConsistent(orphanChild.getId()); The fix processing is to find all node's name are null, then use |
Kudos, SonarCloud Quality Gate passed! |
Signed-off-by: yichen88 [email protected]
Please check if the PR fulfills these requirements (please use
'[x]'
to check the checkboxes, or submit the PR and then click the checkboxes)Does this PR already have an issue describing the problem ? If so, link to this issue using
'#XXX'
and skip the restWhat kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
#87
What is the current behavior? (You can also link to an open issue here)
What is the new behavior (if this is a feature change)?
Does this PR introduce a breaking change or deprecate an API? If yes, check the following:
Other information:
(if any of the questions/checkboxes don't apply, please delete them entirely)