lirui-apache commented on a change in pull request #3790:
URL: https://github.com/apache/iceberg/pull/3790#discussion_r777848628
##########
File path:
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveMetastore.java
##########
@@ -144,13 +171,35 @@ public void stop() {
if (executorService != null) {
executorService.shutdown();
}
- if (hiveLocalDir != null) {
- hiveLocalDir.delete();
- }
if (baseHandler != null) {
baseHandler.shutdown();
}
METASTORE_THREADS_SHUTDOWN.invoke();
+ HMS_HANDLER_THREAD_LOCAL_CONF.remove();
+ HMS_HANDLER_THREAD_LOCAL_TXN.remove();
+ Object connPool = CONN_POOL.get();
+ CONN_POOL.set(null);
+ if (connPool instanceof Closeable) {
+ try {
+ ((Closeable) connPool).close();
+ } catch (IOException e) {
+ throw new RuntimeException("Failed to close connection pool in
TxnHandler", e);
+ }
+ }
+ OBJECT_STORE_PROP.set(null);
+ PersistenceManagerFactory pmf = OBJECT_STORE_PMF.get();
+ if (pmf != null) {
+ pmf.close();
+ }
+ if (hiveLocalDir != null && hiveLocalDir.exists()) {
+ try {
+ Path localDirPath = new Path(hiveLocalDir.getAbsolutePath());
+ FileSystem fs = Util.getFs(localDirPath, hiveConf);
+ Preconditions.checkState(fs.delete(localDirPath, true), "Failed to
delete " + localDirPath);
+ } catch (IOException e) {
+ throw new RuntimeException("Failed to delete local dir " +
hiveLocalDir.getAbsolutePath(), e);
Review comment:
Do you mean to allow this method to throw `IOException`? Then the
signature needs update and will probably incur more changes. Will do that if
it's OK.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]