Compaction Action

    (TODO)

    若 tablet 不存在,返回 JSON 格式的错误:

    1. "status": "Fail",
    2. "msg": "Tablet not found"
    3. }

    若 tablet 存在,则返回 JSON 格式的结果:

    1. {
    2. "cumulative policy type": "NUM_BASED",
    3. "cumulative point": 50,
    4. "last cumulative failure time": "2019-12-16 18:13:43.224",
    5. "last base failure time": "2019-12-16 18:13:23.320",
    6. "last cumu success time": ,
    7. "last base success time": "2019-12-16 18:11:50.780",
    8. "rowsets": [
    9. "[0-48] 10 DATA OVERLAPPING 574.00 MB",
    10. "[49-49] 2 DATA OVERLAPPING 574.00 B",
    11. "[50-50] 0 DELETE NONOVERLAPPING 574.00 B",
    12. "[51-51] 5 DATA OVERLAPPING 574.00 B"
    13. "stale version path": [
    14. {
    15. "path id": "2",
    16. "path list": "2-> [0-24] -> [25-48]"
    17. },
    18. {
    19. "path id": "1",
    20. "last create time": "2019-12-16 18:13:15.110 +0800",
    21. "path list": "1-> [25-40] -> [40-48]"
    22. }
    23. ]
    24. }
    • cumulative policy type:当前tablet所使用的 cumulative compaction 策略。
    • cumulative point:base 和 cumulative compaction 的版本分界线。在 point(不含)之前的版本由 base compaction 处理。point(含)之后的版本由 cumulative compaction 处理。
    • last cumulative failure time:上一次尝试 cumulative compaction 失败的时间。默认 10min 后才会再次尝试对该 tablet 做 cumulative compaction。
    • last base failure time:上一次尝试 base compaction 失败的时间。默认 10min 后才会再次尝试对该 tablet 做 base compaction。
    • rowsets:该 tablet 当前的 rowset 集合。如 [0-48] 表示 0-48 版本。第二位数字表示该版本中 segment 的数量。DELETE 表示 delete 版本。DATA 表示数据版本。OVERLAPPINGNONOVERLAPPING 表示segment数据是否重叠。
    • stale version path:该 table 当前被合并rowset集合的合并版本路径,该结构是一个数组结构,每个元素表示一个合并路径。每个元素中包含了三个属性:path id 表示版本路径id,last create time 表示当前路径上最近的 rowset 创建时间,默认在这个时间半个小时之后这条路径上的所有 rowset 会被过期删除。
    1. curl -X GET http://192.168.10.24:8040/api/compaction/show?tablet_id=10015\&schema_hash=1294206575

    当前仅能执行一个手动compaction任务,其中compact_type取值为base或cumulative

    若 tablet 不存在,返回 JSON 格式的错误:

    1. {
    2. "status": "Fail",
    3. "msg": "Tablet not found"
    4. }

    若 compaction 执行任务触发失败时,返回 JSON 格式的错误:

    1. "msg": "fail to execute compaction, error = -2000"
    2. }
    1. {
    2. "status": "Success",
    3. "msg": "compaction task is successfully triggered."
    4. }

    结果说明:

    • status:触发任务状态,当成功触发时为Success;当因某些原因(比如,没有获取到合适的版本)时,返回Fail。
    • msg:给出具体的成功或失败的信息。
    1. curl -X GET http://be_host:webserver_port/api/compaction/run_status?tablet_id=xxxx\&schema_hash=yyyy

    若 tablet 不存在,返回 JSON 格式:

    1. {
    2. "status": "Fail",
    3. "msg": "Tablet not found"
    4. }

    若 tablet 存在并且 tablet 不在正在执行 compaction,返回 JSON 格式:

    1. {
    2. "status" : "Success",
    3. "run_status" : false,
    4. "msg" : "this tablet_id is not running",
    5. "tablet_id" : 11308,
    6. "schema_hash" : 700967178,
    7. "compact_type" : ""
    8. }

    结果说明:

    • run_status:获取当前手动 compaction 任务执行状态