[C] obdumper抽数单表报错4013 [3.1_opensource_release < 3_1_x_release]
This commit is contained in:

committed by
wangzelin.wzl

parent
1eaee03522
commit
e349a542f1
@ -170,11 +170,17 @@ int ObQueryDriver::convert_string_value_charset(ObObj& value, ObResultSet& resul
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObCharsetType charset_type = CHARSET_INVALID;
|
||||
const ObSQLSessionInfo& my_session = result.get_session();
|
||||
if (OB_FAIL(my_session.get_character_set_results(charset_type))) {
|
||||
const ObSQLSessionInfo &my_session = result.get_session();
|
||||
ObArenaAllocator *allocator = NULL;
|
||||
if (OB_FAIL(result.get_exec_context().get_convert_charset_allocator(allocator))) {
|
||||
LOG_WARN("fail to get lob fake allocator", K(ret));
|
||||
} else if (OB_ISNULL(allocator)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("lob fake allocator is null.", K(ret), K(value));
|
||||
} else if (OB_FAIL(my_session.get_character_set_results(charset_type))) {
|
||||
LOG_WARN("fail to get result charset", K(ret));
|
||||
} else {
|
||||
OZ(value.convert_string_value_charset(charset_type, result.get_mem_pool()));
|
||||
OZ (value.convert_string_value_charset(charset_type, *allocator));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -249,8 +255,13 @@ int ObQueryDriver::convert_lob_value_charset(common::ObObj& value, sql::ObResult
|
||||
int32_t header_len = value.get_val_len() - lob_locator->payload_size_;
|
||||
int32_t str_len = lob_locator->payload_size_ * 4;
|
||||
uint32_t result_len = 0;
|
||||
ObIAllocator& allocator = result.get_mem_pool();
|
||||
if (OB_UNLIKELY(NULL == (buf = static_cast<char*>(allocator.alloc(header_len + str_len))))) {
|
||||
ObArenaAllocator *allocator = NULL;
|
||||
if (OB_FAIL(result.get_exec_context().get_convert_charset_allocator(allocator))) {
|
||||
LOG_WARN("fail to get lob fake allocator", K(ret));
|
||||
} else if (OB_ISNULL(allocator)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("lob fake allocator is null.", K(ret), K(value));
|
||||
} else if (OB_UNLIKELY(NULL == (buf = static_cast<char*>(allocator->alloc(header_len + str_len))))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_ERROR("alloc memory failed", K(ret), K(header_len), K(str_len));
|
||||
} else {
|
||||
@ -330,7 +341,7 @@ int ObQueryDriver::convert_lob_locator_to_longtext(ObObj& value, ObResultSet& re
|
||||
ObArenaAllocator* allocator = NULL;
|
||||
if (OB_FAIL(value.get_string(str))) {
|
||||
STORAGE_LOG(WARN, "Failed to get string from obj", K(ret), K(value));
|
||||
} else if (OB_FAIL(result.get_exec_context().get_lob_fake_allocator(allocator))) {
|
||||
} else if (OB_FAIL(result.get_exec_context().get_convert_charset_allocator(allocator))) {
|
||||
LOG_WARN("fail to get lob fake allocator", K(ret));
|
||||
} else if (FALSE_IT(allocator->reset())) {
|
||||
} else if (OB_ISNULL(buf = static_cast<char*>(allocator->alloc(str.length() + sizeof(ObLobLocator))))) {
|
||||
|
@ -258,6 +258,13 @@ int ObSyncCmdDriver::response_query_result(ObMySQLResultSet &result)
|
||||
OMPKRow rp(sm_row);
|
||||
if (OB_FAIL(sender_.response_packet(rp))) {
|
||||
LOG_WARN("response packet fail", K(ret), KP(row));
|
||||
} else {
|
||||
ObArenaAllocator *allocator = NULL;
|
||||
if (OB_FAIL(result.get_exec_context().get_convert_charset_allocator(allocator))) {
|
||||
LOG_WARN("fail to get lob fake allocator", K(ret));
|
||||
} else if (OB_NOT_NULL(allocator)) {
|
||||
allocator->reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -220,6 +220,7 @@ int ObSyncPlanDriver::response_query_result(
|
||||
session_.get_trans_desc().consistency_wait();
|
||||
MYSQL_PROTOCOL_TYPE protocol_type = result.is_ps_protocol() ? BINARY : TEXT;
|
||||
const common::ColumnsFieldIArray *fields = NULL;
|
||||
ObArenaAllocator *convert_allocator = NULL; //just for convert charset
|
||||
if (OB_SUCC(ret)) {
|
||||
fields = result.get_field_columns();
|
||||
if (OB_ISNULL(fields)) {
|
||||
@ -237,11 +238,19 @@ int ObSyncPlanDriver::response_query_result(
|
||||
LOG_WARN("fail to response query header", K(ret), K(row_num), K(can_retry));
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(result.get_exec_context().get_convert_charset_allocator(convert_allocator))) {
|
||||
LOG_WARN("fail to get lob fake allocator", K(ret));
|
||||
} else if (OB_ISNULL(convert_allocator)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("allocator is unexpected", K(ret));
|
||||
}
|
||||
}
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < row->get_count(); i++) {
|
||||
ObObj &value = row->get_cell(i);
|
||||
if (result.is_ps_protocol()) {
|
||||
if (value.get_type() != fields->at(i).type_.get_type()) {
|
||||
ObCastCtx cast_ctx(&result.get_mem_pool(), NULL, CM_WARN_ON_FAIL, CS_TYPE_INVALID);
|
||||
ObCastCtx cast_ctx(convert_allocator, NULL, CM_WARN_ON_FAIL, CS_TYPE_INVALID);
|
||||
if (OB_FAIL(common::ObObjCaster::to_type(fields->at(i).type_.get_type(), cast_ctx, value, value))) {
|
||||
LOG_WARN("failed to cast object", K(ret), K(value), K(value.get_type()), K(fields->at(i).type_.get_type()));
|
||||
}
|
||||
@ -270,7 +279,7 @@ int ObSyncPlanDriver::response_query_result(
|
||||
LOG_WARN("response packet fail", K(ret), KP(row), K(row_num), K(can_retry));
|
||||
// break;
|
||||
} else {
|
||||
// LOG_DEBUG("response row succ", K(*row));
|
||||
convert_allocator->reset();
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
++row_num;
|
||||
|
@ -156,7 +156,7 @@ ObExecContext::ObExecContext(ObIAllocator& allocator)
|
||||
temp_ctx_(),
|
||||
gi_pruning_info_(),
|
||||
sched_info_(),
|
||||
lob_fake_allocator_(nullptr),
|
||||
convert_allocator_(nullptr),
|
||||
root_op_(NULL),
|
||||
pwj_map_(nullptr),
|
||||
calc_type_(CALC_NORMAL),
|
||||
@ -217,7 +217,7 @@ ObExecContext::ObExecContext()
|
||||
temp_ctx_(),
|
||||
gi_pruning_info_(),
|
||||
sched_info_(),
|
||||
lob_fake_allocator_(nullptr),
|
||||
convert_allocator_(nullptr),
|
||||
root_op_(NULL),
|
||||
pwj_map_(nullptr),
|
||||
calc_type_(CALC_NORMAL),
|
||||
@ -252,9 +252,9 @@ ObExecContext::~ObExecContext()
|
||||
}
|
||||
clean_resolve_ctx();
|
||||
sqc_handler_ = nullptr;
|
||||
if (OB_LIKELY(NULL != lob_fake_allocator_)) {
|
||||
DESTROY_CONTEXT(lob_fake_allocator_);
|
||||
lob_fake_allocator_ = NULL;
|
||||
if (OB_LIKELY(NULL != convert_allocator_)) {
|
||||
DESTROY_CONTEXT(convert_allocator_);
|
||||
convert_allocator_ = NULL;
|
||||
}
|
||||
iters_.reset();
|
||||
}
|
||||
@ -797,11 +797,11 @@ int ObExecContext::get_gi_task_map(GIPrepareTaskMap*& gi_task_map)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObExecContext::get_lob_fake_allocator(ObArenaAllocator*& allocator)
|
||||
int ObExecContext::get_convert_charset_allocator(ObArenaAllocator *&allocator)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
allocator = NULL;
|
||||
if (OB_ISNULL(lob_fake_allocator_)) {
|
||||
if (OB_ISNULL(convert_allocator_)) {
|
||||
if (OB_ISNULL(my_session_)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("session is null", K(ret));
|
||||
@ -811,13 +811,13 @@ int ObExecContext::get_lob_fake_allocator(ObArenaAllocator*& allocator)
|
||||
.set_mem_attr(my_session_->get_effective_tenant_id(),
|
||||
common::ObModIds::OB_SQL_EXPR_CALC,
|
||||
common::ObCtxIds::DEFAULT_CTX_ID);
|
||||
if (OB_FAIL(CURRENT_CONTEXT->CREATE_CONTEXT(lob_fake_allocator_, param))) {
|
||||
if (OB_FAIL(CURRENT_CONTEXT->CREATE_CONTEXT(convert_allocator_, param))) {
|
||||
SQL_ENG_LOG(WARN, "create entity failed", K(ret));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
allocator = &lob_fake_allocator_->get_arena_allocator();
|
||||
allocator = &convert_allocator_->get_arena_allocator();
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -165,7 +165,7 @@ public:
|
||||
{
|
||||
return expr_op_size_ > 0 && NULL != expr_op_ctx_store_;
|
||||
}
|
||||
int get_lob_fake_allocator(common::ObArenaAllocator*& allocator);
|
||||
int get_convert_charset_allocator(common::ObArenaAllocator *&allocator);
|
||||
|
||||
int init_eval_ctx();
|
||||
void destroy_eval_ctx();
|
||||
@ -798,8 +798,10 @@ protected:
|
||||
// dynamic partition pruning for right TSC of NLJ
|
||||
ObGIPruningInfo gi_pruning_info_;
|
||||
|
||||
ObSchedInfo sched_info_;
|
||||
lib::MemoryContext lob_fake_allocator_;
|
||||
ObSchedInfo sched_info_;
|
||||
|
||||
// just for convert charset in query response result
|
||||
lib::MemoryContext convert_allocator_;
|
||||
|
||||
// serialize operator inputs of %root_op_ subplan if root_op_ is not NULL
|
||||
const ObPhyOperator* root_op_;
|
||||
|
Reference in New Issue
Block a user