Path path = new Path(args[0]);
conf.set("s3mper.metastore.deleteMarker.enabled", "true");
DynamoDBMetastore meta = new DynamoDBMetastore();
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");