[CP] to issue<55739667>:fix truncate table cause pl cache mismatch after alter table add/drop column
This commit is contained in:
@ -76,17 +76,30 @@ int PCVPlSchemaObj::deep_copy_column_infos(const ObTableSchema *schema)
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("unexpected null argument", K(ret), K(schema), K(inner_alloc_));
|
||||
} else {
|
||||
void *obj_buf = nullptr;
|
||||
ObPLTableColumnInfo *column_info = nullptr;
|
||||
column_cnt_ = schema->get_column_count();
|
||||
ObTableSchema::const_column_iterator cs_iter = schema->column_begin();
|
||||
ObTableSchema::const_column_iterator cs_iter_end = schema->column_end();
|
||||
int64_t real_column_cnt = 0;
|
||||
for (; OB_SUCC(ret) && cs_iter != cs_iter_end; cs_iter++) {
|
||||
const ObColumnSchemaV2 &column_schema = **cs_iter;
|
||||
if (!column_schema.is_hidden()) {
|
||||
real_column_cnt++;
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
column_cnt_ = real_column_cnt;
|
||||
column_infos_.set_allocator(inner_alloc_);
|
||||
if (OB_FAIL(column_infos_.init(column_cnt_))) {
|
||||
LOG_WARN("failed to init column_infos", K(ret));
|
||||
} else {
|
||||
ObTableSchema::const_column_iterator cs_iter = schema->column_begin();
|
||||
ObTableSchema::const_column_iterator cs_iter_end = schema->column_end();
|
||||
void *obj_buf = nullptr;
|
||||
ObPLTableColumnInfo *column_info = nullptr;
|
||||
cs_iter = schema->column_begin();
|
||||
cs_iter_end = schema->column_end();
|
||||
for (; OB_SUCC(ret) && cs_iter != cs_iter_end; cs_iter++) {
|
||||
const ObColumnSchemaV2 &column_schema = **cs_iter;
|
||||
if (column_schema.is_hidden()) {
|
||||
// do nothing
|
||||
} else {
|
||||
if (nullptr == (obj_buf = inner_alloc_->alloc(sizeof(ObPLTableColumnInfo)))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("failed to allocate memory", K(ret));
|
||||
@ -115,9 +128,11 @@ int PCVPlSchemaObj::deep_copy_column_infos(const ObTableSchema *schema)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
CK (column_cnt_ == column_infos_.count());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -400,6 +415,9 @@ int ObPLObjectValue::obtain_new_column_infos(share::schema::ObSchemaGetterGuard
|
||||
ObTableSchema::const_column_iterator cs_iter_end = table_schema->column_end();
|
||||
for (; OB_SUCC(ret) && cs_iter != cs_iter_end; cs_iter++) {
|
||||
const ObColumnSchemaV2 &column_schema = **cs_iter;
|
||||
if (column_schema.is_hidden()) {
|
||||
// do nothing
|
||||
} else {
|
||||
column_info.column_id_ = column_schema.get_column_id();
|
||||
column_info.meta_type_ = column_schema.get_meta_type();
|
||||
column_info.charset_type_ = column_schema.get_charset_type();
|
||||
@ -409,6 +427,7 @@ int ObPLObjectValue::obtain_new_column_infos(share::schema::ObSchemaGetterGuard
|
||||
OZ (column_infos.push_back(column_info));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user