This is an automated email from the ASF dual-hosted git repository.

ayushsaxena pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 838c7d7db57 HIVE-27386: Avoid duplicate audit log in 
cleanupHandlerContext (#4366). (Wechar Yu, reviewed by Ayush Saxena, Zhihua 
Deng, Akshat Mathur, Attila Turoczy)
838c7d7db57 is described below

commit 838c7d7db57002d1cc408b90b54889bc1364b5b3
Author: Wechar Yu <[email protected]>
AuthorDate: Tue Jun 6 15:35:47 2023 +0800

    HIVE-27386: Avoid duplicate audit log in cleanupHandlerContext (#4366). 
(Wechar Yu, reviewed by Ayush Saxena, Zhihua Deng, Akshat Mathur, Attila 
Turoczy)
---
 .../main/java/org/apache/hadoop/hive/metastore/HMSHandler.java | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
 
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
index 66303f12ef8..206d690b79d 100644
--- 
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
+++ 
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
@@ -173,17 +173,19 @@ public class HMSHandler extends FacebookBase implements 
IHMSHandler {
   }
 
   static void cleanupHandlerContext() {
+    AtomicBoolean cleanedRawStore = new AtomicBoolean(false);
     try {
       HMSHandlerContext.getRawStore().ifPresent(rs -> {
         logAndAudit("Cleaning up thread local RawStore...");
         rs.shutdown();
+        cleanedRawStore.set(true);
       });
     } finally {
-      HMSHandlerContext.getHMSHandler().ifPresent(handler -> {
-        handler.notifyMetaListenersOnShutDown();
-      });
+      
HMSHandlerContext.getHMSHandler().ifPresent(HMSHandler::notifyMetaListenersOnShutDown);
+      if (cleanedRawStore.get()) {
+        logAndAudit("Done cleaning up thread local RawStore");
+      }
       HMSHandlerContext.clear();
-      logAndAudit("Done cleaning up thread local RawStore");
     }
   }
 

Reply via email to