hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sp...@apache.org
Subject [1/4] hive git commit: HIVE-13836: DbNotifications giving an error = Invalid state. Transaction has already started (Nachiket Vaidya, reviewd by Sushanth Sowmyan)
Date Wed, 28 Sep 2016 21:18:07 GMT
Repository: hive
Updated Branches:
  refs/heads/branch-2.1 e045c5a57 -> 878b0e7de


HIVE-13836: DbNotifications giving an error = Invalid state. Transaction has already started
(Nachiket Vaidya, reviewd by Sushanth Sowmyan)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/2c95d368
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/2c95d368
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/2c95d368

Branch: refs/heads/branch-2.1
Commit: 2c95d368c5410981959db823557e8a538f9005d1
Parents: e045c5a
Author: Sergio Pena <sergio.pena@cloudera.com>
Authored: Wed Sep 28 16:05:20 2016 -0500
Committer: Sergio Pena <sergio.pena@cloudera.com>
Committed: Wed Sep 28 16:05:20 2016 -0500

----------------------------------------------------------------------
 .../hive/hcatalog/listener/DbNotificationListener.java    | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/2c95d368/hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/DbNotificationListener.java
----------------------------------------------------------------------
diff --git a/hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/DbNotificationListener.java
b/hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/DbNotificationListener.java
index 7245b9e..0b3d891 100644
--- a/hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/DbNotificationListener.java
+++ b/hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/DbNotificationListener.java
@@ -61,6 +61,8 @@ public class DbNotificationListener extends MetaStoreEventListener {
   private static final Logger LOG = LoggerFactory.getLogger(DbNotificationListener.class.getName());
   private static CleanerThread cleaner = null;
 
+  private static final Object NOTIFICATION_TBL_LOCK = new Object();
+
   // This is the same object as super.conf, but it's convenient to keep a copy of it as a
   // HiveConf rather than a Configuration.
   private HiveConf hiveConf;
@@ -252,7 +254,9 @@ public class DbNotificationListener extends MetaStoreEventListener {
 
   private void enqueue(NotificationEvent event) {
     if (rs != null) {
-      rs.addNotificationEvent(event);
+      synchronized(NOTIFICATION_TBL_LOCK) {
+        rs.addNotificationEvent(event);
+      }
     } else {
       LOG.warn("Dropping event " + event + " since notification is not running.");
     }
@@ -274,7 +278,9 @@ public class DbNotificationListener extends MetaStoreEventListener {
     @Override
     public void run() {
       while (true) {
-        rs.cleanNotificationEvents(ttl);
+        synchronized(NOTIFICATION_TBL_LOCK) {
+          rs.cleanNotificationEvents(ttl);
+        }
         LOG.debug("Cleaner thread done");
         try {
           Thread.sleep(sleepTime);


Mime
View raw message