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

AFS consistency issues and maintenance #10

Open
sylvlecl opened this issue Oct 22, 2019 · 2 comments
Open

AFS consistency issues and maintenance #10

sylvlecl opened this issue Oct 22, 2019 · 2 comments

Comments

@sylvlecl
Copy link
Contributor

  • Do you want to request a feature or report a bug?

Bug.

  • What is the current behavior?

It's easy to create inconsistencies in a filesystem tree.
For example:

        Folder folder = afs.getRootFolder().createFolder("folder");
        folder.delete();
        Folder subFolder = folder.createFolder("subfolder");
        System.out.println(subFolder.getPath().toString());

The call to getPath() will throw an NPE when trying to go up the tree.

Once AFS is in this state and the reference to orphan nodes are lost, the API does not give any possibility to repair it, since it will be impossible to retrieve them using a path.

Note that there are more complex situations in which this can occurs, for instance when a client JVM deletes a node while another still has a reference to it.

  • What is the expected behavior?

There should be more safeguards stopping clients to create inconsistencies, and tools to help identify and repair inconsistencies when inconsistencies do occur.

  • Please tell us about your environment:

PowSyBl version : v2.6.1

  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, spectrum, etc)

The code above has been tested with Cassandra based AFS implementation.
It does not behave the same with MapDb implementation, which throws when trying to create the sub-folder. However it's pretty sure that in a concurrent environment, we can get to the same inconsistent result.
The AppStorage SPI should at least provide some guidelines as to how consistency should be treated.

@sylvlecl
Copy link
Contributor Author

In particular, the method AppFileSystem#findProjectFolder will throw an AfsException if the parent project cannot be found.

@pl-buiquang
Copy link
Contributor

Should this safety rely on the underlying implementation of AppStorage (prevent creation of a node with an non existent parent in the exemple) ?

@mathbagu mathbagu transferred this issue from powsybl/powsybl-core Jan 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants