You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by Rajesh Balamohan <rb...@apache.org> on 2020/05/18 00:53:59 UTC

Review Request 72521: HIVE-23487: Optimise PartitionManagementTask

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/72521/
-----------------------------------------------------------

Review request for hive, Ashutosh Chauhan and prasanthj.


Repository: hive-git


Description
-------

Msck.init for every table takes more CPU time than the actual table repair. This was observed on a system which had lots of DB and tables.


Diffs
-----

  ql/src/java/org/apache/hadoop/hive/ql/ddl/misc/msck/MsckOperation.java c05d699bd8 
  ql/src/test/org/apache/hadoop/hive/ql/exec/TestMsckCreatePartitionsInBatches.java 7821f40a82 
  ql/src/test/org/apache/hadoop/hive/ql/exec/TestMsckDropPartitionsInBatches.java 8be31128a1 
  standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/Msck.java f4e109d1b0 
  standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/PartitionManagementTask.java e4488f4709 


Diff: https://reviews.apache.org/r/72521/diff/1/


Testing
-------


Thanks,

Rajesh Balamohan


Re: Review Request 72521: HIVE-23487: Optimise PartitionManagementTask

Posted by Rajesh Balamohan <rb...@apache.org>.

> On May 26, 2020, 11:48 p.m., Ashutosh Chauhan wrote:
> > standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/Msck.java
> > Lines 87-92 (original), 87-97 (patched)
> > <https://reviews.apache.org/r/72521/diff/1/?file=2232456#file2232456line87>
> >
> >     I don't follow how this is an improvement. new Configuration() which I assume is expensive call is still there.
> >     If anything, it appears that this change would make perf worse since earlier new Conf() was guarded by if (msc == null) so would have happened only once, but now will happen everytime.
> >     Can you explain how this change is more performant?

This is because, it was creating this for every table.
 
With the fix in "PartitionManagementTask::run", patch constructs this conf only once and reuses it across tables. (i.e in Configuration msckConf = Msck.getMsckConf(conf);)


- Rajesh


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/72521/#review220874
-----------------------------------------------------------


On May 18, 2020, 12:53 a.m., Rajesh Balamohan wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/72521/
> -----------------------------------------------------------
> 
> (Updated May 18, 2020, 12:53 a.m.)
> 
> 
> Review request for hive, Ashutosh Chauhan and prasanthj.
> 
> 
> Repository: hive-git
> 
> 
> Description
> -------
> 
> Msck.init for every table takes more CPU time than the actual table repair. This was observed on a system which had lots of DB and tables.
> 
> 
> Diffs
> -----
> 
>   ql/src/java/org/apache/hadoop/hive/ql/ddl/misc/msck/MsckOperation.java c05d699bd8 
>   ql/src/test/org/apache/hadoop/hive/ql/exec/TestMsckCreatePartitionsInBatches.java 7821f40a82 
>   ql/src/test/org/apache/hadoop/hive/ql/exec/TestMsckDropPartitionsInBatches.java 8be31128a1 
>   standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/Msck.java f4e109d1b0 
>   standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/PartitionManagementTask.java e4488f4709 
> 
> 
> Diff: https://reviews.apache.org/r/72521/diff/1/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Rajesh Balamohan
> 
>


Re: Review Request 72521: HIVE-23487: Optimise PartitionManagementTask

Posted by Ashutosh Chauhan <ha...@apache.org>.

> On May 26, 2020, 11:48 p.m., Ashutosh Chauhan wrote:
> > standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/Msck.java
> > Lines 87-92 (original), 87-97 (patched)
> > <https://reviews.apache.org/r/72521/diff/1/?file=2232456#file2232456line87>
> >
> >     I don't follow how this is an improvement. new Configuration() which I assume is expensive call is still there.
> >     If anything, it appears that this change would make perf worse since earlier new Conf() was guarded by if (msc == null) so would have happened only once, but now will happen everytime.
> >     Can you explain how this change is more performant?
> 
> Rajesh Balamohan wrote:
>     This is because, it was creating this for every table.
>      
>     With the fix in "PartitionManagementTask::run", patch constructs this conf only once and reuses it across tables. (i.e in Configuration msckConf = Msck.getMsckConf(conf);)

But how? Msck.getMsckConf() constructs new Configuration() every time. Also, it is invoked everytime for execute(). So, I still don't see it.


