数据仓库服务 GAUSSDB(DWS)-Hudi系统函数:pg_task_show(text)

时间:2024-10-21 16:50:42

pg_task_show(text)

描述:查询当前自动调度任务信息,对于hudi同步任务,入参应该是'SQLonHudi'。

返回值类型:setof record

示例:

1
2
3
4
5
SELECT * FROM pg_task_show('SQLonHudi');
              task_id                |                                                                                          what                                                                                           | category_id | userid | is_broken |  interval  | time_cons |          start_time           | end_time | parameter | task_rank |        next_start_time        |         next_end_time         | last_log | failure_times 
--------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+--------+-----------+------------+-----------+-------------------------------+----------+-----------+-----------+-------------------------------+-------------------------------+----------+---------------
 64d257e9-1e9b-0d00-3ce3-7e61b5e0fffe | call pg_catalog.hudi_sync_custom('public.hudi_read_target', 'public.hudi_read101', '{"_hoodie_commit_seqno" : "_hoodie_commit_seqno", "id" : "id", "ts" : "ts", "long_field" : "ts"}'); | SQLonHudi   |     10 | f         | '00:00:10' |           | 2023-08-08 22:58:15.846903+08 |          |           |         5 | 2023-08-08 22:58:15.846903+08 | 2023-08-08 22:58:24.846903+08 |          |             0
(1 row)

last_log和failure_times字段用于记录上一次任务的状态。

  • last_log于任务结束时刷新,若任务成功,则清空内容;若任务失败则记录任务的失败日志。
  • failure_times于时间窗结束时刷新,若任务成功,置为0,失败则累加1,本轮未拉起则不变,可用于推断第一次失败出现的时间。
support.huaweicloud.com/sqlreference-830-dws/dws_06_0359.html