HADOOP-17267. Add debug-level logs in Filesystem.close() (#2321)
When a filesystem is closed, the FileSystem log will, at debug level, log the method calling close/closeAll. At trace level: the full calling stack. Contributed by Karen Coppage.
This commit is contained in:
parent
143bdd4188
commit
75d10f8499
|
@ -621,6 +621,7 @@ public abstract class FileSystem extends Configured
|
||||||
* @throws IOException a problem arose closing one or more filesystem.
|
* @throws IOException a problem arose closing one or more filesystem.
|
||||||
*/
|
*/
|
||||||
public static void closeAll() throws IOException {
|
public static void closeAll() throws IOException {
|
||||||
|
debugLogFileSystemClose("closeAll", "");
|
||||||
CACHE.closeAll();
|
CACHE.closeAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,9 +633,23 @@ public abstract class FileSystem extends Configured
|
||||||
*/
|
*/
|
||||||
public static void closeAllForUGI(UserGroupInformation ugi)
|
public static void closeAllForUGI(UserGroupInformation ugi)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
debugLogFileSystemClose("closeAllForUGI", "UGI: " + ugi);
|
||||||
CACHE.closeAll(ugi);
|
CACHE.closeAll(ugi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void debugLogFileSystemClose(String methodName,
|
||||||
|
String additionalInfo) {
|
||||||
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
Throwable throwable = new Throwable().fillInStackTrace();
|
||||||
|
LOGGER.debug("FileSystem.{}() by method: {}); {}", methodName,
|
||||||
|
throwable.getStackTrace()[2], additionalInfo);
|
||||||
|
if (LOGGER.isTraceEnabled()) {
|
||||||
|
LOGGER.trace("FileSystem.{}() full stack trace:", methodName,
|
||||||
|
throwable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Qualify a path to one which uses this FileSystem and, if relative,
|
* Qualify a path to one which uses this FileSystem and, if relative,
|
||||||
* made absolute.
|
* made absolute.
|
||||||
|
@ -2570,6 +2585,9 @@ public abstract class FileSystem extends Configured
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
|
debugLogFileSystemClose("close", "Key: " + key + "; URI: " + getUri()
|
||||||
|
+ "; Object Identity Hash: "
|
||||||
|
+ Integer.toHexString(System.identityHashCode(this)));
|
||||||
// delete all files that were marked as delete-on-exit.
|
// delete all files that were marked as delete-on-exit.
|
||||||
processDeleteOnExit();
|
processDeleteOnExit();
|
||||||
CACHE.remove(this.key, this);
|
CACHE.remove(this.key, this);
|
||||||
|
|
Loading…
Reference in New Issue