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β
curl -X GET http://be_host:webserver_port/api/compaction/run_status
Return JSON:
{
"CumulativeCompaction": {
"/home/disk1" : [10001, 10002],
"/home/disk2" : [10003]
},
"BaseCompaction": {
"/home/disk1" : [10001, 10002],
"/home/disk2" : [10003]
}
}
This structure represents the id of the tablet that is performing the compaction task in a certain data directory, and the type of compaction.
Specify the compaction status of the tabletβ
curl -X GET http://be_host:webserver_port/api/compaction/show?tablet_id=xxxx
If the tablet does not exist, an error in JSON format is returned:
{
"status": "Fail",
"msg": "Tablet not found"
}
If the tablet exists, the result is returned in JSON format:
{
"cumulative policy type": "SIZE_BASED",
"cumulative point": 50,
"last cumulative failure time": "2019-12-16 18:13:43.224",
"last base failure time": "2019-12-16 18:13:23.320",
"last cumu success time": "2019-12-16 18:12:15.110",
"last base success time": "2019-12-16 18:11:50.780",
"rowsets": [
"[0-48] 10 DATA OVERLAPPING 574.00 MB",
"[49-49] 2 DATA OVERLAPPING 574.00 B",
"[50-50] 0 DELETE NONOVERLAPPING 574.00 B",
"[51-51] 5 DATA OVERLAPPING 574.00 B"
],
"missing_rowsets": [],
"stale version path": [
{
"path id": "2",
"last create time": "2019-12-16 18:11:15.110 +0800",
"path list": "2-> [0-24] -> [25-48]"
},
{
"path id": "1",
"last create time": "2019-12-16 18:13:15.110 +0800",
"path list": "1-> [25-40] -> [40-48]"
}
]
}
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
andNONOVERLAPPING
indicates whether data between segments is overlap. - missing_rowset: The missing rowsets.
- 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β
curl -X GET http://192.168.10.24:8040/api/compaction/show?tablet_id=10015
Manually trigger Compactionβ
curl -X POST http://be_host:webserver_port/api/compaction/run?tablet_id=xxxx\&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:
{
"status": "Fail",
"msg": "Tablet not found"
}
If the compaction execution task fails to be triggered, an error in JSON format is returned:
{
"status": "Fail",
"msg": "fail to execute compaction, error = -2000"
}
If the compaction execution task successes to be triggered, an error in JSON format is returned:
{
"status": "Success",
"msg": "compaction task is successfully triggered."
}
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β
curl -X POST http://192.168.10.24:8040/api/compaction/run?tablet_id=10015\&compact_type=cumulative
Manual Compaction execution statusβ
curl -X GET http://be_host:webserver_port/api/compaction/run_status?tablet_id=xxxx
If the tablet does not exist, an error in JSON format is returned:
{
"status": "Fail",
"msg": "Tablet not found"
}
If the tablet exists and the tablet is not running, JSON format is returned:
{
"status" : "Success",
"run_status" : false,
"msg" : "this tablet_id is not running",
"tablet_id" : 11308,
"compact_type" : ""
}
If the tablet exists and the tablet is running, JSON format is returned:
{
"status" : "Success",
"run_status" : true,
"msg" : "this tablet_id is running",
"tablet_id" : 11308,
"compact_type" : "cumulative"
}
Explanation of results:
- run_status: Get the current manual compaction task execution status.
Examplesβ
curl -X GET http://192.168.10.24:8040/api/compaction/run_status?tablet_id=10015