A case previously handled by a colleague, recorded
After the hive upgrade to 0.13, when the table was created, the issue of lock contention was found, with the following information:
Conflicting lock present for VIPDW mode EXCLUSIVE
There is no problem with locking in hive, but the lock here is a database level lock! And it's an exclusive lock! The size of the lock is too large, and this lock causes all hive operations on the library to wait for the lock to be released.
This should be the lock to get the watch. How can I take the lock of the library?
Based on previous analysis, hive locks are implemented by the Dummytxnmanager class:
In the Dummytxnmanager class, the exclusive lock is obtained as follows
Code path:
Ql/src/java/org/apache/hadoop/hive/ql/lockmgr/dummytxnmanager.java
Original code:
for (Writeentity output : plan.getoutputs ()) { log.debug ("adding " + output.getname () + " to list of lock outputs "); list Change the source code, the database of the exclusive lock this paragraph removed:
for (Writeentity output : plan.getoutputs ()) { log.debug (" adding " + output.getname () + " to list of lock outputs "); List<HiveLockObj> lockObj = null; if (Output.gettype () == writeentity.type.database) { log.debug ( "Output has database:" +output.getdatabase ()); log.debug (" removing unnecessary output lock aquirement on "+output .getDatabase () +" database " ) // lockobjects.addall (getLockObjects (Plan, output.getdatabase (), null, // null, // output.iscomplete () ? HiveLockMode.EXCLUSIVE : hivelockmode.shared)); } else if (Output.gettyp () == writeentity.type.table) { lockobj = getlockobjects ( plan, null, output.gettable (), null, output.iscomplete () ? hivelockmode.exclusive : hivelockmode . SHARED); } else if (Output.gettyp () == WriteEntity.Type.PARTITION) { lockobj = getlockobjects ( plan, null, null, output.getpartition (), hivelockmode.exclusive); } // in case of dynamic queries, it is possible to have incomplete dummy partitions else if (Output.gettyp () == WriteEntity.Type.DUMMYPARTITION) { lockobj = getlockobjects ( plan, null, null, output.getpartition (), hivelockmode.shared); } if (lockobj != null) { lockobjects.addall (lockobj); ctx.getoutputlockobjects (). Put ( Output , lockobj); } }This article is from the "Food and Light Blog" blog, please make sure to keep this source http://caiguangguang.blog.51cto.com/1652935/1554541
hive0.13 Database lock problem fix