Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion be/src/http/ev_http_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ EvHttpServer::~EvHttpServer() {

void EvHttpServer::start() {
// bind to
CHECK(_bind().ok());
auto s = _bind();
CHECK(s.ok()) << s.to_string();
ThreadPoolBuilder("EvHttpServer")
.set_min_threads(_num_workers)
.set_max_threads(_num_workers)
Expand Down
13 changes: 9 additions & 4 deletions be/src/runtime/fragment_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
namespace doris {

DEFINE_GAUGE_METRIC_PROTOTYPE_2ARG(plan_fragment_count, MetricUnit::NOUNIT);
DEFINE_GAUGE_METRIC_PROTOTYPE_2ARG(timeout_canceled_fragment_count, MetricUnit::NOUNIT);

std::string to_load_error_http_path(const std::string& file_name) {
if (file_name.empty()) {
Expand Down Expand Up @@ -381,16 +382,19 @@ FragmentMgr::FragmentMgr(ExecEnv* exec_env)
: _exec_env(exec_env),
_fragment_map(),
_stop_background_threads_latch(1) {
_entity = DorisMetrics::instance()->metric_registry()->register_entity("FragmentMgr");
INT_UGAUGE_METRIC_REGISTER(_entity, timeout_canceled_fragment_count);
REGISTER_HOOK_METRIC(plan_fragment_count, [this]() {
std::lock_guard<std::mutex> lock(_lock);
return _fragment_map.size();
});

CHECK(Thread::create("FragmentMgr", "cancel_timeout_plan_fragment",
[this]() {
this->cancel_worker();
},
&_cancel_thread).ok());

REGISTER_HOOK_METRIC(plan_fragment_count, [this]() {
std::lock_guard<std::mutex> lock(_lock);
return _fragment_map.size();
});
// TODO(zc): we need a better thread-pool
// now one user can use all the thread pool, others have no resource.
ThreadPoolBuilder("FragmentMgrThreadPool")
Expand Down Expand Up @@ -523,6 +527,7 @@ void FragmentMgr::cancel_worker() {
}
}
}
timeout_canceled_fragment_count->increment(to_delete.size());
for (auto& id : to_delete) {
cancel(id, PPlanFragmentCancelReason::TIMEOUT);
LOG(INFO) << "FragmentMgr cancel worker going to cancel timeout fragment " << print_id(id);
Expand Down
4 changes: 4 additions & 0 deletions be/src/runtime/fragment_mgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "http/rest_monitor_iface.h"
#include "gutil/ref_counted.h"
#include "util/countdown_latch.h"
#include "util/metrics.h"
#include "util/thread.h"

namespace doris {
Expand Down Expand Up @@ -93,6 +94,9 @@ class FragmentMgr : public RestMonitorIface {
scoped_refptr<Thread> _cancel_thread;
// every job is a pool
std::unique_ptr<ThreadPool> _thread_pool;

std::shared_ptr<MetricEntity> _entity = nullptr;
UIntGauge* timeout_canceled_fragment_count = nullptr;
};

}
Expand Down