FAQ
Repository: hive
Updated Branches:
   refs/heads/master 47b759f84 -> 4cbc4a652


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/4cbc4a65
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/4cbc4a65
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/4cbc4a65

Branch: refs/heads/master
Commit: 4cbc4a652abe87742ccb4ea93e9ddfadce7d3e94
Parents: 47b759f
Author: Nachiket Vaidya <nvaidya@cloudera.com>
Authored: Mon Jun 6 13:01:09 2016 -0500
Committer: Sergio Pena <sergio.pena@cloudera.com>
Committed: Mon Jun 6 13:01:09 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/4cbc4a65/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 8a49bf7..172f58d 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);
+ }
          try {
            Thread.sleep(60000);
          } catch (InterruptedException e) {

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommits @
categorieshive, hadoop
postedJun 6, '16 at 6:02p
activeJun 6, '16 at 6:02p
posts1
users1
websitehive.apache.org

1 user in discussion

Spena: 1 post

People

Translate

site design / logo © 2021 Grokbase