umamaheswararao commented on a change in pull request #941:
URL: https://github.com/apache/hadoop-ozone/pull/941#discussion_r428286559
##########
File path:
hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/OFSPath.java
##########
@@ -238,4 +248,23 @@ static String getTempMountBucketNameOfCurrentUser() throws
IOException {
String username = UserGroupInformation.getCurrentUser().getUserName();
return getTempMountBucketName(username);
}
+
+ /**
+ * Return trash root for the given path.
+ * @return trash root for the given path
+ */
+ public Path getTrashRoot() {
+ try {
+ String username = UserGroupInformation.getCurrentUser().getUserName();
+ URI uri = new URIBuilder().setScheme(OZONE_OFS_URI_SCHEME)
Review comment:
Yes its client side logic. TrashEmptier uses fs to get the directories
and this TrashEmptier runs inside NN, so here it will be in OM server.
If we wanted to reuse the logic, all dirs should be in sync and TrashEmptier
will get the trashRoots and cleanup.
For your ref below is the TrashEmptier code:
```
try {
now = Time.now();
if (now >= end) {
Collection<FileStatus> trashRoots;
trashRoots = fs.getTrashRoots(true); // list all trash dirs
for (FileStatus trashRoot : trashRoots) { // dump each trash
if (!trashRoot.isDirectory())
continue;
try {
TrashPolicyDefault trash = new TrashPolicyDefault(fs, conf);
trash.deleteCheckpoint(trashRoot.getPath(), false);
trash.createCheckpoint(trashRoot.getPath(), new Date(now));
} catch (IOException e) {
LOG.warn("Trash caught: "+e+". Skipping " +
trashRoot.getPath() + ".");
}
}
}
} catch (Exception e) {
LOG.warn("RuntimeException during Trash.Emptier.run(): ", e);
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]