[ https://issues.apache.org/jira/browse/HIVE-27636?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Krisztian Kasa updated HIVE-27636: ---------------------------------- Description: In case of any exception while query parsing in `HiveMaterializedViewsRegistry.createMaterialization`, we bail out and there is no hdfs dir cleanup until JVM exit. This leaves behind the staging directories. For a long-running HS2, these staging directories keeps on increasing and can cause limit reached exception. {code:java} Error: Error while compiling statement: FAILED: RuntimeException Cannot create staging directory 'hdfs://aidaprd01/warehouse/tablespace/managed/hive/test.db/testTable/.hive-staging_hive_2023-08-05_06-17-06_711_5516272990801215078-168329': The directory item limit of /warehouse/tablespace/managed/hive/test.db/testTable is exceeded: limit=1048576 items=1048576 {code} We should do hdfs directory cleanup for `HiveMaterializedViewsRegistry` thread [here|https://github.com/apache/hive/blob/1a574783afee13e33ecf3ed6fc60bdc94fe47bb1/ql/src/java/org/apache/hadoop/hive/ql/metadata/HiveMaterializedViewsRegistry.java#L231] was: In case of any exception while query parsing in `HiveMaterializedViewsRegistry.createMaterialization`, we bail out and there is no hdfs dir cleanup until JVM exit. This leaves behind the staging directories. For a long-running HS2, these staging directories keeps on increasing and can cause limit reached exception. {code:java} Error: Error while compiling statement: FAILED: RuntimeException Cannot create staging directory 'hdfs://aidaprd01/warehouse/tablespace/managed/hive/test.db/testTable/.hive-staging_hive_2023-08-05_06-17-06_711_5516272990801215078-168329': The directory item limit of /warehouse/tablespace/managed/hive/test.db/testTable is exceeded: limit=1048576 items=1048576 {code} We should do hdfs directory cleanup for `HiveMaterializedViewsRegistry` thread [here|https://github.infra.cloudera.com/CDH/hive/blob/39b9e39e5167c8fcd35683f8e9e2c9a89fe86555/ql/src/java/org/apache/hadoop/hive/ql/metadata/HiveMaterializedViewsRegistry.java#L226] > Exception in HiveMaterializedViewsRegistry is leaving staging directories > behind > -------------------------------------------------------------------------------- > > Key: HIVE-27636 > URL: https://issues.apache.org/jira/browse/HIVE-27636 > Project: Hive > Issue Type: Bug > Components: Materialized views > Reporter: Riju Trivedi > Priority: Major > > In case of any exception while query parsing in > `HiveMaterializedViewsRegistry.createMaterialization`, we bail out and there > is no hdfs dir cleanup until JVM exit. This leaves behind the staging > directories. For a long-running HS2, these staging directories keeps on > increasing and can cause limit reached exception. > {code:java} > Error: Error while compiling statement: FAILED: RuntimeException Cannot > create staging directory > 'hdfs://aidaprd01/warehouse/tablespace/managed/hive/test.db/testTable/.hive-staging_hive_2023-08-05_06-17-06_711_5516272990801215078-168329': > The directory item limit of > /warehouse/tablespace/managed/hive/test.db/testTable is exceeded: > limit=1048576 items=1048576 {code} > We should do hdfs directory cleanup for `HiveMaterializedViewsRegistry` > thread > [here|https://github.com/apache/hive/blob/1a574783afee13e33ecf3ed6fc60bdc94fe47bb1/ql/src/java/org/apache/hadoop/hive/ql/metadata/HiveMaterializedViewsRegistry.java#L231] -- This message was sent by Atlassian Jira (v8.20.10#820010)