in src/main/java/com/netflix/bdp/s3mper/cli/MetastoreResolveCommand.java [43:77]
public void execute(Configuration conf, String[] args) throws Exception {
try {
Path path = new Path(args[0]);
conf.set("s3mper.metastore.deleteMarker.enabled", "true");
FileSystemMetastore meta = Metastore.getFilesystemMetastore(conf);
meta.initalize(path.toUri(), conf);
FileSystem fs = FileSystem.get(path.toUri(), conf);
Set<String> s3files = new HashSet<String>();
FileStatus[] s3listing = fs.listStatus(path);
if (s3listing != null) {
for (FileStatus f : s3listing) {
s3files.add(f.getPath().toUri().toString());
}
}
List<FileInfo> files = meta.list(Collections.singletonList(path));
for (FileInfo f : files) {
if (!s3files.contains(f.getPath().toUri().toString())) {
meta.delete(f.getPath());
}
}
} catch (Exception e) {
System.out.println("Usage: s3mper metastore resolve <path>\n");
e.printStackTrace();
}
}