adjust faststack parameter

This commit is contained in:
zhjc1124
2023-11-30 12:47:07 +00:00
committed by ob-robot
parent 9e5b23b63e
commit 13256e6822
2 changed files with 7 additions and 3 deletions

View File

@ -31,6 +31,9 @@ namespace oceanbase
{
namespace common
{
int64_t FASTSTACK_MIN_INTERVAL = 30 * 60 * 1000 * 1000; // 30min
static const int SIG_SET[] = {SIGABRT, SIGBUS, SIGFPE, SIGSEGV, SIGURG};
static constexpr char MINICORE_SHELL_PATH[] = "tools/minicore.sh";
static constexpr char FASTSTACK_SHELL_PATH[] = "tools/callstack.sh";
@ -261,12 +264,11 @@ int minicoredump(int sig, int64_t tid, pid_t& pid)
int faststack()
{
static constexpr int64_t MIN_INTERVAL = 30 * 60 * 1000 * 1000; // 30min
static int64_t last_ts = 0;
int64_t now = ObTimeUtility::fast_current_time();
int64_t last = ATOMIC_LOAD(&last_ts);
int ret = OB_SUCCESS;
if (now - last < MIN_INTERVAL) {
if (now - last < FASTSTACK_MIN_INTERVAL) {
ret = OB_EAGAIN;
} else if (!ATOMIC_BCAS(&last_ts, last, now)) {
ret = OB_EAGAIN;

View File

@ -66,6 +66,8 @@ using namespace oceanbase::obrpc;
#define EXPAND_INTERVAL (1 * 1000 * 1000)
#define SHRINK_INTERVAL (1 * 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);
@ -1344,7 +1346,7 @@ int ObTenant::recv_request(ObRequest &req)
if (OB_SUCC(ret)) {
ObTenantStatEstGuard guard(id_);
EVENT_INC(REQUEST_ENQUEUE_COUNT);
} else if (OB_SIZE_OVERFLOW == ret) {
} else if (OB_SIZE_OVERFLOW == ret || req_queue_.size() >= FASTSTACK_REQ_QUEUE_SIZE_THRESHOLD) {
IGNORE_RETURN faststack();
}