It's easy to create orphan nodes (nodes without a parent): we must provide a way to identify them and delete them:
void testOrphanNodes() {
NodeInfo orphanNode = storage.createNode(UUIDs.timeBased().toString(), "orphanNodes", FOLDER_PSEUDO_CLASS, "", 0, new NodeGenericMetadata());
//Following throws because data such as modification date are null for the unexisting parent node
storage.getParentNode(orphanNode.getId());
}
What is the expected behavior?
Provide an ORPHAN_NODES check in CassandraAppStorage. It will identify the nodes which have a null parent ID.
The repair will simply delete those nodes.
What is the motivation / use case for changing the behavior?
Being able to delete orphan nodes, which are not accessible from the user API, but may cause issues (disk usage or null pointer in some functionalities).
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, spectrum, etc)
Note that we don't perform a check on the parent existence when we create a node.
We can add this kind of check, but it adds an additional query without completely solving the issue : we could still create orphan nodes because of concurrency issues.
Therefore that tool remains necessary anyway.
Feature
It's easy to create orphan nodes (nodes without a parent): we must provide a way to identify them and delete them:
Provide an
ORPHAN_NODES
check inCassandraAppStorage
. It will identify the nodes which have a null parent ID. The repair will simply delete those nodes.Being able to delete orphan nodes, which are not accessible from the user API, but may cause issues (disk usage or null pointer in some functionalities).
Note that we don't perform a check on the parent existence when we create a node. We can add this kind of check, but it adds an additional query without completely solving the issue : we could still create orphan nodes because of concurrency issues. Therefore that tool remains necessary anyway.