hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1438116 - /hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/zookeeper/ZooKeeperHiveLockManager.java
Date Thu, 24 Jan 2013 18:19:21 GMT
Author: hashutosh
Date: Thu Jan 24 18:19:21 2013
New Revision: 1438116

URL: http://svn.apache.org/viewvc?rev=1438116&view=rev
Log:
HIVE-3913 : Possible deadlock in ZK lock manager (Mikhail Bautin via Ashutosh Chauhan)

Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/zookeeper/ZooKeeperHiveLockManager.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/zookeeper/ZooKeeperHiveLockManager.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/zookeeper/ZooKeeperHiveLockManager.java?rev=1438116&r1=1438115&r2=1438116&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/zookeeper/ZooKeeperHiveLockManager.java
(original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/zookeeper/ZooKeeperHiveLockManager.java
Thu Jan 24 18:19:21 2013
@@ -119,6 +119,9 @@ public class ZooKeeperHiveLockManager im
         zooKeeper.create("/" +  parent, new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
       } catch (KeeperException e) {
         // ignore if the parent already exists
+        if (e.code() != KeeperException.Code.NODEEXISTS) {
+          LOG.warn("Unexpected ZK exception when creating parent node /" + parent, e);
+        }
       }
 
     } catch (Exception e) {
@@ -254,6 +257,7 @@ public class ZooKeeperHiveLockManager im
           unlock(hiveLock);
         } catch (LockException e) {
           // The lock may have been released. Ignore and continue
+          LOG.warn("Error when releasing lock", e);
         }
       }
     }
@@ -301,6 +305,10 @@ public class ZooKeeperHiveLockManager im
       try {
         if (tryNum > 1) {
           Thread.sleep(sleepTime);
+          if (zooKeeper.getState() == ZooKeeper.States.CLOSED) {
+            // Reconnect if the connection is closed.
+            zooKeeper = null;
+          }
           prepareRetry();
         }
         ret = lockPrimitive(key, mode, keepAlive, parentCreated);
@@ -572,7 +580,7 @@ public class ZooKeeperHiveLockManager im
             data = new HiveLockObjectData(new String(zkpClient.getData(curChild, new DummyWatcher(),
null)));
             data.setClientIp(clientIp);
           } catch (Exception e) {
-            LOG.error("Error in getting data for " + curChild + " " + e);
+            LOG.error("Error in getting data for " + curChild, e);
             // ignore error
           }
         }
@@ -593,7 +601,7 @@ public class ZooKeeperHiveLockManager im
         zooKeeper = null;
       }
     } catch (Exception e) {
-      // ignore all errors
+      LOG.warn("Exception while removing all redundant nodes", e);
     }
   }
 
@@ -615,7 +623,7 @@ public class ZooKeeperHiveLockManager im
         zooKeeper.delete(node, -1);
       }
     } catch (Exception e) {
-      // ignore all errors
+      LOG.warn("Error in checkRedundantNode for node " + node, e);
     }
   }
 



Mime
View raw message