[ https://issues.apache.org/jira/browse/HIVE-14979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15581634#comment-15581634 ]
Peter Vary commented on HIVE-14979: ----------------------------------- [~ashutoshc] When creating this patch I have found this code which I do not really understand (marked by "->"): {code} 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 fetchData) throws LockException { [..] if (fetchData) { try { data = new HiveLockObjectData(new String(curatorFramework.getData().watched().forPath(curChild))); -> data.setClientIp(clientIp); } catch (Exception e) { LOG.error("Error in getting data for " + curChild, e); // ignore error } } [..] {code} 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: {code} private ZooKeeperHiveLock lockPrimitive(HiveLockObject key, HiveLockMode mode, boolean keepAlive, boolean parentCreated, Set<String> conflictingLocks) throws Exception { [..] HiveLockObjectData lockData = key.getData(); lockData.setClientIp(clientIp); {code} Thanks, Peter > 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 (v6.3.4#6332)