patch 4.0

This commit is contained in:
wangzelin.wzl
2022-10-24 10:34:53 +08:00
parent 4ad6e00ec3
commit 93a1074b0c
10533 changed files with 2588271 additions and 2299373 deletions

View File

@ -16,7 +16,7 @@
#include "sql/plan_cache/ob_plan_set.h"
#include "sql/session/ob_sql_session_info.h"
#include "share/schema/ob_schema_getter_guard.h"
#include "share/ob_i_data_access_service.h"
#include "share/ob_i_tablet_scan.h"
#include "sql/engine/ob_exec_context.h"
#include "sql/executor/ob_task_executor.h"
#include "sql/ob_phy_table_location.h"
@ -24,37 +24,68 @@
#include "sql/optimizer/ob_log_plan.h"
using namespace oceanbase::share;
using namespace oceanbase::share::schema;
using namespace oceanbase::omt;
namespace oceanbase {
namespace sql {
const char* plan_cache_gc_confs[3] = {"OFF", "REPORT", "AUTO"};
int ObGetAllPlanIdOp::set_key_array(common::ObIArray<uint64_t>* key_array)
namespace oceanbase
{
int ret = common::OB_SUCCESS;
if (NULL == key_array) {
ret = common::OB_INVALID_ARGUMENT;
SQL_PC_LOG(WARN, "invalid argument", K(ret));
} else {
key_array_ = key_array;
}
return ret;
namespace sql
{
const char *plan_cache_gc_confs[3] = { "OFF", "REPORT", "AUTO" };
int ObGetAllPlanIdOp::set_key_array(common::ObIArray<uint64_t> *key_array)
{
int ret = common::OB_SUCCESS;
if (NULL == key_array) {
ret = common::OB_INVALID_ARGUMENT;
SQL_PC_LOG(WARN, "invalid argument", K(ret));
} else {
key_array_ = key_array;
}
return ret;
}
int ObGetAllPlanIdOp::operator()(common::hash::HashMapPair<ObCacheObjID, ObCacheObject*>& entry)
int ObGetAllPlanIdOp::operator()(common::hash::HashMapPair<ObCacheObjID, ObILibCacheObject *> &entry)
{
int ret = common::OB_SUCCESS;
if (NULL == key_array_) {
ret = common::OB_NOT_INIT;
SQL_PC_LOG(WARN, "invalid argument", K(ret));
} else if (OB_FAIL(key_array_->push_back(entry.first))) {
} else if (ObLibCacheNameSpace::NS_CRSR == entry.second->get_ns() &&
OB_FAIL(key_array_->push_back(entry.first))) {
SQL_PC_LOG(WARN, "fail to push back plan_id", K(ret));
}
return ret;
}
int ObPlanCacheCtx::is_retry(bool& v) const
int ObGetAllCacheIdOp::set_key_array(common::ObIArray<uint64_t> *key_array)
{
int ret = common::OB_SUCCESS;
if (NULL == key_array) {
ret = common::OB_INVALID_ARGUMENT;
SQL_PC_LOG(WARN, "invalid argument", K(ret));
} else {
key_array_ = key_array;
}
return ret;
}
int ObGetAllCacheIdOp::operator()(common::hash::HashMapPair<ObCacheObjID, ObILibCacheObject *> &entry)
{
int ret = common::OB_SUCCESS;
if (NULL == key_array_ || OB_ISNULL(entry.second)) {
ret = common::OB_NOT_INIT;
SQL_PC_LOG(WARN, "invalid argument", K(ret));
} else if (entry.second->get_ns() >= ObLibCacheNameSpace::NS_CRSR
&& entry.second->get_ns() <= ObLibCacheNameSpace::NS_PKG) {
if (OB_FAIL(key_array_->push_back(entry.first))) {
SQL_PC_LOG(WARN, "fail to push back plan_id", K(ret));
}
}
return ret;
}
int ObPlanCacheCtx::is_retry(bool &v) const
{
int ret = OB_SUCCESS;
v = 0;
@ -68,7 +99,7 @@ int ObPlanCacheCtx::is_retry(bool& v) const
return ret;
}
int ObPlanCacheCtx::is_retry_for_dup_tbl(bool& v) const
int ObPlanCacheCtx::is_retry_for_dup_tbl(bool &v) const
{
int ret = OB_SUCCESS;
v = 0;
@ -82,39 +113,33 @@ int ObPlanCacheCtx::is_retry_for_dup_tbl(bool& v) const
return ret;
}
int ObPhyLocationGetter::get_phy_locations(const common::ObIArray<ObTablePartitionInfo*>& partition_infos,
ObIArray<ObPhyTableLocation>& phy_locations, ObIArray<ObPhyTableLocationInfo>& phy_location_infos)
int ObPhyLocationGetter::get_phy_locations(const common::ObIArray<ObTablePartitionInfo *> &partition_infos,
ObIArray<ObCandiTableLoc> &candi_table_locs)
{
int ret = OB_SUCCESS;
ObPhyTableLocation phy_location;
//ObDASTableLoc table_loc;
int64_t N = partition_infos.count();
if (OB_FAIL(candi_table_locs.reserve(N))) {
LOG_WARN("fail reserve memory", K(ret), K(N));
}
for (int64_t i = 0; OB_SUCC(ret) && i < N; i++) {
phy_location.reset();
if (OB_ISNULL(partition_infos.at(i))) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("invalid partition info", K(ret));
} else if (OB_FAIL(
phy_location.assign_from_phy_table_loc_info(partition_infos.at(i)->get_phy_tbl_location_info()))) {
LOG_WARN("failed to assign_from_phy_table_loc_info", K(ret), K(i));
} else if (OB_FAIL(phy_locations.push_back(phy_location))) {
LOG_WARN("failed to push_back phy_location", K(ret), K(phy_location));
} else if (OB_FAIL(phy_location_infos.push_back(partition_infos.at(i)->get_phy_tbl_location_info()))) {
LOG_WARN("failed to push_back phy_location_info", K(ret), K(partition_infos.at(i)->get_phy_tbl_location_info()));
} else { /* do nothing */
}
} else if (OB_FAIL(candi_table_locs.push_back(
partition_infos.at(i)->get_phy_tbl_location_info()))) {
LOG_WARN("failed to push_back phy_location_info", K(ret),
K(partition_infos.at(i)->get_phy_tbl_location_info()));
} else { /* do nothing */ }
}
return ret;
}
// In the case of a copy table, after selecting the copy,
// adjust the copy selection of the copy table to make it consistent with
// the location of the non-replicated table (provided that the non-replicated tables are on the same server)
// The advantage is that the plan type can be made from DIST --> REMOTE;
// can not be calculated in ObSqlPlanSet::calc_phy_plan_type_by_proj
// The reason is that get_phy_locations will assign the physical location to task_exec_ctx;
//(implementation refers to is_partition_in_same_server_by_proj)
int ObPhyLocationGetter::reselect_duplicate_table_best_replica(
const ObIArray<ObPhyTableLocationInfo>& phy_locations, bool& on_same_server)
//包含复制表的情况下, 选择完副本后调整复制表的副本选择使和非复制表的location一致(前提是非复制表都在同一server)
//好处是可以使得计划类型从 DIST --> REMOTE; 不能在ObSqlPlanSet::calc_phy_plan_type_by_proj计算
//的原因是get_phy_locations就会将物理位置赋值给task_exec_ctx; (实现参考了is_partition_in_same_server_by_proj)
int ObPhyLocationGetter::reselect_duplicate_table_best_replica(const ObIArray<ObCandiTableLoc> &phy_locations,
bool &on_same_server)
{
int ret = OB_SUCCESS;
bool has_duplicate_tbl = false;
@ -124,13 +149,13 @@ int ObPhyLocationGetter::reselect_duplicate_table_best_replica(
ObSEArray<ObAddr, 4> candi_addrs;
ObSEArray<int64_t, 8> new_replic_idxs;
int64_t proj_cnt = phy_locations.count();
ObReplicaLocation replica_location;
ObLSReplicaLocation replica_location;
for (int64_t i = 0; OB_SUCC(ret) && is_same && i < proj_cnt; ++i) {
const ObPhyTableLocationInfo& ptli = phy_locations.at(i);
const ObCandiTableLoc &ptli = phy_locations.at(i);
if (ptli.get_partition_cnt() > 1) {
is_same = false;
} else if (ptli.get_partition_cnt() > 0) {
const ObPhyPartitionLocationInfo& part_info = ptli.get_phy_part_loc_info_list().at(0);
const ObCandiTabletLoc &part_info = ptli.get_phy_part_loc_info_list().at(0);
if (OB_FAIL(part_info.get_selected_replica(replica_location))) {
SQL_PC_LOG(WARN, "fail to get selected replica", K(ret), K(ptli));
} else if (!replica_location.is_valid()) {
@ -138,26 +163,26 @@ int ObPhyLocationGetter::reselect_duplicate_table_best_replica(
} else if (!ptli.is_duplicate_table_not_in_dml()) {
// handle normal table
if (!normal_table_addr.is_valid()) {
normal_table_addr = replica_location.server_;
normal_table_addr = replica_location.get_server();
SQL_PC_LOG(DEBUG, "part_location first replica", K(ret), K(replica_location));
} else if (normal_table_addr != replica_location.server_) {
} else if (normal_table_addr != replica_location.get_server()) {
is_same = false;
SQL_PC_LOG(DEBUG, "part_location replica", K(ret), K(i), K(replica_location));
}
} else {
// handle duplicate table
if (!has_duplicate_tbl) {
const ObIArray<ObRoutePolicy::CandidateReplica>& replicas =
const ObIArray<ObRoutePolicy::CandidateReplica> &replicas =
part_info.get_partition_location().get_replica_locations();
for (int64_t j = 0; OB_SUCC(ret) && j < replicas.count(); ++j) {
if (OB_FAIL(candi_addrs.push_back(replicas.at(j).server_))) {
if (OB_FAIL(candi_addrs.push_back(replicas.at(j).get_server()))) {
LOG_WARN("failed to push back servers", K(ret));
}
}
duplicate_table_addr = replica_location.server_;
duplicate_table_addr = replica_location.get_server();
has_duplicate_tbl = true;
SQL_PC_LOG(DEBUG, "has duplicate table");
} else if (duplicate_table_addr != replica_location.server_) {
} else if (duplicate_table_addr != replica_location.get_server()) {
duplicate_table_addr.reset();
}
}
@ -187,6 +212,7 @@ int ObPhyLocationGetter::reselect_duplicate_table_best_replica(
}
}
}
//如果无复制表或者非复制表就已经无法保证在同一server, 是分布式计划, 就没要必要在这里更改复制表的副本idx了
if (OB_SUCC(ret) && !candi_addrs.empty()) {
is_same = false;
if (OB_FAIL(new_replic_idxs.prepare_allocate(proj_cnt))) {
@ -194,19 +220,22 @@ int ObPhyLocationGetter::reselect_duplicate_table_best_replica(
}
for (int64_t i = 0; OB_SUCC(ret) && !is_same && i < candi_addrs.count(); ++i) {
bool is_valid = true;
const ObAddr& addr = candi_addrs.at(i);
const ObAddr &addr = candi_addrs.at(i);
//a, 是否在同一server上有副本
for (int64_t j = 0; OB_SUCC(ret) && is_valid && j < proj_cnt; ++j) {
const ObPhyTableLocationInfo& ptli = phy_locations.at(j);
const ObCandiTableLoc &ptli = phy_locations.at(j);
if (ptli.is_duplicate_table_not_in_dml()) {
is_valid = ptli.get_phy_part_loc_info_list().at(0).is_server_in_replica(addr, new_replic_idxs.at(j));
is_valid = ptli.get_phy_part_loc_info_list().at(0).is_server_in_replica(
addr, new_replic_idxs.at(j));
}
}
//b, 所有复制表都有在 addr 上的副本, 一起更改之
for (int64_t j = 0; OB_SUCC(ret) && is_valid && j < proj_cnt; ++j) {
ObPhyTableLocationInfo& ptli = const_cast<ObPhyTableLocationInfo&>(phy_locations.at(j));
ObCandiTableLoc &ptli = const_cast<ObCandiTableLoc&>(phy_locations.at(j));
if (!ptli.is_duplicate_table_not_in_dml()) {
// do nothing
} else if (OB_FAIL(ptli.get_phy_part_loc_info_list_for_update().at(0).set_selected_replica_idx(
new_replic_idxs.at(j)))) {
} else if (OB_FAIL(ptli.get_phy_part_loc_info_list_for_update().at(0).
set_selected_replica_idx(new_replic_idxs.at(j)))) {
SQL_PC_LOG(WARN, "failed to set selected replica idx", K(ret));
}
}
@ -221,157 +250,193 @@ int ObPhyLocationGetter::reselect_duplicate_table_best_replica(
return ret;
}
int ObPhyLocationGetter::get_phy_locations(const ObIArray<ObTableLocation>& table_locations,
const ObPlanCacheCtx& pc_ctx, share::ObIPartitionLocationCache& location_cache,
ObIArray<ObPhyTableLocationInfo>& phy_location_infos, bool& need_check_on_same_server)
//need_check_on_same_server: out, 是否需要检查分区在同一sesrver, 如果这里检查过了就置为false
int ObPhyLocationGetter::get_phy_locations(const ObIArray<ObTableLocation> &table_locations,
const ObPlanCacheCtx &pc_ctx,
ObIArray<ObCandiTableLoc> &candi_table_locs,
bool &need_check_on_same_server)
{
int ret = OB_SUCCESS;
bool has_duplicate_tbl_not_in_dml = false;
ObExecContext& exec_ctx = pc_ctx.exec_ctx_;
ObSchemaGetterGuard* schema_guard = pc_ctx.sql_ctx_.schema_guard_;
ObExecContext &exec_ctx = pc_ctx.exec_ctx_;
const ObDataTypeCastParams dtc_params = ObBasicSessionInfo::create_dtc_params(pc_ctx.sql_ctx_.session_info_);
ObSQLSessionInfo* session = exec_ctx.get_my_session();
ObTaskExecutorCtx* task_exec_ctx = exec_ctx.get_task_executor_ctx();
ObPhysicalPlanCtx* plan_ctx = exec_ctx.get_physical_plan_ctx();
ObPhysicalPlanCtx *plan_ctx = exec_ctx.get_physical_plan_ctx();
int64_t N = table_locations.count();
bool is_retrying = false;
bool on_same_server = true;
need_check_on_same_server = true;
if (OB_ISNULL(session) || OB_ISNULL(task_exec_ctx) || OB_ISNULL(plan_ctx)) {
if (OB_ISNULL(plan_ctx)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("invalid executor ctx!", K(ret), K(session), K(task_exec_ctx), K(plan_ctx));
LOG_WARN("invalid executor ctx!", K(ret), K(plan_ctx));
} else {
ObSEArray<const ObTableLocation*, 2> table_location_ptrs;
ObSEArray<ObPhyTableLocationInfo*, 2> phy_location_info_ptrs;
const ParamStore& params = plan_ctx->get_param_store();
ObPhyTableLocationIArray& phy_locations = task_exec_ctx->get_table_locations();
phy_locations.reset();
if (OB_FAIL(phy_locations.prepare_allocate(N))) {
LOG_WARN("phy_locations prepare allocate error", K(ret), K(N));
} else if (OB_FAIL(phy_location_infos.prepare_allocate(N))) {
ObSEArray<const ObTableLocation *, 2> table_location_ptrs;
ObSEArray<ObCandiTableLoc *, 2> phy_location_info_ptrs;
const ParamStore &params = plan_ctx->get_param_store();
if (OB_FAIL(candi_table_locs.prepare_allocate(N))) {
LOG_WARN("phy_locations_info prepare allocate error", K(ret), K(N));
} else {
for (int64_t i = 0; OB_SUCC(ret) && i < N; i++) {
const ObTableLocation& table_location = table_locations.at(i);
ObPhyTableLocationInfo& phy_location_info = phy_location_infos.at(i);
const ObTableLocation &table_location = table_locations.at(i);
ObCandiTableLoc &candi_table_loc = candi_table_locs.at(i);
NG_TRACE(calc_partition_location_begin);
// It is believed that the copy table of materialized view is a copy of each server,
// Therefore, it is not judged whether the materialized view can be generated,
// it must be generated
if (OB_FAIL(table_location.calculate_partition_location_infos(exec_ctx,
schema_guard,
params,
location_cache,
phy_location_info.get_phy_part_loc_info_list_for_update(),
dtc_params,
true /* non-block */))) {
// 这里认为materialized view的复制表是每个server都有副本的,
// 因此这里不判断是否能生成materialized view了,一定都能生成
if (OB_FAIL(table_location.calculate_candi_tablet_locations(exec_ctx,
params,
candi_table_loc.get_phy_part_loc_info_list_for_update(),
dtc_params,
true /* non-block */))) {
LOG_WARN("failed to calculate partition location", K(ret));
} else {
NG_TRACE(calc_partition_location_end);
if (table_location.is_duplicate_table_not_in_dml()) {
has_duplicate_tbl_not_in_dml = true;
}
phy_location_info.set_duplicate_type(table_location.get_duplicate_type());
phy_location_info.set_table_location_key(table_location.get_table_id(), table_location.get_ref_table_id());
LOG_DEBUG("plan cache utitl", K(phy_location_info));
candi_table_loc.set_duplicate_type(table_location.get_duplicate_type());
candi_table_loc.set_table_location_key(
table_location.get_table_id(), table_location.get_ref_table_id());
LOG_DEBUG("plan cache utitl", K(candi_table_loc));
}
if (OB_SUCC(ret)) {
if (OB_FAIL(table_location_ptrs.push_back(&table_location))) {
LOG_WARN("failed to push back table location ptrs", K(ret), K(i), K(N), K(table_locations.at(i)));
} else if (OB_FAIL(phy_location_info_ptrs.push_back(&phy_location_info))) {
LOG_WARN("failed to push back phy location info ptrs", K(ret), K(i), K(N), K(phy_location_infos.at(i)));
LOG_WARN("failed to push back table location ptrs", K(ret), K(i),
K(N), K(table_locations.at(i)));
} else if (OB_FAIL(phy_location_info_ptrs.push_back(&candi_table_loc))) {
LOG_WARN("failed to push back phy location info ptrs", K(ret), K(i),
K(N), K(candi_table_locs.at(i)));
} else if (OB_FAIL(pc_ctx.is_retry_for_dup_tbl(is_retrying))) {
LOG_WARN("failed to test if retrying", K(ret));
} else if (is_retrying) {
LOG_INFO("Physical Location from Location Cache", K(phy_location_info));
LOG_INFO("Physical Location from Location Cache", K(candi_table_loc));
}
}
} // for end
} // for end
}
if (OB_SUCC(ret)) {
if (OB_FAIL(ObLogPlan::select_replicas(
exec_ctx, table_location_ptrs, exec_ctx.get_addr(), phy_location_info_ptrs))) {
LOG_WARN("failed to select replicas",
K(ret),
K(table_locations),
K(exec_ctx.get_addr()),
K(phy_location_info_ptrs));
} else if (!has_duplicate_tbl_not_in_dml || is_retrying) {
// do nothing
} else if (OB_FAIL(reselect_duplicate_table_best_replica(phy_location_infos, on_same_server))) {
LOG_WARN("failed to reselect replicas", K(ret));
} else if (!on_same_server) {
need_check_on_same_server = false;
}
LOG_DEBUG(
"after select_replicas", K(on_same_server), K(has_duplicate_tbl_not_in_dml), K(phy_location_infos), K(ret));
}
for (int64_t i = 0; OB_SUCC(ret) && i < N; i++) {
const ObTableLocation& table_location = table_locations.at(i);
ObPhyTableLocation& phy_location = phy_locations.at(i);
ObPhyTableLocationInfo& phy_location_info = phy_location_infos.at(i);
if (OB_FAIL(phy_location_info.set_direction(table_location.get_direction()))) {
LOG_WARN("failed to set phy location info direction", K(ret), K(table_location));
} else if (OB_FAIL(phy_location.assign_from_phy_table_loc_info(phy_location_info))) {
LOG_WARN("failed to assign from phy table loc info", K(ret), K(phy_location_info));
}
//Only check the on_same_server when has table location in the phy_plan.
if (OB_SUCC(ret) && N!=0 ) {
if (OB_FAIL(ObLogPlan::select_replicas(exec_ctx, table_location_ptrs,
exec_ctx.get_addr(),
phy_location_info_ptrs))) {
LOG_WARN("failed to select replicas", K(ret), K(table_locations),
K(exec_ctx.get_addr()), K(phy_location_info_ptrs));
} else if (!has_duplicate_tbl_not_in_dml || is_retrying) {
// do nothing
} else if (OB_FAIL(reselect_duplicate_table_best_replica(candi_table_locs,
on_same_server))) {
LOG_WARN("failed to reselect replicas", K(ret));
} else if (!on_same_server) {
need_check_on_same_server = false;
}
LOG_TRACE("after select_replicas", K(on_same_server), K(has_duplicate_tbl_not_in_dml),
K(candi_table_locs), K(table_locations), K(ret));
}
}
return ret;
}
int ObPlanBaselineHeler::init_baseline_params_info_str(
const Ob2DArray<ObParamInfo, OB_MALLOC_BIG_BLOCK_SIZE, ObWrapperAllocator, false>& params_info,
ObIAllocator& allocer, ObString& param_info_str)
int ObPhyLocationGetter::build_table_locs(ObDASCtx &das_ctx,
const ObIArray<ObTableLocation> &table_locations,
const ObIArray<ObCandiTableLoc> &candi_table_locs)
{
int ret = OB_SUCCESS;
int64_t N = params_info.count();
int64_t buf_len = N * ObParamInfo::MAX_STR_DES_LEN + 1;
int64_t pos = 0;
char* buf = (char*)allocer.alloc(buf_len);
if (OB_ISNULL(buf)) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("failed to alloc memory for param info", K(ret));
} else {
for (int64_t i = 0; OB_SUCC(ret) && i < N; i++) {
if (N - 1 != i) {
if (OB_FAIL(databuff_printf(buf,
buf_len,
pos,
"{%d,%d,%d,%d,%d},",
params_info.at(i).flag_.need_to_check_type_,
params_info.at(i).flag_.need_to_check_bool_value_,
params_info.at(i).flag_.expected_bool_value_,
params_info.at(i).scale_,
params_info.at(i).type_))) {
SQL_PC_LOG(WARN, "fail to buff_print param info", K(ret));
}
} else {
if (OB_FAIL(databuff_printf(buf,
buf_len,
pos,
"{%d,%d,%d,%d,%d}",
params_info.at(i).flag_.need_to_check_type_,
params_info.at(i).flag_.need_to_check_bool_value_,
params_info.at(i).flag_.expected_bool_value_,
params_info.at(i).scale_,
params_info.at(i).type_))) {
SQL_PC_LOG(WARN, "fail to buff_print param info", K(ret));
}
}
} // for end
CK(table_locations.count() == candi_table_locs.count());
for (int64_t i = 0; OB_SUCC(ret) && i < table_locations.count(); i++) {
if (OB_FAIL(das_ctx.add_candi_table_loc(table_locations.at(i).get_loc_meta(), candi_table_locs.at(i)))) {
LOG_WARN("add candi table location failed", K(ret), K(table_locations.at(i).get_loc_meta()));
}
}
if (OB_SUCC(ret)) {
param_info_str.assign_ptr(buf, pos);
if (OB_FAIL(ret)) {
das_ctx.clear_all_location_info();
}
return ret;
}
//this function will rewrite the related tablet map info in DASCtx
int ObPhyLocationGetter::build_related_tablet_info(const ObTableLocation &table_location,
ObExecContext &exec_ctx,
DASRelatedTabletMap *&related_map)
{
int ret = OB_SUCCESS;
ObDataTypeCastParams dtc_params = ObBasicSessionInfo::create_dtc_params(exec_ctx.get_my_session());
ObPhysicalPlanCtx *plan_ctx = exec_ctx.get_physical_plan_ctx();
ObArray<ObObjectID> partition_ids;
ObArray<ObTabletID> tablet_ids;
if (OB_FAIL(table_location.calculate_tablet_ids(exec_ctx,
plan_ctx->get_param_store(),
tablet_ids,
partition_ids,
dtc_params))) {
LOG_WARN("calculate tablet ids failed", K(ret));
} else {
related_map = &exec_ctx.get_das_ctx().get_related_tablet_map();
LOG_DEBUG("build_related tablet info", K(tablet_ids), K(partition_ids),
K(table_location.get_loc_meta()), KPC(related_map));
}
return ret;
}
OB_SERIALIZE_MEMBER(ObTableRowCount, op_id_, row_count_);
} // namespace sql
} // namespace oceanbase
int ObConfigInfoInPC::load_influence_plan_config()
{
int ret = OB_SUCCESS;
// Note: if you need to add a tenant config please
// uncomment next line to retrive tenant config.
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(tenant_id_));
// For Cluster configs
// here to add value of configs that can influence execution plan.
enable_px_ordered_coord_ = GCONF._enable_px_ordered_coord;
enable_newsort_ = GCONF._enable_newsort;
// For Tenant configs
// tenant config use tenant_config to get configs
if (tenant_config.is_valid()) {
pushdown_storage_level_ = tenant_config->_pushdown_storage_level;
rowsets_enabled_ = tenant_config->_rowsets_enabled;
enable_px_batch_rescan_ = tenant_config->_enable_px_batch_rescan;
bloom_filter_enabled_ = tenant_config->_bloom_filter_enabled;
}
return ret;
}
// reading values and generate strings
int ObConfigInfoInPC::serialize_configs(char *buf, int buf_len, int64_t &pos)
{
int ret = OB_SUCCESS;
pos = 0;
// gen config str
if (OB_FAIL(databuff_printf(buf, buf_len, pos,
"%d,", pushdown_storage_level_))) {
SQL_PC_LOG(WARN, "failed to databuff_printf", K(ret), K(pushdown_storage_level_));
} else if (OB_FAIL(databuff_printf(buf, buf_len, pos,
"%d,", rowsets_enabled_))) {
SQL_PC_LOG(WARN, "failed to databuff_printf", K(ret), K(rowsets_enabled_));
} else if (OB_FAIL(databuff_printf(buf, buf_len, pos,
"%d,", enable_px_batch_rescan_))) {
SQL_PC_LOG(WARN, "failed to databuff_printf", K(ret), K(enable_px_batch_rescan_));
} else if (OB_FAIL(databuff_printf(buf, buf_len, pos,
"%d,", enable_px_ordered_coord_))) {
SQL_PC_LOG(WARN, "failed to databuff_printf", K(ret), K(enable_px_ordered_coord_));
} else if (OB_FAIL(databuff_printf(buf, buf_len, pos,
"%d,", bloom_filter_enabled_))) {
SQL_PC_LOG(WARN, "failed to databuff_printf", K(ret), K(bloom_filter_enabled_));
} else if (OB_FAIL(databuff_printf(buf, buf_len, pos,
"%d,", enable_newsort_))) {
SQL_PC_LOG(WARN, "failed to databuff_printf", K(ret), K(enable_newsort_));
} else {
// do nothing
}
// trim last comma
pos--;
return ret;
}
}
}