mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-23 18:10:39 +00:00
Merge "Adding the compaction_manager API" from Amnon
"This series adds the compaction_manager that is based on the CompactionManagerMBean and its metrics that is based on the CompactionMetrics. It contain a stub implementation so that the API can be accessed from the JMX API. The doc file can be found: /api-doc/compaction_manager/"
This commit is contained in:
186
api/api-doc/compaction_manager.json
Normal file
186
api/api-doc/compaction_manager.json
Normal file
@@ -0,0 +1,186 @@
|
||||
{
|
||||
"apiVersion":"0.0.1",
|
||||
"swaggerVersion":"1.2",
|
||||
"basePath":"{{Protocol}}://{{Host}}",
|
||||
"resourcePath":"/compaction_manager",
|
||||
"produces":[
|
||||
"application/json"
|
||||
],
|
||||
"apis":[
|
||||
{
|
||||
"path":"/compaction_manager/compactions",
|
||||
"operations":[
|
||||
{
|
||||
"method":"GET",
|
||||
"summary":"get List of running compactions",
|
||||
"type":"array",
|
||||
"items":{
|
||||
"type":"jsonmap"
|
||||
},
|
||||
"nickname":"get_compactions",
|
||||
"produces":[
|
||||
"application/json"
|
||||
],
|
||||
"parameters":[
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path":"/compaction_manager/compaction_summary",
|
||||
"operations":[
|
||||
{
|
||||
"method":"GET",
|
||||
"summary":"get compaction summary",
|
||||
"type":"array",
|
||||
"items":{
|
||||
"type":"string"
|
||||
},
|
||||
"nickname":"get_compaction_summary",
|
||||
"produces":[
|
||||
"application/json"
|
||||
],
|
||||
"parameters":[
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path":"/compaction_manager/force_user_defined_compaction",
|
||||
"operations":[
|
||||
{
|
||||
"method":"POST",
|
||||
"summary":"Triggers the compaction of user specified sstables. You can specify files from various keyspaces and columnfamilies. If you do so, user defined compaction is performed several times to the groups of files in the same keyspace/columnfamily. must contain keyspace and columnfamily name in path(for 2.1+) or file name itself.",
|
||||
"type":"void",
|
||||
"nickname":"force_user_defined_compaction",
|
||||
"produces":[
|
||||
"application/json"
|
||||
],
|
||||
"parameters":[
|
||||
{
|
||||
"name":"data_files",
|
||||
"description":"a comma separated list of sstable file to compact. must contain keyspace and columnfamily name in path(for 2.1+) or file name itself",
|
||||
"required":true,
|
||||
"allowMultiple":false,
|
||||
"type":"string",
|
||||
"paramType":"query"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path":"/compaction_manager/stop_compaction",
|
||||
"operations":[
|
||||
{
|
||||
"method":"POST",
|
||||
"summary":"Stop all running compaction-like tasks having the provided type",
|
||||
"type":"void",
|
||||
"nickname":"stop_compaction",
|
||||
"produces":[
|
||||
"application/json"
|
||||
],
|
||||
"parameters":[
|
||||
{
|
||||
"name":"type",
|
||||
"description":"the type of compaction to stop. Can be one of: - COMPACTION - VALIDATION - CLEANUP - SCRUB - INDEX_BUILD",
|
||||
"required":true,
|
||||
"allowMultiple":false,
|
||||
"type":"string",
|
||||
"paramType":"string"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/compaction_manager/metrics/pending_tasks",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"summary": "Get pending tasks",
|
||||
"type": "int",
|
||||
"nickname": "get_pending_tasks",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"parameters": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/compaction_manager/metrics/completed_tasks",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"summary": "Get completed tasks",
|
||||
"type": "long",
|
||||
"nickname": "get_completed_tasks",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"parameters": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/compaction_manager/metrics/total_compactions_completed",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"summary": "Get total compactions completed",
|
||||
"type": "long",
|
||||
"nickname": "get_total_compactions_completed",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"parameters": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/compaction_manager/metrics/bytes_compacted",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"summary": "Get bytes compacted",
|
||||
"type": "int",
|
||||
"nickname": "get_bytes_compacted",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"parameters": []
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"models":{
|
||||
"mapper":{
|
||||
"id":"mapper",
|
||||
"description":"A key value mapping",
|
||||
"properties":{
|
||||
"key":{
|
||||
"type":"string",
|
||||
"description":"The key"
|
||||
},
|
||||
"value":{
|
||||
"type":"string",
|
||||
"description":"The value"
|
||||
}
|
||||
}
|
||||
},
|
||||
"jsonmap":{
|
||||
"id":"jsonmap",
|
||||
"description":"A json representation of a map as a list of key value",
|
||||
"properties":{
|
||||
"value":{
|
||||
"type":"array",
|
||||
"items":{
|
||||
"type":"mapper"
|
||||
},
|
||||
"description":"A list of key, value mapping"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "storage_proxy.hh"
|
||||
#include "cache_service.hh"
|
||||
#include "collectd.hh"
|
||||
#include "compaction_manager.hh"
|
||||
namespace api {
|
||||
|
||||
future<> set_server(http_context& ctx) {
|
||||
@@ -55,6 +56,9 @@ future<> set_server(http_context& ctx) {
|
||||
rb->register_function(r, "collectd",
|
||||
"The collectd API");
|
||||
set_collectd(ctx, r);
|
||||
rb->register_function(r, "compaction_manager",
|
||||
"The Compaction manager API");
|
||||
set_compaction_manager(ctx, r);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
63
api/compaction_manager.cc
Normal file
63
api/compaction_manager.cc
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright 2015 Cloudius Systems
|
||||
*/
|
||||
|
||||
#include "compaction_manager.hh"
|
||||
#include "api/api-doc/compaction_manager.json.hh"
|
||||
|
||||
namespace api {
|
||||
|
||||
using namespace scollectd;
|
||||
namespace cm = httpd::compaction_manager_json;
|
||||
|
||||
|
||||
|
||||
void set_compaction_manager(http_context& ctx, routes& r) {
|
||||
cm::get_compactions.set(r, [] (std::unique_ptr<request> req) {
|
||||
//TBD
|
||||
std::vector<cm::jsonmap> map;
|
||||
return make_ready_future<json::json_return_type>(map);
|
||||
});
|
||||
|
||||
cm::get_compaction_summary.set(r, [] (std::unique_ptr<request> req) {
|
||||
//TBD
|
||||
std::vector<sstring> res;
|
||||
return make_ready_future<json::json_return_type>(res);
|
||||
});
|
||||
|
||||
cm::force_user_defined_compaction.set(r, [] (std::unique_ptr<request> req) {
|
||||
//TBD
|
||||
return make_ready_future<json::json_return_type>("");
|
||||
});
|
||||
|
||||
cm::stop_compaction.set(r, [] (std::unique_ptr<request> req) {
|
||||
//TBD
|
||||
return make_ready_future<json::json_return_type>("");
|
||||
});
|
||||
|
||||
cm::get_pending_tasks.set(r, [] (std::unique_ptr<request> req) {
|
||||
//TBD
|
||||
return make_ready_future<json::json_return_type>(0);
|
||||
});
|
||||
|
||||
cm::get_completed_tasks.set(r, [] (std::unique_ptr<request> req) {
|
||||
//TBD
|
||||
return make_ready_future<json::json_return_type>(0);
|
||||
});
|
||||
|
||||
cm::get_total_compactions_completed.set(r, [] (std::unique_ptr<request> req) {
|
||||
//TBD
|
||||
return make_ready_future<json::json_return_type>(0);
|
||||
});
|
||||
|
||||
cm::get_bytes_compacted.set(r, [] (std::unique_ptr<request> req) {
|
||||
//TBD
|
||||
return make_ready_future<json::json_return_type>(0);
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
18
api/compaction_manager.hh
Normal file
18
api/compaction_manager.hh
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright 2015 Cloudius Systems
|
||||
*/
|
||||
|
||||
#ifndef API_COMPACTION_MANAGER_HH_
|
||||
#define API_COMPACTION_MANAGER_HH_
|
||||
|
||||
#include "api.hh"
|
||||
|
||||
namespace api {
|
||||
|
||||
void set_compaction_manager(http_context& ctx, routes& r);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif /* API_COMPACTION_MANAGER_HH_ */
|
||||
@@ -338,6 +338,8 @@ api = ['api/api.cc',
|
||||
'api/cache_service.cc',
|
||||
'api/api-doc/collectd.json',
|
||||
'api/collectd.cc',
|
||||
'api/api-doc/compaction_manager.json',
|
||||
'api/compaction_manager.cc',
|
||||
]
|
||||
|
||||
boost_test_lib = [
|
||||
|
||||
Reference in New Issue
Block a user