You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "dengzhhu653 (via GitHub)" <gi...@apache.org> on 2025/06/04 04:18:07 UTC
[PR] HIVE-28990: Collecting the non-native summary can be slow to raise th… [hive]
dengzhhu653 opened a new pull request, #5843:
URL: https://github.com/apache/hive/pull/5843
…e timeout
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://cwiki.apache.org/confluence/display/Hive/HowToContribute
2. Ensure that you have created an issue on the Hive project JIRA: https://issues.apache.org/jira/projects/HIVE/summary
3. Ensure you have added or run the appropriate tests for your PR:
4. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP]HIVE-XXXXX: Your PR title ...'.
5. Be sure to keep the PR description updated to reflect all changes.
6. Please write your PR title to summarize what this PR proposes.
7. If possible, provide a concise example to reproduce the issue for a faster review.
-->
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description, screenshot and/or a reproducable example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Hive versions or within the unreleased branches such as master.
If no, write 'No'.
-->
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-28990: Collecting the non-native summary can be slow to raise th… [hive]
Posted by "saihemanth-cloudera (via GitHub)" <gi...@apache.org>.
saihemanth-cloudera commented on code in PR #5843:
URL: https://github.com/apache/hive/pull/5843#discussion_r2127094849
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/tools/metatool/MetaToolTaskMetadataSummary.java:
##########
@@ -183,25 +185,45 @@ Pair<MetaSummarySchema, List<MetadataTableSummary>> obtainAndFilterSummary() thr
MetaSummarySchema extraSchema = new MetaSummarySchema();
for (Class<? extends MetaSummaryHandler> handler : nonNativeSummaries.keys()) {
Configuration conf = getObjectStore().getConf();
+ List<Future<?>> futures = new ArrayList<>();
try (MetaSummaryHandler summaryHandler = JavaUtils.newInstance(handler)) {
summaryHandler.setConf(conf);
summaryHandler.initialize(MetaStoreUtils.getDefaultCatalog(conf), formatJson, extraSchema);
List<MetadataTableSummary> tableSummaries = nonNativeSummaries.get(handler);
// Filter those we don't want to collect
Set<Long> tableIds = getObjectStore().filterTablesForSummary(tableSummaries, recentUpdatedDays, maxNonNativeTables);
+ if (service == null) {
+ int nThreads = Math.min(MetastoreConf.getIntVar(conf, MetastoreConf.ConfVars.METADATA_SUMMARY_NONNATIVE_THREADS),
+ tableIds.size());
+ if (nThreads > 1) {
+ service = Executors.newFixedThreadPool(nThreads,
+ new ThreadFactoryBuilder().setDaemon(true).setNameFormat("MetaToolTaskMetadataSummary #%d").build());
+ }
+ }
for (MetadataTableSummary summary : tableSummaries) {
- if (tableIds.contains(summary.getTableId())) {
+ if (!tableIds.contains(summary.getTableId())) {
+ filteredSummary.put(summary, null);
Review Comment:
Instead of a Map with value type void, we could have this variable type as Set<MetadataTableSummary>.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-28990: Collecting the non-native summary can be slow to raise th… [hive]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #5843:
URL: https://github.com/apache/hive/pull/5843#issuecomment-2943474619
## [](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=5843) **Quality Gate passed**
Issues
 [2 New issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=5843&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=5843&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=5843&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=5843&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=5843&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=5843)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-28990: Collecting the non-native summary can be slow to raise th… [hive]
Posted by "dengzhhu653 (via GitHub)" <gi...@apache.org>.
dengzhhu653 commented on code in PR #5843:
URL: https://github.com/apache/hive/pull/5843#discussion_r2128193734
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/tools/metatool/MetaToolTaskMetadataSummary.java:
##########
@@ -183,25 +185,45 @@ Pair<MetaSummarySchema, List<MetadataTableSummary>> obtainAndFilterSummary() thr
MetaSummarySchema extraSchema = new MetaSummarySchema();
for (Class<? extends MetaSummaryHandler> handler : nonNativeSummaries.keys()) {
Configuration conf = getObjectStore().getConf();
+ List<Future<?>> futures = new ArrayList<>();
try (MetaSummaryHandler summaryHandler = JavaUtils.newInstance(handler)) {
summaryHandler.setConf(conf);
summaryHandler.initialize(MetaStoreUtils.getDefaultCatalog(conf), formatJson, extraSchema);
List<MetadataTableSummary> tableSummaries = nonNativeSummaries.get(handler);
// Filter those we don't want to collect
Set<Long> tableIds = getObjectStore().filterTablesForSummary(tableSummaries, recentUpdatedDays, maxNonNativeTables);
+ if (service == null) {
+ int nThreads = Math.min(MetastoreConf.getIntVar(conf, MetastoreConf.ConfVars.METADATA_SUMMARY_NONNATIVE_THREADS),
+ tableIds.size());
+ if (nThreads > 1) {
+ service = Executors.newFixedThreadPool(nThreads,
+ new ThreadFactoryBuilder().setDaemon(true).setNameFormat("MetaToolTaskMetadataSummary #%d").build());
+ }
+ }
for (MetadataTableSummary summary : tableSummaries) {
- if (tableIds.contains(summary.getTableId())) {
+ if (!tableIds.contains(summary.getTableId())) {
+ filteredSummary.put(summary, null);
+ } else {
TableName tableName = new TableName(summary.getCatalogName(),
summary.getDbName(), summary.getTblName());
- summaryHandler.appendSummary(tableName, summary);
- } else {
- filteredSummary.put(summary, null);
- }
- // If there is an exception while collecting the summary, remove it
- if (summary.isDropped()) {
- filteredSummary.put(summary, null);
+ Runnable task = () -> {
+ summaryHandler.appendSummary(tableName, summary);
Review Comment:
My idea is to try the best to collect a `correct` summary, if we just ignore the exception(imaging the table is dropped when comes to collect), this will give a wrong insight of the table, which could be misleading.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-28990: Collecting the non-native summary can be slow to raise th… [hive]
Posted by "dengzhhu653 (via GitHub)" <gi...@apache.org>.
dengzhhu653 commented on code in PR #5843:
URL: https://github.com/apache/hive/pull/5843#discussion_r2128193734
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/tools/metatool/MetaToolTaskMetadataSummary.java:
##########
@@ -183,25 +185,45 @@ Pair<MetaSummarySchema, List<MetadataTableSummary>> obtainAndFilterSummary() thr
MetaSummarySchema extraSchema = new MetaSummarySchema();
for (Class<? extends MetaSummaryHandler> handler : nonNativeSummaries.keys()) {
Configuration conf = getObjectStore().getConf();
+ List<Future<?>> futures = new ArrayList<>();
try (MetaSummaryHandler summaryHandler = JavaUtils.newInstance(handler)) {
summaryHandler.setConf(conf);
summaryHandler.initialize(MetaStoreUtils.getDefaultCatalog(conf), formatJson, extraSchema);
List<MetadataTableSummary> tableSummaries = nonNativeSummaries.get(handler);
// Filter those we don't want to collect
Set<Long> tableIds = getObjectStore().filterTablesForSummary(tableSummaries, recentUpdatedDays, maxNonNativeTables);
+ if (service == null) {
+ int nThreads = Math.min(MetastoreConf.getIntVar(conf, MetastoreConf.ConfVars.METADATA_SUMMARY_NONNATIVE_THREADS),
+ tableIds.size());
+ if (nThreads > 1) {
+ service = Executors.newFixedThreadPool(nThreads,
+ new ThreadFactoryBuilder().setDaemon(true).setNameFormat("MetaToolTaskMetadataSummary #%d").build());
+ }
+ }
for (MetadataTableSummary summary : tableSummaries) {
- if (tableIds.contains(summary.getTableId())) {
+ if (!tableIds.contains(summary.getTableId())) {
+ filteredSummary.put(summary, null);
+ } else {
TableName tableName = new TableName(summary.getCatalogName(),
summary.getDbName(), summary.getTblName());
- summaryHandler.appendSummary(tableName, summary);
- } else {
- filteredSummary.put(summary, null);
- }
- // If there is an exception while collecting the summary, remove it
- if (summary.isDropped()) {
- filteredSummary.put(summary, null);
+ Runnable task = () -> {
+ summaryHandler.appendSummary(tableName, summary);
Review Comment:
My idea is to try the best to collect a `correct` summary, if we just ignore the exception, this will give a wrong insight of the table, which could be misleading.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-28990: Collecting the non-native summary can be slow to raise th… [hive]
Posted by "dengzhhu653 (via GitHub)" <gi...@apache.org>.
dengzhhu653 merged PR #5843:
URL: https://github.com/apache/hive/pull/5843
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-28990: Collecting the non-native summary can be slow to raise th… [hive]
Posted by "dengzhhu653 (via GitHub)" <gi...@apache.org>.
dengzhhu653 commented on code in PR #5843:
URL: https://github.com/apache/hive/pull/5843#discussion_r2128200463
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/tools/metatool/MetaToolTaskMetadataSummary.java:
##########
@@ -183,25 +185,45 @@ Pair<MetaSummarySchema, List<MetadataTableSummary>> obtainAndFilterSummary() thr
MetaSummarySchema extraSchema = new MetaSummarySchema();
for (Class<? extends MetaSummaryHandler> handler : nonNativeSummaries.keys()) {
Configuration conf = getObjectStore().getConf();
+ List<Future<?>> futures = new ArrayList<>();
try (MetaSummaryHandler summaryHandler = JavaUtils.newInstance(handler)) {
summaryHandler.setConf(conf);
summaryHandler.initialize(MetaStoreUtils.getDefaultCatalog(conf), formatJson, extraSchema);
List<MetadataTableSummary> tableSummaries = nonNativeSummaries.get(handler);
// Filter those we don't want to collect
Set<Long> tableIds = getObjectStore().filterTablesForSummary(tableSummaries, recentUpdatedDays, maxNonNativeTables);
+ if (service == null) {
+ int nThreads = Math.min(MetastoreConf.getIntVar(conf, MetastoreConf.ConfVars.METADATA_SUMMARY_NONNATIVE_THREADS),
+ tableIds.size());
+ if (nThreads > 1) {
+ service = Executors.newFixedThreadPool(nThreads,
+ new ThreadFactoryBuilder().setDaemon(true).setNameFormat("MetaToolTaskMetadataSummary #%d").build());
+ }
+ }
for (MetadataTableSummary summary : tableSummaries) {
- if (tableIds.contains(summary.getTableId())) {
+ if (!tableIds.contains(summary.getTableId())) {
+ filteredSummary.put(summary, null);
+ } else {
TableName tableName = new TableName(summary.getCatalogName(),
summary.getDbName(), summary.getTblName());
- summaryHandler.appendSummary(tableName, summary);
- } else {
- filteredSummary.put(summary, null);
- }
- // If there is an exception while collecting the summary, remove it
- if (summary.isDropped()) {
- filteredSummary.put(summary, null);
+ Runnable task = () -> {
+ summaryHandler.appendSummary(tableName, summary);
+ // If there is an exception while collecting the summary, remove it
+ if (summary.isDropped()) {
+ filteredSummary.put(summary, null);
+ }
+ };
+ if (service != null) {
+ futures.add(service.submit(task));
+ } else {
+ task.run();
+ }
}
}
+ // Waiting for the result before closing the MetaSummaryHandler
+ for (Future<?> future : futures) {
+ future.get();
Review Comment:
the timeout is treated outside this method,
https://github.com/apache/hive/blob/5c64b95c41bcd556b0f0d21648ac782d15cf14c8/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/tools/metatool/MetaToolTaskMetadataSummary.java#L117-L118
If the task is over the time limit, the main thread will be timeout and exit
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-28990: Collecting the non-native summary can be slow to raise th… [hive]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #5843:
URL: https://github.com/apache/hive/pull/5843#issuecomment-2939846414
## [](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=5843) **Quality Gate passed**
Issues
 [1 New issue](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=5843&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=5843&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=5843&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=5843&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=5843&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=5843)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-28990: Collecting the non-native summary can be slow to raise th… [hive]
Posted by "dengzhhu653 (via GitHub)" <gi...@apache.org>.
dengzhhu653 commented on code in PR #5843:
URL: https://github.com/apache/hive/pull/5843#discussion_r2128201580
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/tools/metatool/MetaToolTaskMetadataSummary.java:
##########
@@ -183,25 +185,45 @@ Pair<MetaSummarySchema, List<MetadataTableSummary>> obtainAndFilterSummary() thr
MetaSummarySchema extraSchema = new MetaSummarySchema();
for (Class<? extends MetaSummaryHandler> handler : nonNativeSummaries.keys()) {
Configuration conf = getObjectStore().getConf();
+ List<Future<?>> futures = new ArrayList<>();
try (MetaSummaryHandler summaryHandler = JavaUtils.newInstance(handler)) {
summaryHandler.setConf(conf);
summaryHandler.initialize(MetaStoreUtils.getDefaultCatalog(conf), formatJson, extraSchema);
List<MetadataTableSummary> tableSummaries = nonNativeSummaries.get(handler);
// Filter those we don't want to collect
Set<Long> tableIds = getObjectStore().filterTablesForSummary(tableSummaries, recentUpdatedDays, maxNonNativeTables);
+ if (service == null) {
+ int nThreads = Math.min(MetastoreConf.getIntVar(conf, MetastoreConf.ConfVars.METADATA_SUMMARY_NONNATIVE_THREADS),
+ tableIds.size());
+ if (nThreads > 1) {
+ service = Executors.newFixedThreadPool(nThreads,
+ new ThreadFactoryBuilder().setDaemon(true).setNameFormat("MetaToolTaskMetadataSummary #%d").build());
+ }
+ }
for (MetadataTableSummary summary : tableSummaries) {
- if (tableIds.contains(summary.getTableId())) {
+ if (!tableIds.contains(summary.getTableId())) {
+ filteredSummary.put(summary, null);
Review Comment:
yes, i will change that
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-28990: Collecting the non-native summary can be slow to raise th… [hive]
Posted by "saihemanth-cloudera (via GitHub)" <gi...@apache.org>.
saihemanth-cloudera commented on code in PR #5843:
URL: https://github.com/apache/hive/pull/5843#discussion_r2127094849
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/tools/metatool/MetaToolTaskMetadataSummary.java:
##########
@@ -183,25 +185,45 @@ Pair<MetaSummarySchema, List<MetadataTableSummary>> obtainAndFilterSummary() thr
MetaSummarySchema extraSchema = new MetaSummarySchema();
for (Class<? extends MetaSummaryHandler> handler : nonNativeSummaries.keys()) {
Configuration conf = getObjectStore().getConf();
+ List<Future<?>> futures = new ArrayList<>();
try (MetaSummaryHandler summaryHandler = JavaUtils.newInstance(handler)) {
summaryHandler.setConf(conf);
summaryHandler.initialize(MetaStoreUtils.getDefaultCatalog(conf), formatJson, extraSchema);
List<MetadataTableSummary> tableSummaries = nonNativeSummaries.get(handler);
// Filter those we don't want to collect
Set<Long> tableIds = getObjectStore().filterTablesForSummary(tableSummaries, recentUpdatedDays, maxNonNativeTables);
+ if (service == null) {
+ int nThreads = Math.min(MetastoreConf.getIntVar(conf, MetastoreConf.ConfVars.METADATA_SUMMARY_NONNATIVE_THREADS),
+ tableIds.size());
+ if (nThreads > 1) {
+ service = Executors.newFixedThreadPool(nThreads,
+ new ThreadFactoryBuilder().setDaemon(true).setNameFormat("MetaToolTaskMetadataSummary #%d").build());
+ }
+ }
for (MetadataTableSummary summary : tableSummaries) {
- if (tableIds.contains(summary.getTableId())) {
+ if (!tableIds.contains(summary.getTableId())) {
+ filteredSummary.put(summary, null);
Review Comment:
Instead of a Map with value type void, we could have this variable type as `Set<MetadataTableSummary>`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-28990: Collecting the non-native summary can be slow to raise th… [hive]
Posted by "saihemanth-cloudera (via GitHub)" <gi...@apache.org>.
saihemanth-cloudera commented on code in PR #5843:
URL: https://github.com/apache/hive/pull/5843#discussion_r2127099505
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/tools/metatool/MetaToolTaskMetadataSummary.java:
##########
@@ -183,25 +185,45 @@ Pair<MetaSummarySchema, List<MetadataTableSummary>> obtainAndFilterSummary() thr
MetaSummarySchema extraSchema = new MetaSummarySchema();
for (Class<? extends MetaSummaryHandler> handler : nonNativeSummaries.keys()) {
Configuration conf = getObjectStore().getConf();
+ List<Future<?>> futures = new ArrayList<>();
try (MetaSummaryHandler summaryHandler = JavaUtils.newInstance(handler)) {
summaryHandler.setConf(conf);
summaryHandler.initialize(MetaStoreUtils.getDefaultCatalog(conf), formatJson, extraSchema);
List<MetadataTableSummary> tableSummaries = nonNativeSummaries.get(handler);
// Filter those we don't want to collect
Set<Long> tableIds = getObjectStore().filterTablesForSummary(tableSummaries, recentUpdatedDays, maxNonNativeTables);
+ if (service == null) {
+ int nThreads = Math.min(MetastoreConf.getIntVar(conf, MetastoreConf.ConfVars.METADATA_SUMMARY_NONNATIVE_THREADS),
+ tableIds.size());
+ if (nThreads > 1) {
+ service = Executors.newFixedThreadPool(nThreads,
+ new ThreadFactoryBuilder().setDaemon(true).setNameFormat("MetaToolTaskMetadataSummary #%d").build());
+ }
+ }
for (MetadataTableSummary summary : tableSummaries) {
- if (tableIds.contains(summary.getTableId())) {
+ if (!tableIds.contains(summary.getTableId())) {
+ filteredSummary.put(summary, null);
+ } else {
TableName tableName = new TableName(summary.getCatalogName(),
summary.getDbName(), summary.getTblName());
- summaryHandler.appendSummary(tableName, summary);
- } else {
- filteredSummary.put(summary, null);
- }
- // If there is an exception while collecting the summary, remove it
- if (summary.isDropped()) {
- filteredSummary.put(summary, null);
+ Runnable task = () -> {
+ summaryHandler.appendSummary(tableName, summary);
Review Comment:
If there is an exception collecting the summary, should we log the same in the Summary report rather than ignoring it? so that the end-user is aware of it?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-28990: Collecting the non-native summary can be slow to raise th… [hive]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #5843:
URL: https://github.com/apache/hive/pull/5843#issuecomment-2951998423
## [](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=5843) **Quality Gate passed**
Issues
 [2 New issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=5843&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=5843&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=5843&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=5843&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=5843&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=5843)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-28990: Collecting the non-native summary can be slow to raise th… [hive]
Posted by "saihemanth-cloudera (via GitHub)" <gi...@apache.org>.
saihemanth-cloudera commented on code in PR #5843:
URL: https://github.com/apache/hive/pull/5843#discussion_r2127082451
##########
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java:
##########
@@ -1905,6 +1905,8 @@ public enum ConfVars {
"Only collect the non-native table's summary that has been updated/changed in configured recent days."),
METADATA_SUMMARY_MAX_NONNATIVE_TABLES("hive.metatool.summary.maxNonNativeTables", "hive.metatool.summary.maxNonNativeTables", "",
"The maximum non-native tables allowed per table type during collecting the summary."),
+ METADATA_SUMMARY_NONNATIVE_THREADS("hive.metatool.summary.nonnative.threads", "hive.metatool.summary.nonnative.threads", 20,
+ "Number of threads to be allocated for MetaToolTaskMetadataSummary for collecting the non-native table's summary."),
Review Comment:
I feel the thread count is too high for an operation that would run in the background and that is not run very often. Thoughts?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-28990: Collecting the non-native summary can be slow to raise th… [hive]
Posted by "dengzhhu653 (via GitHub)" <gi...@apache.org>.
dengzhhu653 commented on code in PR #5843:
URL: https://github.com/apache/hive/pull/5843#discussion_r2128179602
##########
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java:
##########
@@ -1905,6 +1905,8 @@ public enum ConfVars {
"Only collect the non-native table's summary that has been updated/changed in configured recent days."),
METADATA_SUMMARY_MAX_NONNATIVE_TABLES("hive.metatool.summary.maxNonNativeTables", "hive.metatool.summary.maxNonNativeTables", "",
"The maximum non-native tables allowed per table type during collecting the summary."),
+ METADATA_SUMMARY_NONNATIVE_THREADS("hive.metatool.summary.nonnative.threads", "hive.metatool.summary.nonnative.threads", 20,
+ "Number of threads to be allocated for MetaToolTaskMetadataSummary for collecting the non-native table's summary."),
Review Comment:
I was inspired by `hive.metastore.fshandler.threads`, which default value is 15. The thread is used for loading the Iceberg table: reading the metadata files, where it might take time over thousands of Iceberg tables, leading to timeout. The actual threads is min(number of Iceberg tables, hive.metatool.summary.nonnative.threads)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-28990: Collecting the non-native summary can be slow to raise th… [hive]
Posted by "saihemanth-cloudera (via GitHub)" <gi...@apache.org>.
saihemanth-cloudera commented on PR #5843:
URL: https://github.com/apache/hive/pull/5843#issuecomment-2950797356
Pending green tests
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-28990: Collecting the non-native summary can be slow to raise th… [hive]
Posted by "saihemanth-cloudera (via GitHub)" <gi...@apache.org>.
saihemanth-cloudera commented on code in PR #5843:
URL: https://github.com/apache/hive/pull/5843#discussion_r2127106017
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/tools/metatool/MetaToolTaskMetadataSummary.java:
##########
@@ -183,25 +185,45 @@ Pair<MetaSummarySchema, List<MetadataTableSummary>> obtainAndFilterSummary() thr
MetaSummarySchema extraSchema = new MetaSummarySchema();
for (Class<? extends MetaSummaryHandler> handler : nonNativeSummaries.keys()) {
Configuration conf = getObjectStore().getConf();
+ List<Future<?>> futures = new ArrayList<>();
try (MetaSummaryHandler summaryHandler = JavaUtils.newInstance(handler)) {
summaryHandler.setConf(conf);
summaryHandler.initialize(MetaStoreUtils.getDefaultCatalog(conf), formatJson, extraSchema);
List<MetadataTableSummary> tableSummaries = nonNativeSummaries.get(handler);
// Filter those we don't want to collect
Set<Long> tableIds = getObjectStore().filterTablesForSummary(tableSummaries, recentUpdatedDays, maxNonNativeTables);
+ if (service == null) {
+ int nThreads = Math.min(MetastoreConf.getIntVar(conf, MetastoreConf.ConfVars.METADATA_SUMMARY_NONNATIVE_THREADS),
+ tableIds.size());
+ if (nThreads > 1) {
+ service = Executors.newFixedThreadPool(nThreads,
+ new ThreadFactoryBuilder().setDaemon(true).setNameFormat("MetaToolTaskMetadataSummary #%d").build());
+ }
+ }
for (MetadataTableSummary summary : tableSummaries) {
- if (tableIds.contains(summary.getTableId())) {
+ if (!tableIds.contains(summary.getTableId())) {
+ filteredSummary.put(summary, null);
+ } else {
TableName tableName = new TableName(summary.getCatalogName(),
summary.getDbName(), summary.getTblName());
- summaryHandler.appendSummary(tableName, summary);
- } else {
- filteredSummary.put(summary, null);
- }
- // If there is an exception while collecting the summary, remove it
- if (summary.isDropped()) {
- filteredSummary.put(summary, null);
+ Runnable task = () -> {
+ summaryHandler.appendSummary(tableName, summary);
+ // If there is an exception while collecting the summary, remove it
+ if (summary.isDropped()) {
+ filteredSummary.put(summary, null);
+ }
+ };
+ if (service != null) {
+ futures.add(service.submit(task));
+ } else {
+ task.run();
+ }
}
}
+ // Waiting for the result before closing the MetaSummaryHandler
+ for (Future<?> future : futures) {
+ future.get();
Review Comment:
Should we consider a timeout for this task? Threads could be blocked at the back end and the metadata summary tool can run for hours(I have seen this happen in a customer env).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-28990: Collecting the non-native summary can be slow to raise th… [hive]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #5843:
URL: https://github.com/apache/hive/pull/5843#issuecomment-2938883035
## [](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=5843) **Quality Gate passed**
Issues
 [1 New issue](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=5843&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=5843&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=5843&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=5843&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=5843&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=5843)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-28990: Collecting the non-native summary can be slow to raise th… [hive]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #5843:
URL: https://github.com/apache/hive/pull/5843#issuecomment-2948029837
## [](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=5843) **Quality Gate passed**
Issues
 [2 New issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=5843&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=5843&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=5843&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=5843&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=5843&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=5843)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org