You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by sp...@apache.org on 2016/06/06 18:02:25 UTC
hive git commit: HIVE-13836: DbNotifications giving an error =
Invalid state. Transaction has already started (Nachiket Vaidya,
reviewd by Sushanth Sowmyan)
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 <nv...@cloudera.com>
Authored: Mon Jun 6 13:01:09 2016 -0500
Committer: Sergio Pena <se...@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) {