Skip to content

Commit 931d85b

Browse files
committed
feat/show-process-list:
### Implement Process Management Enhancements - **Error Handling Enhancements**: - Added new error variants `BumpSequence`, `StartReportTask`, `ReportProcess`, and `BuildProcessManager` in `error.rs` to improve error handling for process management tasks. - Updated `ErrorExt` implementations to handle new error types. - **Process Manager Improvements**: - Introduced `ProcessManager` enhancements in `process_manager.rs` to manage process states using `ProcessWithState` and `ProcessState` enums. - Implemented periodic task `ReportTask` to report running queries to the KV backend. - Modified `register_query` and `deregister_query` methods to use the new state management system. - **Testing and Validation**: - Updated tests in `process_manager.rs` to validate new process management logic. - Replaced `dump` method with `list_all_processes` for listing processes. - **Integration with Frontend and Standalone**: - Updated `frontend.rs` and `standalone.rs` to handle `ProcessManager` initialization errors using `BuildProcessManager` error variant. - **Schema Adjustments**: - Modified `process_list.rs` in `system_schema/information_schema` to use the updated process listing method. - **Key-Value Conversion**: - Added `TryFrom` implementation for converting `Process` to `KeyValue` in `process_list.rs`.
1 parent b84e511 commit 931d85b

File tree

7 files changed

+265
-100
lines changed

7 files changed

+265
-100
lines changed

src/catalog/src/error.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,33 @@ pub enum Error {
278278
location: Location,
279279
},
280280

281+
#[snafu(display("Failed to bump sequence for process manager"))]
282+
BumpSequence {
283+
source: common_meta::error::Error,
284+
#[snafu(implicit)]
285+
location: Location,
286+
},
287+
281288
#[snafu(display("Failed to list running processes"))]
282289
ListProcess {
283290
source: common_meta::error::Error,
284291
#[snafu(implicit)]
285292
location: Location,
286293
},
294+
295+
#[snafu(display("Failed to start process report task"))]
296+
StartReportTask {
297+
source: common_runtime::error::Error,
298+
#[snafu(implicit)]
299+
location: Location,
300+
},
301+
302+
#[snafu(display("Failed to report process state"))]
303+
ReportProcess {
304+
source: common_meta::error::Error,
305+
#[snafu(implicit)]
306+
location: Location,
307+
},
287308
}
288309

289310
impl Error {
@@ -351,7 +372,10 @@ impl ErrorExt for Error {
351372
Error::TableMetadataManager { source, .. } => source.status_code(),
352373
Error::GetViewCache { source, .. }
353374
| Error::GetTableCache { source, .. }
354-
| Error::ListProcess { source, .. } => source.status_code(),
375+
| Error::BumpSequence { source, .. }
376+
| Error::ListProcess { source, .. }
377+
| Error::ReportProcess { source, .. } => source.status_code(),
378+
Error::StartReportTask { .. } => StatusCode::Internal,
355379
}
356380
}
357381

0 commit comments

Comments
 (0)