You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/12/05 14:33:22 UTC

[GitHub] [iceberg] smallx commented on a change in pull request #3606: Hive: make sure to unlock table when the finally block is not executed

smallx commented on a change in pull request #3606:
URL: https://github.com/apache/iceberg/pull/3606#discussion_r762570545



##########
File path: hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java
##########
@@ -106,6 +107,38 @@
       GC_ENABLED, "external.table.purge"
   );
 
+  private static Map<Long, String> tableLocksById;
+  private static ClientPool<IMetaStoreClient, TException> globalMetaClients;
+
+  /**
+   * Initialize a hook to avoid that the finally code block used to unlock hive table may not be executed
+   * due to the following conditions:
+   *   - System.exit(N)
+   *   - all non-daemon threads exit
+   *
+   * Also, to avoid memory leaks caused by addShutdownHook, we use a class level hook.
+   */
+  private static synchronized void initUnlockTableHook(ClientPool metaClients) {
+    globalMetaClients = metaClients;

Review comment:
       Thanks. I've fixed it.




-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org