hive metastore频繁报错,hive集群查询很慢。ObjectStore.java:handleDirectSqlError(3741)) - Falling back to ORM path due to direct SQL failure (this is not an error): Error executing SQL query “select “PART_ID”, “PARAM_KEY”, “PARAM_VALUE” from “PARTITION_PARAMS” where “PART_ID” in (10522894,10522897,…,22062033,22062776) and “PARAM_KEY” is not null order by “PART_ID” asc”. at org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:543) at org.datanucleus.api.jdo.JDOQuery.executeInternal(JDOQuery.java:391)
分析hive metastore日志发现有 对PARTITION_PARAMS表查询,切in()中有包含40000左右的part_id,导致源数据库查询阻塞。
分析发现hive3.0之后,默认开启了cbo ,开启统计分析。
然后执行计划会取这些数据去优化执行计划。
建议关闭统计分析,可以在用的时候在客户端set true:
set hive.cbo.enable=false
set hive.stats.autogather=false;
set hive.stats.column.autogather=false;
并建议增加metastore连接池:
datanucleus.connectionPool.maxPoolSize=10 默认值为10,改成50