fix coverity
This commit is contained in:
7
deps/oblib/src/lib/trace/ob_trace.cpp
vendored
7
deps/oblib/src/lib/trace/ob_trace.cpp
vendored
@ -66,15 +66,16 @@ void flush_trace()
|
|||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
ObTagCtxBase* tag = span->tags_;
|
ObTagCtxBase* tag = span->tags_;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
char tagstr[] = "\"tags\":[";
|
||||||
INIT_SPAN(span);
|
INIT_SPAN(span);
|
||||||
while (OB_SUCC(ret) && OB_NOT_NULL(tag)) {
|
while (OB_SUCC(ret) && OB_NOT_NULL(tag)) {
|
||||||
if (pos + 10 >= MAX_TRACE_LOG_SIZE) {
|
if (pos + sizeof(tagstr) + 1 >= MAX_TRACE_LOG_SIZE) {
|
||||||
ret = OB_BUF_NOT_ENOUGH;
|
ret = OB_BUF_NOT_ENOUGH;
|
||||||
} else {
|
} else {
|
||||||
buf[pos++] = ',';
|
buf[pos++] = ',';
|
||||||
if (first) {
|
if (first) {
|
||||||
strcpy(buf + pos, "\"tags\":[");
|
strncpy(buf + pos, tagstr, MAX_TRACE_LOG_SIZE - pos);
|
||||||
pos += 8;
|
pos += sizeof(tagstr) - 1;
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
ret = tag->tostring(buf, MAX_TRACE_LOG_SIZE, pos);
|
ret = tag->tostring(buf, MAX_TRACE_LOG_SIZE, pos);
|
||||||
|
|||||||
2
deps/oblib/src/lib/trace/ob_trace.h
vendored
2
deps/oblib/src/lib/trace/ob_trace.h
vendored
@ -151,7 +151,7 @@ struct ObTagCtxBase
|
|||||||
} else {
|
} else {
|
||||||
buf[pos++] = '{';
|
buf[pos++] = '{';
|
||||||
buf[pos++] = '\"';
|
buf[pos++] = '\"';
|
||||||
IGNORE_RETURN strcpy(buf + pos, __tag_name_mapper[tag_type_]);
|
IGNORE_RETURN strncpy(buf + pos, __tag_name_mapper[tag_type_], buf_len - pos);
|
||||||
pos += l;
|
pos += l;
|
||||||
buf[pos++] = '\"';
|
buf[pos++] = '\"';
|
||||||
buf[pos++] = ':';
|
buf[pos++] = ':';
|
||||||
|
|||||||
@ -1217,7 +1217,7 @@ int select_sql_workarea_active(lua_State *L)
|
|||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
} else {
|
} else {
|
||||||
ObArray<uint64_t> ids;
|
ObArray<uint64_t> ids;
|
||||||
common::ObSEArray<sql::ObSqlWorkareaProfileInfo, 32> wa_actives;
|
common::ObSEArray<sql::ObSqlWorkareaProfileInfo, 20> wa_actives;
|
||||||
std::vector<const char*> columns = {
|
std::vector<const char*> columns = {
|
||||||
"plan_id",
|
"plan_id",
|
||||||
"sql_id",
|
"sql_id",
|
||||||
|
|||||||
@ -282,7 +282,7 @@ void ObTaskController::calc_log_rate()
|
|||||||
{
|
{
|
||||||
const double total = std::accumulate(
|
const double total = std::accumulate(
|
||||||
rate_pctgs_, rate_pctgs_ + MAX_TASK_ID, .0);
|
rate_pctgs_, rate_pctgs_ + MAX_TASK_ID, .0);
|
||||||
for (int i = 0; total != 0 && i < MAX_TASK_ID; i++) {
|
for (int i = 0; total > 0 && i < MAX_TASK_ID; i++) {
|
||||||
limiters_[i]->set_rate(
|
limiters_[i]->set_rate(
|
||||||
static_cast<int64_t>(
|
static_cast<int64_t>(
|
||||||
rate_pctgs_[i]/total * static_cast<double>(log_rate_limit_)));
|
rate_pctgs_[i]/total * static_cast<double>(log_rate_limit_)));
|
||||||
|
|||||||
Reference in New Issue
Block a user