This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch resource_ctx
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/resource_ctx by this push:
new 521931f66e9 f
521931f66e9 is described below
commit 521931f66e9718c991abe06da38fa7be8743a262
Author: yiguolei <[email protected]>
AuthorDate: Fri Dec 6 21:16:52 2024 +0800
f
---
be/src/runtime/workload_management/io_context.h | 2 +-
.../runtime/workload_management/resource_context.h | 33 ++++++++++++++++++----
2 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/be/src/runtime/workload_management/io_context.h
b/be/src/runtime/workload_management/io_context.h
index b6e883264a1..886e436a3bf 100644
--- a/be/src/runtime/workload_management/io_context.h
+++ b/be/src/runtime/workload_management/io_context.h
@@ -75,7 +75,7 @@ public:
public:
IOContext() {}
virtual ~IOContext() = default;
- IOThrottle* get_io_throttle() {}
+ IOThrottle* io_throttle() {}
};
} // namespace doris
diff --git a/be/src/runtime/workload_management/resource_context.h
b/be/src/runtime/workload_management/resource_context.h
index 7473d6e3afa..b5e5400165b 100644
--- a/be/src/runtime/workload_management/resource_context.h
+++ b/be/src/runtime/workload_management/resource_context.h
@@ -43,19 +43,40 @@ class ResourceContext : public
std::enable_shared_from_this<ResourceContext> {
ENABLE_FACTORY_CREATOR(ResourceContext);
public:
- ResourceContext() = default;
+ ResourceContext() {
+ // These all default values, it may be reset.
+ cpu_context_ = std::make_shared<CPUContext>();
+ memory_context_ = std::make_shared<MemoryContext>();
+ io_context_ = std::make_shared<IOContext>();
+ reclaimer_ = std::make_shared<ResourceReclaimer>();
+ }
virtual ~ResourceContext() = default;
- void set_workload_group() {
+ CPUContext* cpu_context() { return cpu_context_.get(); }
+ MemoryContext* memory_context() { return memory_context_.get(); }
+ IOContext* io_context() { return io_context_.get(); }
+ ResourceReclaimer* reclaimer() { return reclaimer_.get(); }
+
+ void set_cpu_context(std::shared_ptr<CPUContext> cpu_context) {
cpu_context_ = cpu_context; }
+ void set_memory_context(std::shared_ptr<MemoryContext> memory_context) {
+ memory_context_ = memory_context;
+ }
+ void set_io_context(std::shared_ptr<IOContext> io_context) { io_context_ =
io_context; }
+ void set_reclaimer(std::shared_ptr<ResourceReclaimer> reclaimer) {
reclaimer_ = reclaimer; }
+
+ void set_workload_group(std::shared_ptr<WorkloadGroup> wg) {
// update all child context's workload group property
+ workload_group_ = wg;
}
private:
// The controller's init value is nullptr, it means the resource context
will ignore this controller.
- std::shared_ptr<CPUContext> _cpu_context = nullptr;
- std::shared_ptr<MemoryContext> _memory_context = nullptr;
- std::shared_ptr<IOContext> _io_context = nullptr;
- std::shared_ptr<ResourceReclaimer> _reclaimer = nullptr;
+ std::shared_ptr<CPUContext> cpu_context_ = nullptr;
+ std::shared_ptr<MemoryContext> memory_context_ = nullptr;
+ std::shared_ptr<IOContext> io_context_ = nullptr;
+ std::shared_ptr<ResourceReclaimer> reclaimer_ = nullptr;
+ // Workload group will own resource context, so that resource context only
have weak ptr for workload group.
+ std::weak_ptr<WorkloadGroup> workload_group_ = nullptr;
};
} // namespace doris
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]