Hive客户端多并发问题解决方法记录

在多并发环境下,Hive客户端遇到主键冲突异常BatchUpdateException,原因是并发删除和创建表操作导致元数据管理混乱。分析表明,这与datanucleus对MySQL catalog的操作有关,尤其是DELETEME.TIMESTAMP临时表的生成和删除过程。解决方法包括将datanucleus.autoCreateScheme设为false,避免Hive自动更新元数据,以及将datanucleus.fixedStoredata设为true,固定元数据防止修改,从而消除主键冲突问题。
摘要由CSDN通过智能技术生成

问题出现场景:

如用户描述:(

 测试脚本如下:

echo " 
set hive.exec.dynamic.partition=true; 
set hive.exec.dynamic.partition.mode=nonstrict;
set hive.optimize.sort.dynamic.partition=false;
set hive.exec.max.dynamic.partitions.pernode=1000;
set hive.exec.max.dynamic.partitions=10000;
set mapred.child.java.opts=-Xmx3000m;
drop table tmp.test30;create table tmp.test30(v1 int);" | hive

     将以上脚本复制30份,修改其中的表名 test30 为 testn,n为1,2,3...)多个进程同时在操作元数据时,会报如下错误Log:

INFO 01-07 11:03:20,392 - 12 2 - (stderr) Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
INFO 01-07 11:03:20,393 - 12 2 - (stderr) at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:346)
INFO 01-07 11:03:20,393 - 12 2 - (stderr) at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:681)
INFO 01-07 11:03:20,393 - 12 2 - (stderr) at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:625)
INFO 01-07 11:03:20,393 - 12 2 - (stderr) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO 01-07 11:03:20,393 - 12 2 - (stderr) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
INFO 01-07 11:03:20,393 - 12 2 - (stderr) at sun.reflect.DelegatingMe
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值