提交 6af7f9ae 编写于 作者: O obdev 提交者: wangzelin.wzl

[bugfix] forbid integer improvement ddl and serialize column obj type to column header

上级 c21b5fca
......@@ -3826,6 +3826,11 @@ int ObTableSchema::check_alter_column_type(const ObColumnSchemaV2 &src_column,
|| (src_meta.is_varbinary() && dst_meta.is_blob())
|| (src_meta.is_text() && (dst_meta.is_text() || dst_meta.is_varchar()))
|| (src_meta.is_blob() && (dst_meta.is_blob() || dst_meta.is_varbinary())))) {
if (src_meta.is_integer_type() && dst_meta.is_integer_type()) {
ret = OB_NOT_SUPPORTED;
LOG_WARN("Type increment of integer type is not supported", K(ret), K(src_meta), K(dst_meta));
LOG_USER_ERROR(OB_NOT_SUPPORTED, "Type increment of integer type is");
}
// online, do nothing
} else {
is_offline = true;
......
......@@ -75,7 +75,7 @@ public:
EncoderDesc &get_desc() { return desc_; }
ObColumnHeader &get_column_header() { return column_header_; }
ObObjType get_obj_type() { return column_type_.get_type(); }
// var data store only
virtual int set_data_pos(const int64_t offset, const int64_t length)
{
......
......@@ -521,15 +521,15 @@ int ObMicroBlockEncoder::store_encoding_meta_and_fix_cols(int64_t &encoding_meta
if (OB_FAIL(encoders_.at(i)->store_meta(data_buffer_))) {
LOG_WARN("store encoding meta failed", K(ret));
} else {
ObColumnHeader &ch = encoders_.at(i)->get_column_header();
if (data_buffer_.pos() > pos_bak) {
ObColumnHeader &ch = encoders_.at(i)->get_column_header();
ch.offset_ = static_cast<uint32_t>(pos_bak - encoding_meta_offset);
ch.length_ = static_cast<uint32_t>(data_buffer_.pos() - pos_bak);
} else if (ObColumnHeader::RAW == encoders_.at(i)->get_type()) {
// column header offset records the start pos of the fix data, if needed
ObColumnHeader &ch = encoders_.at(i)->get_column_header();
ch.offset_ = static_cast<uint32_t>(pos_bak - encoding_meta_offset);
}
ch.obj_type_ = static_cast<uint8_t>(encoders_.at(i)->get_obj_type());
}
if (OB_SUCC(ret) && !desc.is_var_data_ && desc.need_data_store_) {
......
......@@ -291,7 +291,7 @@ struct ObColumnHeader
int8_t version_;
int8_t type_;
int8_t attr_;
int8_t reserved_;
uint8_t obj_type_;
union {
uint32_t extend_value_offset_; // for var column null-bitmap stored continuously
uint32_t extend_value_index_;
......@@ -299,9 +299,16 @@ struct ObColumnHeader
uint32_t offset_;
uint32_t length_;
static_assert(UINT8_MAX >= ObObjType::ObMaxType, "ObObjType is stored in ObColumnHeader with 1 byte");
ObColumnHeader() { reuse(); }
void reuse() { memset(this, 0, sizeof(*this)); }
bool is_valid() const { return version_ == OB_COLUMN_HEADER_V1 && type_ >= 0 && type_ < MAX_TYPE; }
bool is_valid() const
{
return version_ == OB_COLUMN_HEADER_V1
&& type_ >= 0
&& type_ < MAX_TYPE
&& obj_type_ < ObObjType::ObMaxType;
}
inline bool is_fix_length() const { return attr_ & FIX_LENGTH; }
inline bool has_extend_value() const { return attr_ & HAS_EXTEND_VALUE; }
......@@ -316,6 +323,7 @@ struct ObColumnHeader
{
return COLUMN_EQUAL == type || COLUMN_SUBSTR == type;
}
inline ObObjType get_store_obj_type() const { return static_cast<ObObjType>(obj_type_); }
inline void set_fix_lenght_attr() { attr_ |= FIX_LENGTH; }
inline void set_has_extend_value_attr() { attr_ |= HAS_EXTEND_VALUE; }
......@@ -323,7 +331,8 @@ struct ObColumnHeader
inline void set_last_var_field_attr() { attr_ |= LAST_VAR_FIELD; }
inline void set_out_row() { attr_ |= OUT_ROW; }
TO_STRING_KV(K_(version), K_(type), K_(attr), K_(extend_value_offset), K_(offset), K_(length));
TO_STRING_KV(K_(version), K_(type), K_(attr), K_(obj_type),
K_(extend_value_offset), K_(offset), K_(length));
} __attribute__((packed));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册