<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: what is the correct way to clear obsolete locks under DbTxnManager? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/what-is-the-correct-way-to-clear-obsolete-locks-under/m-p/348403#M235357</link>
    <description>&lt;P&gt;some more information to add:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it seems that&lt;SPAN&gt;&amp;nbsp;in DbTxnManager, failed or terminated sql queries will not leave stale locks behind, as there are heartbeat mechanisms involved. Only when the hs2 process is not functioning properly, like when the hs2 host crashed, will there be staled locks left behind, and we have to manually clear them by logging into the metastore db.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="michalLi_0-1658391710655.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/34979i9A9D199C8B475697/image-size/medium?v=v2&amp;amp;px=400" role="button" title="michalLi_0-1658391710655.png" alt="michalLi_0-1658391710655.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Jul 2022 08:24:13 GMT</pubDate>
    <dc:creator>michalLi</dc:creator>
    <dc:date>2022-07-21T08:24:13Z</dc:date>
    <item>
      <title>what is the correct way to clear obsolete locks under DbTxnManager?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/what-is-the-correct-way-to-clear-obsolete-locks-under/m-p/348154#M235327</link>
      <description>&lt;P&gt;It seems that when we use DbTxnManager in CDH6.X, if SQL query does not complete successfully or is terminated abruptly (ex. ctrl+c), then the locks it implicitly acquired will not be automatically released, and other new SQL queries which references the same table/partition will be blocked trying to acquire necessary locks, and&amp;nbsp;hence can't be executed successfully.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;we can't manually clear the locks by issuing unlock statements under&amp;nbsp;DbTxnManager,because it will pop up error:&amp;nbsp;Current transaction manager does not support explicit lock requests.Transaction manager:org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it seems currently the only way to clear above obsolete locks is to log into the metastore db and use sql statements like below to delete records from table hive_locks:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;select hl_lock_ext_id from HIVE_LOCKS where HL_TABLE=’prcs_task’;&lt;BR /&gt;delete from hive_locks where hl_lock_ext_id = 125542;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am wondering, if this is the correct way to&amp;nbsp;manually clear obsolete locks under DbTxnManager?&lt;/P&gt;
&lt;P&gt;And are there any progress in the hive community, regarding how to automatically clear obsolete locks caused by failed or terminated sql queries? like some sort of timeout and house keeping mechanism?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 14:46:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/what-is-the-correct-way-to-clear-obsolete-locks-under/m-p/348154#M235327</guid>
      <dc:creator>michalLi</dc:creator>
      <dc:date>2022-09-16T14:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: what is the correct way to clear obsolete locks under DbTxnManager?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/what-is-the-correct-way-to-clear-obsolete-locks-under/m-p/348403#M235357</link>
      <description>&lt;P&gt;some more information to add:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it seems that&lt;SPAN&gt;&amp;nbsp;in DbTxnManager, failed or terminated sql queries will not leave stale locks behind, as there are heartbeat mechanisms involved. Only when the hs2 process is not functioning properly, like when the hs2 host crashed, will there be staled locks left behind, and we have to manually clear them by logging into the metastore db.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="michalLi_0-1658391710655.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/34979i9A9D199C8B475697/image-size/medium?v=v2&amp;amp;px=400" role="button" title="michalLi_0-1658391710655.png" alt="michalLi_0-1658391710655.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2022 08:24:13 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/what-is-the-correct-way-to-clear-obsolete-locks-under/m-p/348403#M235357</guid>
      <dc:creator>michalLi</dc:creator>
      <dc:date>2022-07-21T08:24:13Z</dc:date>
    </item>
  </channel>
</rss>

