Compaction Action

This API is used to view the overall compaction status of a BE node or the compaction status of a specified tablet. It can also be used to manually trigger Compaction.

View Compaction status

The overall compaction status of the node

(TODO)

Specify the compaction status of the tablet

  1. curl -X GET http://be_host:webserver_port/api/compaction/show?tablet_id=xxxx\&schema_hash=yyyy

If the tablet does not exist, an error in JSON format is returned:

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

If the tablet exists, the result is returned in JSON format:

  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": "2019-12-16 18:12:15.110",
  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. ],
  14. "stale version path": [
  15. {
  16. "path id": "2",
  17. "last create time": "2019-12-16 18:11:15.110 +0800",
  18. "path list": "2-> [0-24] -> [25-48]"
  19. },
  20. {
  21. "path id": "1",
  22. "last create time": "2019-12-16 18:13:15.110 +0800",
  23. "path list": "1-> [25-40] -> [40-48]"
  24. }
  25. ]
  26. }

Explanation of results:

  • cumulative policy type: The cumulative compaction policy type which is used by current tablet.
  • cumulative point: The version boundary between base and cumulative compaction. Versions before (excluding) points are handled by base compaction. Versions after (inclusive) are handled by cumulative compaction.
  • last cumulative failure time: The time when the last cumulative compaction failed. After 10 minutes by default, cumulative compaction is attempted on the this tablet again.
  • last base failure time: The time when the last base compaction failed. After 10 minutes by default, base compaction is attempted on the this tablet again.
  • rowsets: The current rowsets collection of this tablet. [0-48] means a rowset with version 0-48. The second number is the number of segments in a rowset. The DELETE indicates the delete version. OVERLAPPING and NONOVERLAPPING indicates whether data between segments is overlap.
  • stale version path: The merged version path of the rowset collection currently merged in the tablet. It is an array structure and each element represents a merged path. Each element contains three attributes: path id indicates the version path id, and last create time indicates the creation time of the most recent rowset on the path. By default, all rowsets on this path will be deleted after half an hour at the last create time.

Examples

  1. curl -X GET http://192.168.10.24:8040/api/compaction/show?tablet_id=10015\&schema_hash=1294206575

Manually trigger Compaction

  1. curl -X POST http://be_host:webserver_port/api/compaction/run?tablet_id=xxxx\&schema_hash=yyyy\&compact_type=cumulative

The only one manual compaction task that can be performed at a moment, and the value range of compact_type is base or cumulative

If the tablet does not exist, an error in JSON format is returned:

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

If the compaction execution task fails to be triggered, an error in JSON format is returned:

  1. {
  2. "status": "Fail",
  3. "msg": "fail to execute compaction, error = -2000"
  4. }

If the compaction execution task successes to be triggered, an error in JSON format is returned:

  1. {
  2. "status": "Success",
  3. "msg": "compaction task is successfully triggered."
  4. }

Explanation of results:

  • status: Trigger task status, when it is successfully triggered, it is Success; when for some reason (for example, the appropriate version is not obtained), it returns Fail.
  • msg: Give specific success or failure information.

Examples

  1. curl -X POST http://192.168.10.24:8040/api/compaction/run?tablet_id=10015\&schema_hash=1294206575\&compact_type=cumulative

Manual Compaction execution status

  1. curl -X GET http://be_host:webserver_port/api/compaction/run_status?tablet_id=xxxx\&schema_hash=yyyy

If the tablet does not exist, an error in JSON format is returned:

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

If the tablet exists and the tablet is not running, JSON format is returned:

  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. }

If the tablet exists and the tablet is running, JSON format is returned:

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

Explanation of results:

  • run_status: Get the current manual compaction task execution status.

Examples

  1. curl -X GET http://192.168.10.24:8040/api/compaction/run_status?tablet_id=10015\&schema_hash=1294206575