在ETL调度中,任务依赖的配置,经常被忽略,容易引发一些生产事故
事故描述:一段生产代码,上游全部有记录,目标表为空,导致生产事故。
问题分析:首先查看了上游表是否有记录,没问题;同样的代码往临时表插数据(尽量保护现场),有数据。这时候就应该反应过来,可能依赖关系忘了配置
事故现场:
insert overwrite table dm.m partition (dt='${day}') select a2.platform_retailer_id as shop_id ,a1.walle_shop_id ,a3.push_type as delivery_push_type ,a1.delivery_product_id ,a3.name as delivery_product_name ,a1.delivery_product_signed_date ,a1.delivery_product_expire_date ,a1.delivery_product_rate_fee ,a1.delivery_product_fixed_fee ,a1.delivery_type from temp.u a1 inner join ( select id ,platform_retailer_id from dw.x where dt = '${day}' and platform_id=0 and is_availabe=1 ) a2 on a1.walle_shop_id=a2.id left outer join ( select id ,name ,push_type from dw.y where dt = '${day}' and is_valid=1 ) a3 on a1.delivery_product_id=a3.id inner join ( select id from ods.z where dt = '${day}' and type<>100 ) a4 on a2.platform_retailer_id=a4.id ;
dfs -ls /data/external_table/dw/x/dt=2018-03-15
-rw-r--r-- 3 master hadoop 5159804892 2018-03-16 00:35 /data/external_table/dw/x/dt=2018-03-15/000000_0
dfs -ls /data/external_table/dm/m drwxr-xr-x - master hadoop 0 2018-03-16 00:35 /data/external_table/dm/m/dt=2018-03-15
可以看到,dm.m 表 00:35分出结果,但是 dw.x 表00:35才出结果。
解决方案:配置依赖,回滚数据
posted on
浙公网安备 33010602011771号