add two paramaters about faststack
This commit is contained in:
17
deps/oblib/src/lib/signal/ob_signal_handlers.cpp
vendored
17
deps/oblib/src/lib/signal/ob_signal_handlers.cpp
vendored
@ -32,7 +32,20 @@ namespace oceanbase
|
||||
namespace common
|
||||
{
|
||||
|
||||
int64_t FASTSTACK_MIN_INTERVAL = 30 * 60 * 1000 * 1000; // 30min
|
||||
ObSigFaststack::ObSigFaststack()
|
||||
: min_interval_(30 * 60 * 1000 * 1000UL) // 30min
|
||||
{
|
||||
}
|
||||
|
||||
ObSigFaststack::~ObSigFaststack()
|
||||
{
|
||||
}
|
||||
|
||||
ObSigFaststack &ObSigFaststack::get_instance()
|
||||
{
|
||||
static ObSigFaststack sig_faststack;
|
||||
return sig_faststack;
|
||||
}
|
||||
|
||||
static const int SIG_SET[] = {SIGABRT, SIGBUS, SIGFPE, SIGSEGV, SIGURG};
|
||||
static constexpr char MINICORE_SHELL_PATH[] = "tools/minicore.sh";
|
||||
@ -268,7 +281,7 @@ int faststack()
|
||||
int64_t now = ObTimeUtility::fast_current_time();
|
||||
int64_t last = ATOMIC_LOAD(&last_ts);
|
||||
int ret = OB_SUCCESS;
|
||||
if (now - last < FASTSTACK_MIN_INTERVAL) {
|
||||
if (now - last < ObSigFaststack::get_instance().get_min_interval()) {
|
||||
ret = OB_EAGAIN;
|
||||
} else if (!ATOMIC_BCAS(&last_ts, last, now)) {
|
||||
ret = OB_EAGAIN;
|
||||
|
||||
14
deps/oblib/src/lib/signal/ob_signal_handlers.h
vendored
14
deps/oblib/src/lib/signal/ob_signal_handlers.h
vendored
@ -21,6 +21,20 @@ namespace oceanbase
|
||||
{
|
||||
namespace common
|
||||
{
|
||||
class ObSigFaststack
|
||||
{
|
||||
public:
|
||||
ObSigFaststack(const ObSigFaststack &) = delete;
|
||||
ObSigFaststack& operator=(const ObSigFaststack &) = delete;
|
||||
static ObSigFaststack &get_instance();
|
||||
inline int64_t get_min_interval() const { return min_interval_; }
|
||||
inline void set_min_interval(int64_t interval) { min_interval_ = interval; }
|
||||
private:
|
||||
ObSigFaststack();
|
||||
~ObSigFaststack();
|
||||
private:
|
||||
int64_t min_interval_;
|
||||
};
|
||||
extern int minicoredump(int sig, int64_t tid, pid_t& pid);
|
||||
extern int faststack();
|
||||
} // namespace common
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
#include "lib/alloc/ob_malloc_sample_struct.h"
|
||||
#include "lib/allocator/ob_tc_malloc.h"
|
||||
#include "lib/allocator/ob_mem_leak_checker.h"
|
||||
#include "lib/signal/ob_signal_handlers.h"
|
||||
#include "share/scheduler/ob_tenant_dag_scheduler.h"
|
||||
#include "rpc/obrpc/ob_rpc_handler.h"
|
||||
#include "share/ob_cluster_version.h"
|
||||
@ -319,6 +320,10 @@ int ObServerReloadConfig::operator()()
|
||||
{
|
||||
ObMallocAllocator::get_instance()->force_malloc_for_absent_tenant_ = GCONF._force_malloc_for_absent_tenant;
|
||||
}
|
||||
|
||||
{
|
||||
ObSigFaststack::get_instance().set_min_interval(GCONF._faststack_min_interval.get_value());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -67,8 +67,6 @@ using namespace oceanbase::obrpc;
|
||||
#define SHRINK_INTERVAL (1 * 1000 * 1000)
|
||||
#define SLEEP_INTERVAL (60 * 1000 * 1000)
|
||||
|
||||
int64_t FASTSTACK_REQ_QUEUE_SIZE_THRESHOLD = INT64_MAX;
|
||||
|
||||
extern "C" {
|
||||
int ob_pthread_create(void **ptr, void *(*start_routine) (void *), void *arg);
|
||||
int ob_pthread_tryjoin_np(void *ptr);
|
||||
@ -1521,7 +1519,8 @@ int ObTenant::recv_request(ObRequest &req)
|
||||
EVENT_INC(REQUEST_ENQUEUE_COUNT);
|
||||
}
|
||||
|
||||
if (OB_SIZE_OVERFLOW == ret || req_queue_.size() >= FASTSTACK_REQ_QUEUE_SIZE_THRESHOLD) {
|
||||
if (OB_SIZE_OVERFLOW == ret || (GCONF._faststack_req_queue_size_threshold.get_value() > 0 &&
|
||||
req_queue_.size() >= GCONF._faststack_req_queue_size_threshold.get_value())) {
|
||||
IGNORE_RETURN faststack();
|
||||
}
|
||||
|
||||
|
||||
@ -1862,3 +1862,12 @@ ERRSIM_DEF_INT(errsim_backup_task_batch_size, OB_CLUSTER_PARAMETER, "0", "[0,)",
|
||||
"the batch size backup task receive in errsim mode"
|
||||
"Range: [0,) in integer",
|
||||
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
|
||||
// automatically faststack
|
||||
DEF_INT(_faststack_req_queue_size_threshold, OB_CLUSTER_PARAMETER, "0", "[0,)",
|
||||
"When the size of the req_queue reaches this threshold, the obstack will be "
|
||||
"collected automatically. Default: 0, means set off. Range: [0, +∞)",
|
||||
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
|
||||
DEF_TIME(_faststack_min_interval, OB_CLUSTER_PARAMETER, "30m", "[1s,)",
|
||||
"Minimum interval for OBServer to automatically collect the obstack. "
|
||||
"Default: 30min. Range: [1s,+∞)",
|
||||
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
|
||||
|
||||
@ -315,6 +315,8 @@ _enable_transaction_internal_routing
|
||||
_enable_values_table_folding
|
||||
_enable_var_assign_use_das
|
||||
_endpoint_tenant_mapping
|
||||
_faststack_min_interval
|
||||
_faststack_req_queue_size_threshold
|
||||
_fast_commit_callback_count
|
||||
_follower_snapshot_read_retry_duration
|
||||
_force_explict_500_malloc
|
||||
|
||||
Reference in New Issue
Block a user