提交 20060e88 编写于 作者: O obdev 提交者: wangzelin.wzl

fix issue 42920788

上级 c29c99ea
......@@ -990,7 +990,9 @@ int ObTTLManager::get_ttl_para_from_schema(const schema::ObTableSchema *table_sc
ret = OB_INVALID_ARGUMENT;
LOG_WARN("schema is null", K(ret));
} else if (!table_schema->get_comment_str().empty()) {
if (OB_FAIL(hc_desc.from_string(table_schema->get_comment_str()))) {
if (!is_ttl_comment(table_schema->get_comment_str())) {
// do nothing
} else if (OB_FAIL(hc_desc.from_string(table_schema->get_comment_str()))) {
LOG_WARN("fail to get ttl para from schema", K(table_schema->get_comment_str()), K(ret));
} else {
para.ttl_ = hc_desc.get_time_to_live();
......@@ -1004,6 +1006,33 @@ int ObTTLManager::get_ttl_para_from_schema(const schema::ObTableSchema *table_sc
return ret;
}
bool ObTTLManager::is_ttl_comment(const ObString &str)
{
bool bret = false;
const int32_t length = str.length();
const char *start = str.ptr();
const char *end = str.ptr() + length;
while (start < end && isspace(*start)) {
start++;
}
if (start < end && *start == '{') {
start++;
while (start < end && isspace(*start)) {
start++;
}
if (start < end) {
const char *hcolumn_str = "\"HColumnDescriptor\"";
const uint32_t hcolumn_str_len = strlen(hcolumn_str);
if (end - start >= hcolumn_str_len) {
bret = (0 == STRNCASECMP(start, hcolumn_str, hcolumn_str_len));
}
}
}
return bret;
}
int ObTTLManager::check_partition_can_gen_ttl(const ObPartitionKey& pkey,
ObTTLPara &para, bool& can_ttl)
{
......
......@@ -196,6 +196,7 @@ private:
int check_and_reset_droped_tenant();
obrpc::ObTTLRequestArg::TTLRequestType transform_state_to_cmd(const int64_t state);
int refresh_partition_task(ObTTLTaskCtx &ttl_task, bool refresh_status, bool refresh_retcode = false);
bool is_ttl_comment(const ObString &str);
private:
static const int64_t DEFAULT_TTL_BUCKET_NUM = 100;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册