- Ashutosh


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/72521/#review220874
-----------------------------------------------------------


On May 18, 2020, 12:53 a.m., Rajesh Balamohan wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/72521/
> -----------------------------------------------------------
> 
> (Updated May 18, 2020, 12:53 a.m.)
> 
> 
> Review request for hive, Ashutosh Chauhan and prasanthj.
> 
> 
> Repository: hive-git
> 
> 
> Description
> -------
> 
> Msck.init for every table takes more CPU time than the actual table repair. This was observed on a system which had lots of DB and tables.
> 
> 
> Diffs
> -----
> 
>   ql/src/java/org/apache/hadoop/hive/ql/ddl/misc/msck/MsckOperation.java c05d699bd8 
>   ql/src/test/org/apache/hadoop/hive/ql/exec/TestMsckCreatePartitionsInBatches.java 7821f40a82 
>   ql/src/test/org/apache/hadoop/hive/ql/exec/TestMsckDropPartitionsInBatches.java 8be31128a1 
>   standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/Msck.java f4e109d1b0 
>   standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/PartitionManagementTask.java e4488f4709 
> 
> 
> Diff: https://reviews.apache.org/r/72521/diff/1/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Rajesh Balamohan
> 
>


Re: Review Request 72521: HIVE-23487: Optimise PartitionManagementTask

Posted by Ashutosh Chauhan <ha...@apache.org>.

> On May 26, 2020, 11:48 p.m., Ashutosh Chauhan wrote:
> > standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/Msck.java
> > Lines 87-92 (original), 87-97 (patched)
> > <https://reviews.apache.org/r/72521/diff/1/?file=2232456#file2232456line87>
> >
> >     I don't follow how this is an improvement. new Configuration() which I assume is expensive call is still there.
> >     If anything, it appears that this change would make perf worse since earlier new Conf() was guarded by if (msc == null) so would have happened only once, but now will happen everytime.
> >     Can you explain how this change is more performant?
> 
> Rajesh Balamohan wrote:
>     This is because, it was creating this for every table.
>      
>     With the fix in "PartitionManagementTask::run", patch constructs this conf only once and reuses it across tables. (i.e in Configuration msckConf = Msck.getMsckConf(conf);)
> 
> Ashutosh Chauhan wrote:
>     But how? Msck.getMsckConf() constructs new Configuration() every time. Also, it is invoked everytime for execute(). So, I still don't see it.

I meant run() invokes getMsckConf() for every table which in turns does new Configuration()


- Ashutosh


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/72521/#review220874
-----------------------------------------------------------


On May 18, 2020, 12:53 a.m., Rajesh Balamohan wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/72521/
> -----------------------------------------------------------
> 
> (Updated May 18, 2020, 12:53 a.m.)
> 
> 
> Review request for hive, Ashutosh Chauhan and prasanthj.
> 
> 
> Repository: hive-git
> 
> 
> Description
> -------
> 
> Msck.init for every table takes more CPU time than the actual table repair. This was observed on a system which had lots of DB and tables.
> 
> 
> Diffs
> -----
> 
>   ql/src/java/org/apache/hadoop/hive/ql/ddl/misc/msck/MsckOperation.java c05d699bd8 
>   ql/src/test/org/apache/hadoop/hive/ql/exec/TestMsckCreatePartitionsInBatches.java 7821f40a82 
>   ql/src/test/org/apache/hadoop/hive/ql/exec/TestMsckDropPartitionsInBatches.java 8be31128a1 
>   standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/Msck.java f4e109d1b0 
>   standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/PartitionManagementTask.java e4488f4709 
> 
> 
> Diff: https://reviews.apache.org/r/72521/diff/1/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Rajesh Balamohan
> 
>


Re: Review Request 72521: HIVE-23487: Optimise PartitionManagementTask

Posted by Rajesh Balamohan <rb...@apache.org>.

