hive0.13 Database lock problem fix

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.