fix prepare_alter_table_arg() core bug
This commit is contained in:
@ -417,8 +417,6 @@ int ObDDLTaskHeartBeatMananger::get_inactive_ddl_task_ids(ObArray<int64_t>& remo
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObPrepareAlterTableArgParam::ObPrepareAlterTableArgParam() : session_id_(OB_INVALID_ID) {}
|
|
||||||
|
|
||||||
int ObPrepareAlterTableArgParam::init(const uint64_t session_id,
|
int ObPrepareAlterTableArgParam::init(const uint64_t session_id,
|
||||||
const ObSQLMode &sql_mode,
|
const ObSQLMode &sql_mode,
|
||||||
const ObString &ddl_stmt_str,
|
const ObString &ddl_stmt_str,
|
||||||
@ -458,9 +456,8 @@ int ObPrepareAlterTableArgParam::set_nls_formats(const common::ObString *nls_for
|
|||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
} else {
|
} else {
|
||||||
char *tmp_ptr[ObNLSFormatEnum::NLS_MAX] = {};
|
char *tmp_ptr[ObNLSFormatEnum::NLS_MAX] = {};
|
||||||
common::ObArenaAllocator allocator;
|
|
||||||
for (int64_t i = 0; OB_SUCC(ret) && i < ObNLSFormatEnum::NLS_MAX; ++i) {
|
for (int64_t i = 0; OB_SUCC(ret) && i < ObNLSFormatEnum::NLS_MAX; ++i) {
|
||||||
if (OB_ISNULL(tmp_ptr[i] = (char *)allocator.alloc(nls_formats[i].length()))) {
|
if (OB_ISNULL(tmp_ptr[i] = (char *)allocator_.alloc(nls_formats[i].length()))) {
|
||||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||||
SHARE_LOG(ERROR, "failed to alloc memory!", "size", nls_formats[i].length(), K(ret));
|
SHARE_LOG(ERROR, "failed to alloc memory!", "size", nls_formats[i].length(), K(ret));
|
||||||
} else {
|
} else {
|
||||||
@ -470,7 +467,7 @@ int ObPrepareAlterTableArgParam::set_nls_formats(const common::ObString *nls_for
|
|||||||
}
|
}
|
||||||
if (OB_FAIL(ret)) {
|
if (OB_FAIL(ret)) {
|
||||||
for (int64_t i = 0; i < ObNLSFormatEnum::NLS_MAX; ++i) {
|
for (int64_t i = 0; i < ObNLSFormatEnum::NLS_MAX; ++i) {
|
||||||
allocator.free(tmp_ptr[i]);
|
allocator_.free(tmp_ptr[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -104,7 +104,13 @@ private:
|
|||||||
struct ObPrepareAlterTableArgParam final
|
struct ObPrepareAlterTableArgParam final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ObPrepareAlterTableArgParam();
|
ObPrepareAlterTableArgParam() :
|
||||||
|
session_id_(common::OB_INVALID_ID),
|
||||||
|
sql_mode_(0),
|
||||||
|
tz_info_wrap_(),
|
||||||
|
allocator_(lib::ObLabel("PrepAlterTblArg")),
|
||||||
|
nls_formats_{}
|
||||||
|
{}
|
||||||
~ObPrepareAlterTableArgParam() = default;
|
~ObPrepareAlterTableArgParam() = default;
|
||||||
int init(const uint64_t session_id,
|
int init(const uint64_t session_id,
|
||||||
const ObSQLMode &sql_mode,
|
const ObSQLMode &sql_mode,
|
||||||
@ -140,6 +146,7 @@ public:
|
|||||||
common::ObString target_database_name_;
|
common::ObString target_database_name_;
|
||||||
common::ObTimeZoneInfo tz_info_;
|
common::ObTimeZoneInfo tz_info_;
|
||||||
common::ObTimeZoneInfoWrap tz_info_wrap_;
|
common::ObTimeZoneInfoWrap tz_info_wrap_;
|
||||||
|
common::ObArenaAllocator allocator_;
|
||||||
common::ObString nls_formats_[common::ObNLSFormatEnum::NLS_MAX];
|
common::ObString nls_formats_[common::ObNLSFormatEnum::NLS_MAX];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user