In real world use, inconsistencies will occur in filesystems.
At least those 2 issues have been identified so far :
For any storage implementation : inconsistent nodes which will never be "finished" (for example because an exception occured at the time of creation)
In cassandra storage implementation : node IDs which are referenced as a child of another node, but which do not exist anymore themselves (no line in table children_by_name_and_class for that node)
What is the expected behavior?
The API should provide an entry point to analyze and repair those kind of inconsistencies.
Proposition : adding a new method to check and repair inconsistencies, at the storage level and at the filesystem level.
public class FileSystemCheckOptions {
Instant inconsistentNodesExpirationTime; //Inconsistent nodes older than this could be deleted
boolean repairAll; //option for trying to solve all issues
Set<String> issuesToBeRepairedIds; //option for defining which issues we should try to solve
}
//Representation of an issue which may be solved or has been solved
public class FileSystemCheckIssue {
String type;
String id;
String description;
boolean solved;
String resolutionDescription;
}
public interface AppStorage {
...
List<FileSystemCheckIssue> checkFileSystem(FileSystemCheckOptions options);
}
public class AppFileSystem {
...
//May add common checks to implementation specific checks: typically expired inconsistent nodes
List<FileSystemCheckIssue> checkFileSystem(FileSystemCheckOptions options);
}
A typical use would be to first call the method without asking for any repair, then calling it with the repair option which suits your needs :
AppFileSystem fs = ...
//Get list of issues
List<FileSystemCheckIssue> issues = fs.checkFileSystem(FileSystemCheckOptions.noRepair());
//Check issues content
//...
//Ask for repair:
issues = fs.checkFileSystem(FileSystemCheckOptions.repairAll());
//Display issues resolution
What is the motivation / use case for changing the behavior?
Ability to operate a real world application which uses AFS.
Feature.
In real world use, inconsistencies will occur in filesystems. At least those 2 issues have been identified so far :
The API should provide an entry point to analyze and repair those kind of inconsistencies.
Proposition : adding a new method to check and repair inconsistencies, at the storage level and at the filesystem level.
A typical use would be to first call the method without asking for any repair, then calling it with the repair option which suits your needs :
Ability to operate a real world application which uses AFS.