> On May 26, 2020, 11:48 p.m., Ashutosh Chauhan wrote:
> > standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/Msck.java
> > Lines 87-92 (original), 87-97 (patched)
> > <https://reviews.apache.org/r/72521/diff/1/?file=2232456#file2232456line87>
> >
> >     I don't follow how this is an improvement. new Configuration() which I assume is expensive call is still there.
> >     If anything, it appears that this change would make perf worse since earlier new Conf() was guarded by if (msc == null) so would have happened only once, but now will happen everytime.
> >     Can you explain how this change is more performant?
> 
> Rajesh Balamohan wrote:
>     This is because, it was creating this for every table.
>      
>     With the fix in "PartitionManagementTask::run", patch constructs this conf only once and reuses it across tables. (i.e in Configuration msckConf = Msck.getMsckConf(conf);)
> 
> Ashutosh Chauhan wrote:
>     But how? Msck.getMsckConf() constructs new Configuration() every time. Also, it is invoked everytime for execute(). So, I still don't see it.
> 
> Ashutosh Chauhan wrote:
>     I meant run() invokes getMsckConf() for every table which in turns does new Configuration()

Issue is w.r.t to construction of "Configuration" in "msck.init" for every table.

https://github.com/apache/hive/blob/master/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/PartitionManagementTask.java#L150

https://github.com/apache/hive/blob/master/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/PartitionManagementTask.java#L158

https://github.com/apache/hive/blob/master/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/PartitionManagementTask.java#L223

https://github.com/apache/hive/blob/master/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/Msck.java#L88


With the patch, we set the "EXPRESSION_PROXY_CLASS" just once in "PartitionManagementTask::run()" and pass it to MsckThread. This gets rid "new Conf" in "Msck::init".


- Rajesh


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/72521/#review220874
-----------------------------------------------------------


On May 18, 2020, 12:53 a.m., Rajesh Balamohan wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/72521/
> -----------------------------------------------------------
> 
> (Updated May 18, 2020, 12:53 a.m.)
> 
> 
> Review request for hive, Ashutosh Chauhan and prasanthj.
> 
> 
> Repository: hive-git
> 
> 
> Description
> -------
> 
> Msck.init for every table takes more CPU time than the actual table repair. This was observed on a system which had lots of DB and tables.
> 
> 
> Diffs
> -----
> 
>   ql/src/java/org/apache/hadoop/hive/ql/ddl/misc/msck/MsckOperation.java c05d699bd8 
>   ql/src/test/org/apache/hadoop/hive/ql/exec/TestMsckCreatePartitionsInBatches.java 7821f40a82 
>   ql/src/test/org/apache/hadoop/hive/ql/exec/TestMsckDropPartitionsInBatches.java 8be31128a1 
>   standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/Msck.java f4e109d1b0 
>   standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/PartitionManagementTask.java e4488f4709 
> 
> 
> Diff: https://reviews.apache.org/r/72521/diff/1/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Rajesh Balamohan
> 
>


Re: Review Request 72521: HIVE-23487: Optimise PartitionManagementTask

Posted by Ashutosh Chauhan <ha...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/72521/#review220874
-----------------------------------------------------------




standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/Msck.java
Lines 87-92 (original), 87-97 (patched)
<https://reviews.apache.org/r/72521/#comment309594>

    I don't follow how this is an improvement. new Configuration() which I assume is expensive call is still there.
    If anything, it appears that this change would make perf worse since earlier new Conf() was guarded by if (msc == null) so would have happened only once, but now will happen everytime.
    Can you explain how this change is more performant?


- Ashutosh Chauhan


On May 18, 2020, 12:53 a.m., Rajesh Balamohan wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/72521/
> -----------------------------------------------------------
> 
> (Updated May 18, 2020, 12:53 a.m.)
> 
> 
> Review request for hive, Ashutosh Chauhan and prasanthj.
> 
> 
> Repository: hive-git
> 
> 
> Description
> -------
> 
> Msck.init for every table takes more CPU time than the actual table repair. This was observed on a system which had lots of DB and tables.
> 
> 
> Diffs
> -----
> 
>   ql/src/java/org/apache/hadoop/hive/ql/ddl/misc/msck/MsckOperation.java c05d699bd8 
>   ql/src/test/org/apache/hadoop/hive/ql/exec/TestMsckCreatePartitionsInBatches.java 7821f40a82 
>   ql/src/test/org/apache/hadoop/hive/ql/exec/TestMsckDropPartitionsInBatches.java 8be31128a1 
>   standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/Msck.java f4e109d1b0 
>   standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/PartitionManagementTask.java e4488f4709 
> 
> 
> Diff: https://reviews.apache.org/r/72521/diff/1/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Rajesh Balamohan
> 
>