fix issue 42920788
This commit is contained in:
parent
c29c99ea9e
commit
20060e8887
@ -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 ¶, 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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user