Peter Vary commented on HIVE-14979:

[~ashutoshc] When creating this patch I have found this code which I do not 
really understand (marked by "->"):
package org.apache.hadoop.hive.ql.lockmgr.zookeeper;
public class ZooKeeperHiveLockManager implements HiveLockManager {
  private static List<HiveLock> getLocks(HiveConf conf,
      HiveLockObject key, String parent, boolean verifyTablePartition, boolean 
      throws LockException {
        if (fetchData) {
          try {
            data = new HiveLockObjectData(new 
->            data.setClientIp(clientIp);
          } catch (Exception e) {
            LOG.error("Error in getting data for " + curChild, e);
            // ignore error

Why do we update the clientIp of every lock when fetching (reading) data from 
zookeeper. By any chance do you remember anything why this was needed? Seems 
like it is done by purpose but during my testing I haven't find any occasion 
when this was unset.

This is set by this code which seems to me that is quiet safe, and done every 
time when a new lock is created:
  private ZooKeeperHiveLock lockPrimitive(HiveLockObject key,
      HiveLockMode mode, boolean keepAlive, boolean parentCreated,
      Set<String> conflictingLocks)
      throws Exception {
    HiveLockObjectData lockData = key.getData();


> Removing stale Zookeeper locks at HiveServer2 initialization
> ------------------------------------------------------------
>                 Key: HIVE-14979
>                 URL: https://issues.apache.org/jira/browse/HIVE-14979
>             Project: Hive
>          Issue Type: Improvement
>          Components: Locking
>            Reporter: Peter Vary
>            Assignee: Peter Vary
>         Attachments: HIVE-14979.patch
> HiveServer2 could use Zookeeper to store token that indicate that particular 
> tables are locked with the creation of persistent Zookeeper objects. 
> A problem can occur when a HiveServer2 instance creates a lock on a table and 
> the HiveServer2 instances crashes ("Out of Memory" for example) and the locks 
> are not released in Zookeeper. This lock will then remain until it is 
> manually cleared by an admin.
> There should be a way to remove stale locks at HiveServer2 initialization, 
> helping the admins life.

This message was sent by Atlassian JIRA

Reply via email to