跳到主要内容

查询任务位点信息

接口描述

根据任务id查询任务的位点信息,目前仅支持 CHECK(校验)类型任务,返回表级别的校验结果

接口地址

/cloudcanal/console/api/v1/openapi/datajob/queryjobposition

请求方式

POST

请求参数

参数名称参数说明请求类型是否必须数据类型
jobId任务idbodylong
dataJobType任务类型,目前仅支持 CHECK,参考 获取任务类型列表bodystring

公共响应结果

参数名称参数说明类型(java)不为空
code1:成功 0:失败string
dataobject
msgstring
requestIdstring

data 参数说明

参数名称参数说明不为空数据类型
tableCheckResultMap表校验结果映射,key 为 TableUnit 的 JSON 序列化字符串,value 为校验位点对象map

TableUnit(Map Key)说明

Map 的 key 是 TableUnit 对象的 JSON 序列化字符串,格式如:{"dbName":"test_db","tableSchema":"public","tableName":"table1"}

参数名称参数说明不为空数据类型
dbName数据库名string
tableSchemaSchema名string
tableName表名string

RdbCheckPositionDTO(Map Value)说明

校验位点对象,包含表级别的校验进度和结果信息:

基础信息

参数名称参数说明不为空数据类型
taskId任务IDstring
jobId作业IDstring
taskName任务名称string
dbName数据库名string
schemaSchema名string
tableName表名string

进度信息

参数名称参数说明不为空数据类型
handledRecordCount已处理记录数long
maxCount最大记录数long
percentage进度百分比(0-100)decimal
elapsedTimeMs已耗时(毫秒)long
finished表校验是否完成boolean

主键信息

参数名称参数说明不为空数据类型
currentPk当前处理到的主键值string
minPkNumeric最小主键值(数值型)decimal
maxPkNumeric最大主键值(数值型)decimal

校验结果

参数名称参数说明不为空数据类型
loss目标端缺失的记录数(源端有但目标端没有)long
diff与目标端不一致的记录数(两端都有但内容不同)long
checkStage校验阶段string

其他字段

参数名称参数说明不为空数据类型
fileBlockIndex文件块索引long
included是否包含第一条记录boolean

响应示例

{
"code": "1",
"msg": "request success",
"data":
{
"tableCheckResultMap":
{
"{\"tableName\":\"workflow_version\",\"tableSchema\":\"dingtax\"}":
{
"taskId": "622",
"jobId": "266",
"taskName": "canalsubnt1b4uqw_CHECK",
"dbName": null,
"schema": "dingtax",
"tableName": "workflow_version",
"handledRecordCount": 0,
"maxCount": 0,
"currentPk": "{\"index\":null,\"currPartition\":null,\"currKeyCols\":{\"id\":null},\"minKeyCols\":{\"id\":null},\"maxKeyCols\":{\"id\":null},\"eosNodes\":null}",
"fileBlockIndex": 0,
"minPkNumeric": null,
"maxPkNumeric": null,
"percentage": 100,
"elapsedTimeMs": 77,
"included": true,
"finished": true,
"loss": 0,
"diff": 0,
"checkStage": "INITIAL_CHECK"
},
"{\"tableName\":\"w_company\",\"tableSchema\":\"dingtax\"}":
{
"taskId": "622",
"jobId": "266",
"taskName": "canalsubnt1b4uqw_CHECK",
"dbName": null,
"schema": "dingtax",
"tableName": "w_company",
"handledRecordCount": 0,
"maxCount": 0,
"currentPk": "{\"index\":null,\"currPartition\":null,\"currKeyCols\":{\"id\":null},\"minKeyCols\":{\"id\":null},\"maxKeyCols\":{\"id\":null},\"eosNodes\":null}",
"fileBlockIndex": 0,
"minPkNumeric": null,
"maxPkNumeric": null,
"percentage": 100,
"elapsedTimeMs": 90,
"included": true,
"finished": true,
"loss": 0,
"diff": 0,
"checkStage": "INITIAL_CHECK"
},
"{\"tableName\":\"worker_stats\",\"tableSchema\":\"dingtax\"}":
{
"taskId": "622",
"jobId": "266",
"taskName": "canalsubnt1b4uqw_CHECK",
"dbName": null,
"schema": "dingtax",
"tableName": "worker_stats",
"handledRecordCount": 36352,
"maxCount": 157458,
"currentPk": "{\"index\":null,\"currPartition\":null,\"currKeyCols\":{\"id\":-4231478872083296211},\"minKeyCols\":{\"id\":-8835792057943077187},\"maxKeyCols\":{\"id\":9223365991561122752},\"eosNodes\":null}",
"fileBlockIndex": 0,
"minPkNumeric": null,
"maxPkNumeric": null,
"percentage": 23.09,
"elapsedTimeMs": 22624,
"included": true,
"finished": false,
"loss": 0,
"diff": 0,
"checkStage": "INITIAL_CHECK"
}
}
},
"requestId": "5d589cc0-ce71-11f0-8388-cf86e7c30fd4",
"fail": false,
"success": true
}

注意事项

  • 目前该接口仅支持 dataJobTypeCHECK 的校验任务
  • 其他类型任务调用此接口会返回错误
  • loss 表示源端有但目标端缺失的记录数
  • diff 表示两端都存在但数据内容不一致的记录数
  • finishedtruelossdiff 都为 0 时,表示该表校验通过
联系我们
微信二维码

扫码添加微信,获取技术支持