Compare commits
7 Commits
debug_form
...
copilot/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea26e4b3a5 | ||
|
|
3b793ef09f | ||
|
|
df0a59ba03 | ||
|
|
69024a09b2 | ||
|
|
bb8f28a1ab | ||
|
|
32bc7e3a1c | ||
|
|
fb4e37248d |
@@ -349,9 +349,13 @@
|
||||
"type":"long",
|
||||
"description":"The shard the task is running on"
|
||||
},
|
||||
"creation_time":{
|
||||
"type":"datetime",
|
||||
"description":"The creation time of the task (when it was queued); extracted from the task_id UUID"
|
||||
},
|
||||
"start_time":{
|
||||
"type":"datetime",
|
||||
"description":"The start time of the task; unspecified (equal to epoch) when state == created"
|
||||
"description":"The start time of the task (when execution began); unspecified (equal to epoch) when state == created"
|
||||
},
|
||||
"end_time":{
|
||||
"type":"datetime",
|
||||
@@ -398,13 +402,17 @@
|
||||
"type":"boolean",
|
||||
"description":"Boolean flag indicating whether the task can be aborted"
|
||||
},
|
||||
"creation_time":{
|
||||
"type":"datetime",
|
||||
"description":"The creation time of the task (when it was queued); extracted from the task_id UUID"
|
||||
},
|
||||
"start_time":{
|
||||
"type":"datetime",
|
||||
"description":"The start time of the task"
|
||||
"description":"The start time of the task (when execution began); unspecified (equal to epoch) when state == created"
|
||||
},
|
||||
"end_time":{
|
||||
"type":"datetime",
|
||||
"description":"The end time of the task (unspecified when the task is not completed)"
|
||||
"description":"The end time of the task (when execution completed); unspecified (equal to epoch) when the task is not completed"
|
||||
},
|
||||
"error":{
|
||||
"type":"string",
|
||||
|
||||
@@ -55,6 +55,7 @@ tm::task_status make_status(tasks::task_status status, sharded<gms::gossiper>& g
|
||||
res.scope = status.scope;
|
||||
res.state = status.state;
|
||||
res.is_abortable = bool(status.is_abortable);
|
||||
res.creation_time = get_time(status.creation_time);
|
||||
res.start_time = get_time(status.start_time);
|
||||
res.end_time = get_time(status.end_time);
|
||||
res.error = status.error;
|
||||
@@ -83,6 +84,7 @@ tm::task_stats make_stats(tasks::task_stats stats) {
|
||||
res.table = stats.table;
|
||||
res.entity = stats.entity;
|
||||
res.shard = stats.shard;
|
||||
res.creation_time = get_time(stats.creation_time);
|
||||
res.start_time = get_time(stats.start_time);
|
||||
res.end_time = get_time(stats.end_time);;
|
||||
return res;
|
||||
|
||||
@@ -165,8 +165,7 @@ cql3::statements::alter_keyspace_statement::prepare_schema_mutations(query_proce
|
||||
|
||||
service::topology_mutation_builder builder(ts);
|
||||
service::topology_request_tracking_mutation_builder rtbuilder{global_request_id, qp.proxy().features().topology_requests_type_column};
|
||||
rtbuilder.set("done", false)
|
||||
.set("start_time", db_clock::now());
|
||||
rtbuilder.set("done", false);
|
||||
if (!qp.proxy().features().topology_global_request_queue) {
|
||||
builder.set_global_topology_request(service::global_topology_request::keyspace_rf_change);
|
||||
builder.set_global_topology_request_id(global_request_id);
|
||||
|
||||
@@ -45,6 +45,22 @@ immediately after it's finished.
|
||||
|
||||
A flag which determines if a task can be aborted through API.
|
||||
|
||||
# Task timing fields
|
||||
|
||||
Tasks have three timing fields that track different stages of their lifecycle:
|
||||
|
||||
- `creation_time` - When the task was created/queued. This is extracted from the task's
|
||||
UUID (which is a timeuuid) and represents the moment the task request was submitted.
|
||||
- `start_time` - When the task actually began executing. For tasks that are queued, this
|
||||
will be unspecified (equal to epoch) until execution starts. For node operations
|
||||
like decommission, this is set when the request is picked up for execution by the
|
||||
topology coordinator.
|
||||
- `end_time` - When the task completed (successfully or with an error). This is
|
||||
unspecified (equal to epoch) until the task finishes.
|
||||
|
||||
The difference between `creation_time` and `start_time` represents the time a task
|
||||
spent waiting in the queue before execution began.
|
||||
|
||||
# Type vs scope vs kind
|
||||
|
||||
`type` of a task describes what operation is covered by a task,
|
||||
|
||||
@@ -42,21 +42,21 @@ For single list:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
task_id type kind scope state sequence_number keyspace table entity shard start_time end_time
|
||||
5116ddb6-85b5-4c3e-94fb-72128f15d7b4 repair node keyspace done 3 abc 0 2025-01-16T16:12:11Z 2025-01-16T16:12:13Z
|
||||
task_id type kind scope state sequence_number keyspace table entity shard creation_time start_time end_time
|
||||
5116ddb6-85b5-4c3e-94fb-72128f15d7b4 repair node keyspace done 3 abc 0 2025-01-16T16:12:08Z 2025-01-16T16:12:11Z 2025-01-16T16:12:13Z
|
||||
|
||||
With repetition:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
task_id type kind scope state sequence_number keyspace table entity shard start_time end_time
|
||||
d8926ee7-0faf-47b7-bfeb-82477e0c7b33 repair node keyspace running 5 abc 0 2025-01-16T16:12:57Z
|
||||
1e028cb8-31a3-45ed-8728-af7a1ab586f6 repair node keyspace done 4 abc 0 2025-01-16T16:12:45Z 2025-01-16T16:12:47Z
|
||||
task_id type kind scope state sequence_number keyspace table entity shard creation_time start_time end_time
|
||||
d8926ee7-0faf-47b7-bfeb-82477e0c7b33 repair node keyspace running 5 abc 0 2025-01-16T16:12:54Z 2025-01-16T16:12:57Z
|
||||
1e028cb8-31a3-45ed-8728-af7a1ab586f6 repair node keyspace done 4 abc 0 2025-01-16T16:12:42Z 2025-01-16T16:12:45Z 2025-01-16T16:12:47Z
|
||||
|
||||
task_id type kind scope state sequence_number keyspace table entity shard start_time end_time
|
||||
1e535f9b-97fa-4788-a956-8f3216a6ea8d repair node keyspace created 6 abc 0
|
||||
d8926ee7-0faf-47b7-bfeb-82477e0c7b33 repair node keyspace running 5 abc 0 2025-01-16T16:12:57Z
|
||||
1e028cb8-31a3-45ed-8728-af7a1ab586f6 repair node keyspace done 4 abc 0 2025-01-16T16:12:45Z 2025-01-16T16:12:47Z
|
||||
task_id type kind scope state sequence_number keyspace table entity shard creation_time start_time end_time
|
||||
1e535f9b-97fa-4788-a956-8f3216a6ea8d repair node keyspace created 6 abc 0 2025-01-16T16:13:02Z
|
||||
d8926ee7-0faf-47b7-bfeb-82477e0c7b33 repair node keyspace running 5 abc 0 2025-01-16T16:12:54Z 2025-01-16T16:12:57Z
|
||||
1e028cb8-31a3-45ed-8728-af7a1ab586f6 repair node keyspace done 4 abc 0 2025-01-16T16:12:42Z 2025-01-16T16:12:45Z 2025-01-16T16:12:47Z
|
||||
|
||||
See also
|
||||
--------
|
||||
|
||||
@@ -25,6 +25,7 @@ Example output
|
||||
scope: keyspace
|
||||
state: running
|
||||
is_abortable: true
|
||||
creation_time: 2024-07-29T15:48:50Z
|
||||
start_time: 2024-07-29T15:48:55Z
|
||||
end_time:
|
||||
error:
|
||||
|
||||
@@ -26,22 +26,22 @@ For single task:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
id type kind scope state is_abortable start_time end_time error parent_id sequence_number shard keyspace table entity progress_units total completed children_ids
|
||||
be5559ea-bc5a-428c-b8ce-d14eac7a1765 repair node keyspace done true 2024-07-29T16:06:46Z 2024-07-29T16:06:46Z none 1 0 abc ranges 4 4 [{task_id: 542e38cb-9ad4-40aa-9010-de2630004e55, node: 127.0.0.1 }, {task_id: 8974ebcc-1e87-4040-88fe-f2438261f7fb, node: 127.0.0.1 }]
|
||||
542e38cb-9ad4-40aa-9010-de2630004e55 repair node shard done false 2024-07-29T16:06:46Z 2024-07-29T16:06:46Z be5559ea-bc5a-428c-b8ce-d14eac7a1765 1 0 abc ranges 2 2 []
|
||||
8974ebcc-1e87-4040-88fe-f2438261f7fb repair node shard done false 2024-07-29T16:06:46Z 2024-07-29T16:06:46Z be5559ea-bc5a-428c-b8ce-d14eac7a1765 1 1 abc ranges 2 2 []
|
||||
id type kind scope state is_abortable creation_time start_time end_time error parent_id sequence_number shard keyspace table entity progress_units total completed children_ids
|
||||
be5559ea-bc5a-428c-b8ce-d14eac7a1765 repair node keyspace done true 2024-07-29T16:06:43Z 2024-07-29T16:06:46Z 2024-07-29T16:06:46Z none 1 0 abc ranges 4 4 [{task_id: 542e38cb-9ad4-40aa-9010-de2630004e55, node: 127.0.0.1 }, {task_id: 8974ebcc-1e87-4040-88fe-f2438261f7fb, node: 127.0.0.1 }]
|
||||
542e38cb-9ad4-40aa-9010-de2630004e55 repair node shard done false 2024-07-29T16:06:43Z 2024-07-29T16:06:46Z 2024-07-29T16:06:46Z be5559ea-bc5a-428c-b8ce-d14eac7a1765 1 0 abc ranges 2 2 []
|
||||
8974ebcc-1e87-4040-88fe-f2438261f7fb repair node shard done false 2024-07-29T16:06:43Z 2024-07-29T16:06:46Z 2024-07-29T16:06:46Z be5559ea-bc5a-428c-b8ce-d14eac7a1765 1 1 abc ranges 2 2 []
|
||||
|
||||
For all tasks:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
id type kind scope state is_abortable start_time end_time error parent_id sequence_number shard keyspace table entity progress_units total completed children_ids
|
||||
16eafb1e-8b2e-48e6-bd7a-432ca3d8b9fc repair node keyspace done true 2024-07-29T16:34:46Z 2024-07-29T16:34:46Z none 1 0 abc ranges 4 4 [{task_id: e0aa1aa4-58ca-4bfb-b3e6-74e5f3a0f6ee, node: 127.0.0.1 }, {task_id: 49eb5797-b67e-46b0-9365-4460f7cf988a, node: 127.0.0.1 }]
|
||||
e0aa1aa4-58ca-4bfb-b3e6-74e5f3a0f6ee repair node shard done false 2024-07-29T16:34:46Z 2024-07-29T16:34:46Z 16eafb1e-8b2e-48e6-bd7a-432ca3d8b9fc 1 0 abc ranges 2 2 []
|
||||
49eb5797-b67e-46b0-9365-4460f7cf988a repair node shard done false 2024-07-29T16:34:46Z 2024-07-29T16:34:46Z 16eafb1e-8b2e-48e6-bd7a-432ca3d8b9fc 1 1 abc ranges 2 2 []
|
||||
82d7b2a4-146e-4a72-ba93-c66d5b4e9867 offstrategy compaction node keyspace done true 2024-07-29T16:34:16Z 2024-07-29T16:34:16Z none 954 0 abc 1 1 [{task_id: 9818277b-238d-4298-a56b-c0d2153bf140, node: 127.0.0.1 }, {task_id: c1eb0701-ad7a-45ff-956f-7b8d671fc5db, node: 127.0.0.1 }
|
||||
9818277b-238d-4298-a56b-c0d2153bf140 offstrategy compaction node shard done false 2024-07-29T16:34:16Z 2024-07-29T16:34:16Z 82d7b2a4-146e-4a72-ba93-c66d5b4e9867 954 0 abc 1 1 []
|
||||
c1eb0701-ad7a-45ff-956f-7b8d671fc5db offstrategy compaction node shard done false 2024-07-29T16:34:16Z 2024-07-29T16:34:16Z 82d7b2a4-146e-4a72-ba93-c66d5b4e9867 954 1 abc 1 1 []
|
||||
id type kind scope state is_abortable creation_time start_time end_time error parent_id sequence_number shard keyspace table entity progress_units total completed children_ids
|
||||
16eafb1e-8b2e-48e6-bd7a-432ca3d8b9fc repair node keyspace done true 2024-07-29T16:34:43Z 2024-07-29T16:34:46Z 2024-07-29T16:34:46Z none 1 0 abc ranges 4 4 [{task_id: e0aa1aa4-58ca-4bfb-b3e6-74e5f3a0f6ee, node: 127.0.0.1 }, {task_id: 49eb5797-b67e-46b0-9365-4460f7cf988a, node: 127.0.0.1 }]
|
||||
e0aa1aa4-58ca-4bfb-b3e6-74e5f3a0f6ee repair node shard done false 2024-07-29T16:34:43Z 2024-07-29T16:34:46Z 2024-07-29T16:34:46Z 16eafb1e-8b2e-48e6-bd7a-432ca3d8b9fc 1 0 abc ranges 2 2 []
|
||||
49eb5797-b67e-46b0-9365-4460f7cf988a repair node shard done false 2024-07-29T16:34:43Z 2024-07-29T16:34:46Z 2024-07-29T16:34:46Z 16eafb1e-8b2e-48e6-bd7a-432ca3d8b9fc 1 1 abc ranges 2 2 []
|
||||
82d7b2a4-146e-4a72-ba93-c66d5b4e9867 offstrategy compaction node keyspace done true 2024-07-29T16:34:13Z 2024-07-29T16:34:16Z 2024-07-29T16:34:16Z none 954 0 abc 1 1 [{task_id: 9818277b-238d-4298-a56b-c0d2153bf140, node: 127.0.0.1 }, {task_id: c1eb0701-ad7a-45ff-956f-7b8d671fc5db, node: 127.0.0.1 }
|
||||
9818277b-238d-4298-a56b-c0d2153bf140 offstrategy compaction node shard done false 2024-07-29T16:34:13Z 2024-07-29T16:34:16Z 2024-07-29T16:34:16Z 82d7b2a4-146e-4a72-ba93-c66d5b4e9867 954 0 abc 1 1 []
|
||||
c1eb0701-ad7a-45ff-956f-7b8d671fc5db offstrategy compaction node shard done false 2024-07-29T16:34:13Z 2024-07-29T16:34:16Z 2024-07-29T16:34:16Z 82d7b2a4-146e-4a72-ba93-c66d5b4e9867 954 1 abc 1 1 []
|
||||
|
||||
See also
|
||||
--------
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "tasks/task_handler.hh"
|
||||
#include "tasks/virtual_task_hint.hh"
|
||||
#include "utils/error_injection.hh"
|
||||
#include "utils/UUID_gen.hh"
|
||||
#include <variant>
|
||||
#include "utils/overloaded_functor.hh"
|
||||
|
||||
@@ -90,6 +91,7 @@ future<std::optional<tasks::task_status>> node_ops_virtual_task::get_status_help
|
||||
.scope = "cluster",
|
||||
.state = get_state(entry),
|
||||
.is_abortable = co_await is_abortable(std::move(hint)),
|
||||
.creation_time = db_clock::time_point(utils::UUID_gen::unix_timestamp(id.uuid())),
|
||||
.start_time = entry.start_time,
|
||||
.end_time = entry.end_time,
|
||||
.error = entry.error,
|
||||
@@ -167,6 +169,7 @@ future<std::vector<tasks::task_stats>> node_ops_virtual_task::get_stats() {
|
||||
.table = "",
|
||||
.entity = "",
|
||||
.shard = 0,
|
||||
.creation_time = db_clock::time_point(utils::UUID_gen::unix_timestamp(id)),
|
||||
.start_time = entry.start_time,
|
||||
.end_time = entry.end_time
|
||||
};
|
||||
|
||||
@@ -1138,8 +1138,7 @@ private:
|
||||
topology_mutation_builder builder(guard.write_timestamp());
|
||||
topology_request_tracking_mutation_builder trbuilder(global_request_id, _sp._features.topology_requests_type_column);
|
||||
trbuilder.set_truncate_table_data(table_id)
|
||||
.set("done", false)
|
||||
.set("start_time", db_clock::now());
|
||||
.set("done", false);
|
||||
|
||||
if (!_sp._features.topology_global_request_queue) {
|
||||
builder.set_global_topology_request(global_topology_request::truncate_table)
|
||||
|
||||
@@ -4940,7 +4940,6 @@ future<> storage_service::do_clusterwide_vnodes_cleanup() {
|
||||
builder.queue_global_topology_request_id(request_id);
|
||||
topology_request_tracking_mutation_builder rtbuilder(request_id, _feature_service.topology_requests_type_column);
|
||||
rtbuilder.set("done", false)
|
||||
.set("start_time", db_clock::now())
|
||||
.set("request_type", global_topology_request::cleanup);
|
||||
muts.push_back(rtbuilder.build());
|
||||
} else {
|
||||
@@ -5265,7 +5264,6 @@ future<> storage_service::raft_check_and_repair_cdc_streams() {
|
||||
topology_request_tracking_mutation_builder rtbuilder(request_id, _feature_service.topology_requests_type_column);
|
||||
builder.queue_global_topology_request_id(request_id);
|
||||
rtbuilder.set("done", false)
|
||||
.set("start_time", db_clock::now())
|
||||
.set("request_type", global_topology_request::new_cdc_generation);
|
||||
muts.push_back(rtbuilder.build());
|
||||
} else {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "service/task_manager_module.hh"
|
||||
#include "tasks/task_handler.hh"
|
||||
#include "tasks/virtual_task_hint.hh"
|
||||
#include "utils/UUID_gen.hh"
|
||||
#include <seastar/coroutine/maybe_yield.hh>
|
||||
|
||||
namespace service {
|
||||
@@ -57,9 +58,14 @@ static std::optional<tasks::task_stats> maybe_make_task_stats(const locator::tab
|
||||
.kind = tasks::task_kind::cluster,
|
||||
.scope = get_scope(task_info.request_type),
|
||||
.state = tasks::task_manager::task_state::running,
|
||||
.sequence_number = 0,
|
||||
.keyspace = schema->ks_name(),
|
||||
.table = schema->cf_name(),
|
||||
.start_time = task_info.request_time
|
||||
.entity = "",
|
||||
.shard = 0,
|
||||
.creation_time = task_info.request_time,
|
||||
.start_time = task_info.sched_time,
|
||||
.end_time = db_clock::time_point{}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -225,7 +231,8 @@ static void update_status(const locator::tablet_task_info& task_info, tasks::tas
|
||||
sched_nr += task_info.sched_nr;
|
||||
status.type = locator::tablet_task_type_to_string(task_info.request_type);
|
||||
status.scope = get_scope(task_info.request_type);
|
||||
status.start_time = task_info.request_time;
|
||||
status.creation_time = task_info.request_time;
|
||||
status.start_time = task_info.sched_time;
|
||||
}
|
||||
|
||||
future<std::optional<status_helper>> tablet_virtual_task::get_status_helper(tasks::task_id id, tasks::virtual_task_hint hint) {
|
||||
|
||||
@@ -956,6 +956,7 @@ class topology_coordinator : public endpoint_lifecycle_subscriber {
|
||||
req_entry = co_await _sys_ks.get_topology_request_entry(req_id, true);
|
||||
req = std::get<global_topology_request>(req_entry.request_type);
|
||||
}
|
||||
|
||||
switch (req) {
|
||||
case global_topology_request::new_cdc_generation: {
|
||||
rtlogger.info("new CDC generation requested");
|
||||
@@ -975,9 +976,14 @@ class topology_coordinator : public endpoint_lifecycle_subscriber {
|
||||
.set_global_topology_request(req)
|
||||
.set_global_topology_request_id(req_id)
|
||||
.drop_first_global_topology_request_id(_topo_sm._topology.global_requests_queue, req_id);
|
||||
|
||||
// Set start_time when we begin executing the request
|
||||
topology_request_tracking_mutation_builder rtbuilder(req_id);
|
||||
rtbuilder.set("start_time", db_clock::now());
|
||||
|
||||
auto reason = ::format(
|
||||
"insert CDC generation data (UUID: {})", gen_uuid);
|
||||
co_await update_topology_state(std::move(guard), {std::move(mutation), builder.build()}, reason);
|
||||
co_await update_topology_state(std::move(guard), {std::move(mutation), builder.build(), rtbuilder.build()}, reason);
|
||||
}
|
||||
break;
|
||||
case global_topology_request::cleanup:
|
||||
@@ -1068,7 +1074,9 @@ class topology_coordinator : public endpoint_lifecycle_subscriber {
|
||||
.del_global_topology_request_id()
|
||||
.drop_first_global_topology_request_id(_topo_sm._topology.global_requests_queue, req_id)
|
||||
.build()));
|
||||
// Set start_time when we begin executing the request and mark as done
|
||||
updates.push_back(canonical_mutation(topology_request_tracking_mutation_builder(req_id)
|
||||
.set("start_time", db_clock::now())
|
||||
.done(error)
|
||||
.build()));
|
||||
|
||||
@@ -1088,7 +1096,12 @@ class topology_coordinator : public endpoint_lifecycle_subscriber {
|
||||
.set_global_topology_request_id(req_id)
|
||||
.drop_first_global_topology_request_id(_topo_sm._topology.global_requests_queue, req_id)
|
||||
.set_session(session_id(req_id));
|
||||
co_await update_topology_state(std::move(guard), {builder.build()}, "TRUNCATE TABLE requested");
|
||||
|
||||
// Set start_time when we begin executing the request
|
||||
topology_request_tracking_mutation_builder rtbuilder(req_id);
|
||||
rtbuilder.set("start_time", db_clock::now());
|
||||
|
||||
co_await update_topology_state(std::move(guard), {builder.build(), rtbuilder.build()}, "TRUNCATE TABLE requested");
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -3279,6 +3292,11 @@ class topology_coordinator : public endpoint_lifecycle_subscriber {
|
||||
topology_mutation_builder builder(guard.write_timestamp());
|
||||
builder.del_global_topology_request();
|
||||
if (_feature_service.topology_global_request_queue) {
|
||||
// Set start_time when we begin executing the request
|
||||
topology_request_tracking_mutation_builder start_rtbuilder(*global_request_id);
|
||||
start_rtbuilder.set("start_time", db_clock::now());
|
||||
muts.emplace_back(start_rtbuilder.build());
|
||||
|
||||
topology_request_tracking_mutation_builder rtbuilder(*global_request_id);
|
||||
builder.del_global_topology_request_id()
|
||||
.drop_first_global_topology_request_id(_topo_sm._topology.global_requests_queue, *global_request_id);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "tasks/task_handler.hh"
|
||||
#include "tasks/virtual_task_hint.hh"
|
||||
#include "utils/overloaded_functor.hh"
|
||||
#include "utils/UUID_gen.hh"
|
||||
|
||||
#include <seastar/core/with_timeout.hh>
|
||||
|
||||
@@ -19,6 +20,11 @@ namespace tasks {
|
||||
|
||||
using task_status_variant = std::variant<tasks::task_manager::foreign_task_ptr, tasks::task_manager::task::task_essentials>;
|
||||
|
||||
static db_clock::time_point get_creation_time_from_task_id(task_id id) {
|
||||
// Task IDs are timeuuids (version 1 UUIDs), so we can extract the timestamp from them
|
||||
return db_clock::time_point(utils::UUID_gen::unix_timestamp(id.uuid()));
|
||||
}
|
||||
|
||||
static future<task_status> get_task_status(task_manager::task_ptr task) {
|
||||
auto host_id = task->get_module()->get_task_manager().get_host_id();
|
||||
auto local_task_status = task->get_status();
|
||||
@@ -29,6 +35,7 @@ static future<task_status> get_task_status(task_manager::task_ptr task) {
|
||||
.scope = local_task_status.scope,
|
||||
.state = local_task_status.state,
|
||||
.is_abortable = task->is_abortable(),
|
||||
.creation_time = get_creation_time_from_task_id(local_task_status.id),
|
||||
.start_time = local_task_status.start_time,
|
||||
.end_time = local_task_status.end_time,
|
||||
.error = local_task_status.error,
|
||||
@@ -173,6 +180,7 @@ future<utils::chunked_vector<task_status>> task_handler::get_status_recursively(
|
||||
.scope = task.task_status.scope,
|
||||
.state = task.task_status.state,
|
||||
.is_abortable = task.abortable,
|
||||
.creation_time = get_creation_time_from_task_id(task.task_status.id),
|
||||
.start_time = task.task_status.start_time,
|
||||
.end_time = task.task_status.end_time,
|
||||
.error = task.task_status.error,
|
||||
|
||||
@@ -26,6 +26,7 @@ struct task_status {
|
||||
std::string scope;
|
||||
task_manager::task_state state;
|
||||
is_abortable is_abortable;
|
||||
db_clock::time_point creation_time;
|
||||
db_clock::time_point start_time;
|
||||
db_clock::time_point end_time;
|
||||
std::string error;
|
||||
@@ -51,6 +52,7 @@ struct task_stats {
|
||||
std::string table;
|
||||
std::string entity;
|
||||
unsigned shard;
|
||||
db_clock::time_point creation_time;
|
||||
db_clock::time_point start_time;
|
||||
db_clock::time_point end_time;
|
||||
};
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "utils/assert.hh"
|
||||
#include "utils/chunked_vector.hh"
|
||||
#include "utils/overloaded_functor.hh"
|
||||
#include "utils/UUID_gen.hh"
|
||||
#include "service/storage_service.hh"
|
||||
#include "tasks/task_handler.hh"
|
||||
#include "task_manager.hh"
|
||||
@@ -559,6 +560,7 @@ future<utils::chunked_vector<task_stats>> task_manager::module::get_stats(is_int
|
||||
.table = task->get_status().table,
|
||||
.entity = task->get_status().entity,
|
||||
.shard = task->get_status().shard,
|
||||
.creation_time = db_clock::time_point(utils::UUID_gen::unix_timestamp(task->id().uuid())),
|
||||
.start_time = task->get_status().start_time,
|
||||
.end_time = task->get_status().end_time,
|
||||
});
|
||||
|
||||
@@ -38,6 +38,7 @@ class TaskStats(NamedTuple):
|
||||
entity: str
|
||||
sequence_number: SequenceNum
|
||||
shard: int
|
||||
creation_time: str
|
||||
start_time: str
|
||||
end_time: str
|
||||
|
||||
@@ -54,6 +55,7 @@ class TaskStatus(NamedTuple):
|
||||
entity: str
|
||||
sequence_number: SequenceNum
|
||||
is_abortable: bool
|
||||
creation_time: str
|
||||
start_time: str
|
||||
end_time: str
|
||||
error: str
|
||||
|
||||
@@ -3174,7 +3174,7 @@ void tasks_print_status(const rjson::value& res) {
|
||||
auto status = res.GetObject();
|
||||
for (const auto& x: status) {
|
||||
if (x.value.IsString()) {
|
||||
if (strcmp(x.name.GetString(), "start_time") == 0 || strcmp(x.name.GetString(), "end_time") == 0) {
|
||||
if (strcmp(x.name.GetString(), "creation_time") == 0 || strcmp(x.name.GetString(), "start_time") == 0 || strcmp(x.name.GetString(), "end_time") == 0) {
|
||||
fmt::print("{}: {}\n", x.name.GetString(), get_time(x.value.GetString()));
|
||||
} else {
|
||||
fmt::print("{}: {}\n", x.name.GetString(), x.value.GetString());
|
||||
@@ -3226,6 +3226,7 @@ void tasks_add_tree_to_statuses_lists(Tabulate& table, const rjson::value& res)
|
||||
rjson::to_string_view(status["scope"]),
|
||||
rjson::to_string_view(status["state"]),
|
||||
status["is_abortable"].GetBool(),
|
||||
get_time(rjson::to_string_view(status["creation_time"])),
|
||||
get_time(rjson::to_string_view(status["start_time"])),
|
||||
get_time(rjson::to_string_view(status["end_time"])),
|
||||
rjson::to_string_view(status["error"]),
|
||||
@@ -3245,7 +3246,7 @@ void tasks_add_tree_to_statuses_lists(Tabulate& table, const rjson::value& res)
|
||||
void tasks_print_trees(const std::vector<rjson::value>& res) {
|
||||
Tabulate table;
|
||||
table.add("id", "type", "kind", "scope", "state",
|
||||
"is_abortable", "start_time", "end_time", "error", "parent_id",
|
||||
"is_abortable", "creation_time", "start_time", "end_time", "error", "parent_id",
|
||||
"sequence_number", "shard", "keyspace", "table", "entity",
|
||||
"progress_units", "total", "completed", "children_ids");
|
||||
|
||||
@@ -3259,7 +3260,7 @@ void tasks_print_trees(const std::vector<rjson::value>& res) {
|
||||
void tasks_print_stats_list(const rjson::value& res) {
|
||||
auto stats = res.GetArray();
|
||||
Tabulate table;
|
||||
table.add("task_id", "type", "kind", "scope", "state", "sequence_number", "keyspace", "table", "entity", "shard", "start_time", "end_time");
|
||||
table.add("task_id", "type", "kind", "scope", "state", "sequence_number", "keyspace", "table", "entity", "shard", "creation_time", "start_time", "end_time");
|
||||
for (auto& element : stats) {
|
||||
const auto& s = element.GetObject();
|
||||
|
||||
@@ -3273,6 +3274,7 @@ void tasks_print_stats_list(const rjson::value& res) {
|
||||
rjson::to_string_view(s["table"]),
|
||||
rjson::to_string_view(s["entity"]),
|
||||
s["shard"].GetUint(),
|
||||
get_time(rjson::to_string_view(s["creation_time"])),
|
||||
get_time(rjson::to_string_view(s["start_time"])),
|
||||
get_time(rjson::to_string_view(s["end_time"])));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user