Do not report ERROR when sample rate equals 100
This commit is contained in:
@ -81,12 +81,23 @@ namespace sql
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t tenant_id = lib::current_resource_owner_id();
|
||||
int64_t mem_limit = lib::get_tenant_memory_limit(tenant_id);
|
||||
int64_t queue_size = MAX_QUEUE_SIZE;
|
||||
if (OB_FAIL(span_mgr->init(tenant_id, mem_limit, queue_size))) {
|
||||
LOG_WARN("failed to init request manager", K(ret));
|
||||
span_mgr = OB_NEW(ObFLTSpanMgr, ObMemAttr(tenant_id, "SqlFltSpanRec"));
|
||||
if (nullptr == span_mgr) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("failed to alloc memory for ObMySQLRequestManager", K(ret));
|
||||
} else {
|
||||
// do nothing
|
||||
int64_t mem_limit = lib::get_tenant_memory_limit(tenant_id);
|
||||
int64_t queue_size = MAX_QUEUE_SIZE;
|
||||
if (OB_FAIL(span_mgr->init(tenant_id, mem_limit, queue_size))) {
|
||||
LOG_WARN("failed to init request manager", K(ret));
|
||||
} else {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret) && span_mgr != nullptr) {
|
||||
// cleanup
|
||||
common::ob_delete(span_mgr);
|
||||
span_mgr = nullptr;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -32,7 +32,6 @@ EVENT_INFO(BLOCKSCAN_BLOCK_CNT, blockscan_block_cnt)
|
||||
EVENT_INFO(BLOCKSCAN_ROW_CNT, blockscan_row_cnt)
|
||||
EVENT_INFO(PUSHDOWN_STORAGE_FILTER_ROW_CNT, pushdown_storage_filter_row_cnt)
|
||||
EVENT_INFO(FUSE_ROW_CACHE_HIT, fuse_row_cache_hit)
|
||||
EVENT_INFO(SCHEDULE_TIME, schedule_time)
|
||||
#endif
|
||||
|
||||
#ifndef OCEANBASE_SQL_OB_EXEC_STAT_H
|
||||
@ -101,10 +100,6 @@ struct ObExecRecord
|
||||
blockscan_row_cnt_##se##_ = EVENT_STAT_GET(arr, ObStatEventIds::BLOCKSCAN_ROW_CNT); \
|
||||
pushdown_storage_filter_row_cnt_##se##_ = EVENT_STAT_GET(arr, ObStatEventIds::PUSHDOWN_STORAGE_FILTER_ROW_CNT); \
|
||||
fuse_row_cache_hit_##se##_= EVENT_STAT_GET(arr, ObStatEventIds::FUSE_ROW_CACHE_HIT); \
|
||||
user_io_time_##se##_ = EVENT_STAT_GET(arr, ObStatEventIds::USER_IO_WAIT_TIME); \
|
||||
application_time_##se##_ = EVENT_STAT_GET(arr, ObStatEventIds::APWAIT_TIME); \
|
||||
concurrency_time_##se##_ = EVENT_STAT_GET(arr, ObStatEventIds::CCWAIT_TIME); \
|
||||
schedule_time_##se##_ = EVENT_STAT_GET(arr, ObStatEventIds::SCHEDULE_WAIT_TIME); \
|
||||
} \
|
||||
} while(0);
|
||||
|
||||
@ -134,7 +129,6 @@ struct ObExecRecord
|
||||
UPDATE_EVENT(user_io_time);
|
||||
UPDATE_EVENT(concurrency_time);
|
||||
UPDATE_EVENT(application_time);
|
||||
UPDATE_EVENT(schedule_time);
|
||||
UPDATE_EVENT(memstore_read_row_count);
|
||||
UPDATE_EVENT(ssstore_read_row_count);
|
||||
UPDATE_EVENT(data_block_read_cnt);
|
||||
@ -338,7 +332,7 @@ struct ObAuditRecordData {
|
||||
|
||||
ObString get_snapshot_source() const
|
||||
{
|
||||
return ObString(snapshot_source_);
|
||||
return ObString(snapshot_.source_);
|
||||
}
|
||||
|
||||
int16_t seq_; //packet->get_packet_header().seq_; always 0 currently
|
||||
@ -405,15 +399,11 @@ struct ObAuditRecordData {
|
||||
int64_t scn_; // snapshot's position in the txn
|
||||
char const* source_; // snapshot's acquire source
|
||||
} snapshot_; // stmt's tx snapshot
|
||||
int64_t seq_num_; // sequence num, for sequencing stmts in transaction
|
||||
uint64_t txn_free_route_flag_; // flag contains txn free route meta
|
||||
uint64_t txn_free_route_version_; // the version of txn's state
|
||||
bool partition_hit_;// flag for need das partition route or not
|
||||
bool is_perf_event_closed_;
|
||||
char flt_trace_id_[OB_MAX_UUID_STR_LENGTH + 1];
|
||||
char snapshot_source_[OB_MAX_SNAPSHOT_SOURCE_LENGTH + 1];
|
||||
uint64_t total_memstore_read_row_count_;
|
||||
uint64_t total_ssstore_read_row_count_;
|
||||
};
|
||||
|
||||
} //namespace sql
|
||||
|
||||
@ -49,7 +49,7 @@ namespace sql
|
||||
//DBID:[10] '1492669708'
|
||||
//SESSIONID:[10] '4294967295'
|
||||
//USERHOST:[23] 'OceanBase224012.sqa.bja'
|
||||
//CLIENT ADDRESS:[56] '(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=53119))'
|
||||
//CLIENT ADDRESS:[56] '(ADDRESS=(PROTOCOL=tcp)(HOST=10.125.224.12)(PORT=53119))'
|
||||
//ACTION NUMBER:[3] '100'
|
||||
class ObSecurityAuditData : public common::ObBasebLogPrint
|
||||
{
|
||||
|
||||
@ -73,8 +73,7 @@ namespace sql
|
||||
{
|
||||
|
||||
ObSqlPlan::ObSqlPlan(common::ObIAllocator &allocator)
|
||||
:allocator_(allocator),
|
||||
session_(NULL)
|
||||
:allocator_(allocator)
|
||||
{
|
||||
}
|
||||
|
||||
@ -152,10 +151,13 @@ int ObSqlPlan::store_sql_plan_for_explain(ObExecContext *ctx,
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
if (allocate_mem_failed || plan_strs.empty()) {
|
||||
if (allocate_mem_failed) {
|
||||
if (OB_FAIL(plan_strs.push_back("Plan truncated due to insufficient memory!"))) {
|
||||
LOG_WARN("failed to push back string", K(ret));
|
||||
}
|
||||
} else if (plan_strs.empty()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("failed to generate plan", K(ret));
|
||||
}
|
||||
}
|
||||
destroy_buffer(plan_text);
|
||||
@ -227,39 +229,6 @@ int ObSqlPlan::get_plan_outline_info_one_line(PlanText &plan_text,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObSqlPlan::get_plan_used_hint_info_one_line(PlanText &plan_text,
|
||||
ObLogPlan* plan)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const ObQueryCtx *query_ctx = NULL;
|
||||
if (OB_ISNULL(plan) ||
|
||||
OB_ISNULL(query_ctx = plan->get_optimizer_context().get_query_ctx())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("unexpected NULL", K(ret), K(plan), K(query_ctx));
|
||||
} else {
|
||||
const ObQueryHint &query_hint = query_ctx->get_query_hint();
|
||||
plan_text.is_used_hint_ = true;
|
||||
plan_text.is_oneline_ = true;
|
||||
plan_text.pos_ = 0;
|
||||
BUF_PRINT_CONST_STR("/*+ ", plan_text);
|
||||
if (OB_FAIL(get_plan_tree_used_hint(plan_text, plan->get_plan_root()))) {
|
||||
LOG_WARN("failed to get plan tree used hint", K(ret));
|
||||
} else if (OB_FAIL(query_hint.print_qb_name_hints(plan_text))) {
|
||||
LOG_WARN("failed to print qb name hints", K(ret));
|
||||
} else if (OB_FAIL(query_hint.print_transform_hints(plan_text))) {
|
||||
LOG_WARN("failed to print all transform hints", K(ret));
|
||||
} else if (OB_FAIL(query_hint.get_global_hint().print_global_hint(plan_text))) {
|
||||
LOG_WARN("failed to print global hint", K(ret));
|
||||
} else {
|
||||
BUF_PRINT_CONST_STR(" */", plan_text);
|
||||
}
|
||||
if (OB_SIZE_OVERFLOW == ret) {
|
||||
ret = OB_SUCCESS;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObSqlPlan::get_global_hint_outline(PlanText &plan_text, ObLogPlan &plan)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -278,17 +247,15 @@ int ObSqlPlan::construct_outline_global_hint(ObLogPlan &plan, ObGlobalHint &outl
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObDelUpdLogPlan *del_upd_plan = NULL;
|
||||
outline_global_hint.opt_features_version_ = ObGlobalHint::CURRENT_OUTLINE_ENABLE_VERSION;
|
||||
outline_global_hint.pdml_option_ = ObPDMLOption::NOT_SPECIFIED;
|
||||
outline_global_hint.parallel_ = ObGlobalHint::UNSET_PARALLEL;
|
||||
const ObQueryCtx *query_ctx = NULL;
|
||||
if (OB_ISNULL(query_ctx = plan.get_optimizer_context().get_query_ctx())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("unexpected NULL", K(ret), K(query_ctx));
|
||||
} else {
|
||||
outline_global_hint.opt_features_version_ = query_ctx->optimizer_features_enable_version_;
|
||||
if (NULL != (del_upd_plan = dynamic_cast<ObDelUpdLogPlan*>(&plan)) && del_upd_plan->use_pdml()) {
|
||||
outline_global_hint.pdml_option_ = ObPDMLOption::ENABLE;
|
||||
}
|
||||
if (OB_SUCC(ret) && NULL != (del_upd_plan = dynamic_cast<ObDelUpdLogPlan*>(&plan))
|
||||
&& del_upd_plan->use_pdml()) {
|
||||
outline_global_hint.pdml_option_ = ObPDMLOption::ENABLE;
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
outline_global_hint.parallel_ = ObGlobalHint::UNSET_PARALLEL;
|
||||
if (plan.get_optimizer_context().is_use_auto_dop()) {
|
||||
outline_global_hint.merge_parallel_hint(ObGlobalHint::SET_ENABLE_AUTO_DOP);
|
||||
} else if (plan.get_optimizer_context().get_max_parallel() > ObGlobalHint::DEFAULT_PARALLEL) {
|
||||
@ -1079,12 +1046,10 @@ int ObSqlPlan::print_constraint_info(char *buf,
|
||||
int ObSqlPlan::format_sql_plan(ObIArray<ObSqlPlanItem*> &sql_plan_infos,
|
||||
ExplainType type,
|
||||
const ObExplainDisplayOpt& option,
|
||||
PlanText &plan_text,
|
||||
const bool alloc_buffer)
|
||||
PlanText &plan_text)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (alloc_buffer &&
|
||||
OB_FAIL(init_buffer(plan_text))) {
|
||||
if (OB_FAIL(init_buffer(plan_text))) {
|
||||
LOG_WARN("failed to init buffer", K(ret));
|
||||
} else if (sql_plan_infos.empty()) {
|
||||
//do nothing
|
||||
@ -1203,11 +1168,7 @@ int ObSqlPlan::get_plan_table_formatter(ObIArray<ObSqlPlanItem*> &sql_plan_infos
|
||||
}
|
||||
//EST ROWS
|
||||
if (OB_SUCC(ret)) {
|
||||
if (plan_item->cardinality_ >= 0) {
|
||||
snprintf(buffer, sizeof(buffer), "%ld", plan_item->cardinality_);
|
||||
} else {
|
||||
snprintf(buffer, sizeof(buffer), "%s", "more than 1.0e19");
|
||||
}
|
||||
snprintf(buffer, sizeof(buffer), "%ld", plan_item->cardinality_);
|
||||
length = (int32_t) strlen(buffer);
|
||||
if (length > format_helper.column_len_.at(EstRows)) {
|
||||
format_helper.column_len_.at(EstRows) = length;
|
||||
@ -1215,11 +1176,7 @@ int ObSqlPlan::get_plan_table_formatter(ObIArray<ObSqlPlanItem*> &sql_plan_infos
|
||||
}
|
||||
//EST COST
|
||||
if (OB_SUCC(ret)) {
|
||||
if (plan_item->cost_ >= 0) {
|
||||
snprintf(buffer, sizeof(buffer), "%ld", plan_item->cost_);
|
||||
} else {
|
||||
snprintf(buffer, sizeof(buffer), "%s", "more than 1.0e19");
|
||||
}
|
||||
snprintf(buffer, sizeof(buffer), "%ld", plan_item->cost_);
|
||||
length = (int32_t) strlen(buffer);
|
||||
if (length > format_helper.column_len_.at(EstCost)) {
|
||||
format_helper.column_len_.at(EstCost) = length;
|
||||
@ -1273,11 +1230,7 @@ int ObSqlPlan::get_real_plan_table_formatter(ObIArray<ObSqlPlanItem*> &sql_plan_
|
||||
}
|
||||
//EST ROWS
|
||||
if (OB_SUCC(ret)) {
|
||||
if (plan_item->cardinality_ >= 0) {
|
||||
snprintf(buffer, sizeof(buffer), "%ld", plan_item->cardinality_);
|
||||
} else {
|
||||
snprintf(buffer, sizeof(buffer), "%s", "more than 1.0e19");
|
||||
}
|
||||
snprintf(buffer, sizeof(buffer), "%ld", plan_item->cardinality_);
|
||||
length = (int32_t) strlen(buffer);
|
||||
if (length > format_helper.column_len_.at(EstRows)) {
|
||||
format_helper.column_len_.at(EstRows) = length;
|
||||
@ -1285,11 +1238,7 @@ int ObSqlPlan::get_real_plan_table_formatter(ObIArray<ObSqlPlanItem*> &sql_plan_
|
||||
}
|
||||
//EST COST
|
||||
if (OB_SUCC(ret)) {
|
||||
if (plan_item->cost_ >= 0) {
|
||||
snprintf(buffer, sizeof(buffer), "%ld", plan_item->cost_);
|
||||
} else {
|
||||
snprintf(buffer, sizeof(buffer), "%s", "more than 1.0e19");
|
||||
}
|
||||
snprintf(buffer, sizeof(buffer), "%ld", plan_item->cost_);
|
||||
length = (int32_t) strlen(buffer);
|
||||
if (length > format_helper.column_len_.at(EstCost)) {
|
||||
format_helper.column_len_.at(EstCost) = length;
|
||||
@ -1482,13 +1431,13 @@ int ObSqlPlan::get_operator_prefix(ObIArray<ObSqlPlanItem*> &sql_plan_infos,
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("unexpect idx", K(ret));
|
||||
} else if (prefix_helper.with_line_.at(j)) {
|
||||
const char *txt = get_tree_line(0);
|
||||
const char *txt = "│ ";
|
||||
if (plan_item->parent_id_ == parent_item->id_) {
|
||||
if (plan_item->is_last_child_) {
|
||||
txt = get_tree_line(1);
|
||||
txt = "└─";
|
||||
prefix_helper.with_line_.at(j) = false;
|
||||
} else {
|
||||
txt = get_tree_line(2);
|
||||
txt = "├─";
|
||||
}
|
||||
}
|
||||
if (prefix_helper.color_idxs_.at(j) >= 0) {
|
||||
@ -1715,28 +1664,16 @@ int ObSqlPlan::format_plan_table(ObIArray<ObSqlPlanItem*> &sql_plan_infos,
|
||||
//ROWS
|
||||
if (OB_SUCC(ret)) {
|
||||
ret = BUF_PRINTF(COLUMN_SEPARATOR);
|
||||
if (plan_item->cardinality_ >= 0) {
|
||||
ret = BUF_PRINTF("%-*ld",
|
||||
ret = BUF_PRINTF("%-*ld",
|
||||
format_helper.column_len_.at(EstRows),
|
||||
plan_item->cardinality_);
|
||||
} else {
|
||||
ret = BUF_PRINTF("%-*s",
|
||||
format_helper.column_len_.at(EstRows),
|
||||
"more than 1.0e19");
|
||||
}
|
||||
}
|
||||
//COST
|
||||
if (OB_SUCC(ret)) {
|
||||
ret = BUF_PRINTF(COLUMN_SEPARATOR);
|
||||
if (plan_item->cost_ >= 0) {
|
||||
ret = BUF_PRINTF("%-*ld",
|
||||
ret = BUF_PRINTF("%-*ld",
|
||||
format_helper.column_len_.at(EstCost),
|
||||
plan_item->cost_);
|
||||
} else {
|
||||
ret = BUF_PRINTF("%-*s",
|
||||
format_helper.column_len_.at(EstCost),
|
||||
"more than 1.0e19");
|
||||
}
|
||||
ret = BUF_PRINTF(COLUMN_SEPARATOR);
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
@ -1844,28 +1781,16 @@ int ObSqlPlan::format_real_plan_table(ObIArray<ObSqlPlanItem*> &sql_plan_infos,
|
||||
//EST ROWS
|
||||
if (OB_SUCC(ret)) {
|
||||
ret = BUF_PRINTF(COLUMN_SEPARATOR);
|
||||
if (plan_item->cardinality_ >= 0) {
|
||||
ret = BUF_PRINTF("%-*ld",
|
||||
ret = BUF_PRINTF("%-*ld",
|
||||
format_helper.column_len_.at(EstRows),
|
||||
plan_item->cardinality_);
|
||||
} else {
|
||||
ret = BUF_PRINTF("%-*s",
|
||||
format_helper.column_len_.at(EstRows),
|
||||
"more than 1.0e19");
|
||||
}
|
||||
}
|
||||
//EST COST
|
||||
if (OB_SUCC(ret)) {
|
||||
ret = BUF_PRINTF(COLUMN_SEPARATOR);
|
||||
if (plan_item->cost_ >= 0) {
|
||||
ret = BUF_PRINTF("%-*ld",
|
||||
ret = BUF_PRINTF("%-*ld",
|
||||
format_helper.column_len_.at(EstCost),
|
||||
plan_item->cost_);
|
||||
} else {
|
||||
ret = BUF_PRINTF("%-*s",
|
||||
format_helper.column_len_.at(EstCost),
|
||||
"more than 1.0e19");
|
||||
}
|
||||
}
|
||||
//REAL ROWS
|
||||
if (OB_SUCC(ret)) {
|
||||
@ -2407,7 +2332,6 @@ int ObSqlPlan::init_buffer(PlanText &plan_text)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
plan_text.buf_len_ = 1024 * 1024;
|
||||
plan_text.pos_ = 0;
|
||||
plan_text.buf_ = static_cast<char*>(allocator_.alloc(plan_text.buf_len_));
|
||||
if (OB_ISNULL(plan_text.buf_)) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
@ -2535,32 +2459,5 @@ int ObSqlPlan::restore_session(ObSQLSessionInfo *session,
|
||||
return ret;
|
||||
}
|
||||
|
||||
const char* ObSqlPlan::get_tree_line(int type)
|
||||
{
|
||||
static const char *tree_line[] = {
|
||||
"│ ",
|
||||
"└─",
|
||||
"├─",
|
||||
"| ",
|
||||
"+-",
|
||||
"|-"
|
||||
};
|
||||
int ret = OB_SUCCESS;
|
||||
ObCharsetType client_character = ObCharsetType::CHARSET_INVALID;
|
||||
ObCharsetType connection_character = ObCharsetType::CHARSET_INVALID;
|
||||
if (NULL == session_ ||
|
||||
OB_FAIL(session_->get_character_set_client(client_character)) ||
|
||||
OB_FAIL(session_->get_character_set_connection(connection_character))) {
|
||||
return tree_line[type%3];
|
||||
} else if ((ObCharsetType::CHARSET_BINARY == client_character ||
|
||||
ObCharsetType::CHARSET_UTF8MB4 == client_character) &&
|
||||
(ObCharsetType::CHARSET_BINARY == connection_character ||
|
||||
ObCharsetType::CHARSET_UTF8MB4 == connection_character)) {
|
||||
return tree_line[type%3];
|
||||
} else {
|
||||
return tree_line[3+type%3];
|
||||
}
|
||||
}
|
||||
|
||||
} // end of namespace sql
|
||||
} // end of namespace oceanbase
|
||||
|
||||
@ -125,7 +125,6 @@ private:
|
||||
public:
|
||||
ObSqlPlan(common::ObIAllocator &allocator);
|
||||
virtual ~ObSqlPlan();
|
||||
void set_session_info(ObSQLSessionInfo *session) { session_ = session; }
|
||||
int store_sql_plan(ObLogPlan* log_plan, ObPhysicalPlan* phy_plan);
|
||||
|
||||
int store_sql_plan_for_explain(ObExecContext *ctx,
|
||||
@ -145,15 +144,11 @@ public:
|
||||
int format_sql_plan(ObIArray<ObSqlPlanItem*> &sql_plan_infos,
|
||||
ExplainType type,
|
||||
const ObExplainDisplayOpt& option,
|
||||
PlanText &plan_text,
|
||||
const bool alloc_buffer = true);
|
||||
PlanText &plan_text);
|
||||
|
||||
static int get_plan_outline_info_one_line(PlanText &plan_text,
|
||||
ObLogPlan* plan);
|
||||
|
||||
static int get_plan_used_hint_info_one_line(PlanText &plan_text,
|
||||
ObLogPlan* plan);
|
||||
|
||||
static int plan_text_to_string(PlanText &plan_text,
|
||||
common::ObString &plan_str);
|
||||
|
||||
@ -185,8 +180,8 @@ private:
|
||||
ObLogPlan* plan,
|
||||
ObSqlPlanItem* sql_plan_item);
|
||||
|
||||
static int get_plan_tree_used_hint(PlanText &plan_text,
|
||||
ObLogicalOperator* op);
|
||||
int get_plan_tree_used_hint(PlanText &plan_text,
|
||||
ObLogicalOperator* op);
|
||||
|
||||
int get_qb_name_trace(PlanText &plan_text,
|
||||
ObLogPlan* plan,
|
||||
@ -287,8 +282,6 @@ private:
|
||||
transaction::ObTxDesc *tx_desc,
|
||||
int64_t nested_count);
|
||||
|
||||
const char* get_tree_line(int type);
|
||||
|
||||
public:
|
||||
static int format_one_output_expr(char *buf,
|
||||
int64_t buf_len,
|
||||
@ -301,7 +294,6 @@ public:
|
||||
|
||||
private:
|
||||
common::ObIAllocator &allocator_;
|
||||
ObSQLSessionInfo *session_;
|
||||
};
|
||||
|
||||
} // end of namespace sql
|
||||
|
||||
Reference in New Issue
Block a user