[FTS][BUG.FIX] fix print log coredump

This commit is contained in:
Tyshawn
2024-04-23 04:01:41 +00:00
committed by ob-robot
parent ec55cd9b24
commit 4862a8e3c1

View File

@ -744,12 +744,12 @@ int ObFtsIndexBuilderUtil::adjust_fts_arg(
} }
// 2. add doc id column to arg->store_columns // 2. add doc id column to arg->store_columns
const ObColumnSchemaV2 *doc_id_col = fts_cols.at(0); const ObColumnSchemaV2 *doc_id_col = fts_cols.at(0);
if (OB_FAIL(ret)) { ObString doc_id_col_name;
} else if (OB_FAIL(index_arg->store_columns_.push_back( if (FAILEDx(ob_write_string(*allocator, doc_id_col->get_column_name_str(), doc_id_col_name))) {
doc_id_col->get_column_name_str()))) { LOG_WARN("fail to deep copy doc id column name", K(ret));
} else if (OB_FAIL(index_arg->store_columns_.push_back( doc_id_col_name))) {
LOG_WARN("failed to push back doc id column", K(ret)); LOG_WARN("failed to push back doc id column", K(ret));
} }
} else if (is_doc_rowkey) { } else if (is_doc_rowkey) {
// add doc id column to arg->index_columns // add doc id column to arg->index_columns
ObColumnSortItem doc_id_column; ObColumnSortItem doc_id_column;
@ -796,7 +796,6 @@ int ObFtsIndexBuilderUtil::inner_adjust_fts_arg(
ObIAllocator *allocator) ObIAllocator *allocator)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
// 1. add doc id column, word column to arg->index_columns
if (OB_ISNULL(fts_arg) || if (OB_ISNULL(fts_arg) ||
(!share::schema::is_fts_index_aux(fts_arg->index_type_) && (!share::schema::is_fts_index_aux(fts_arg->index_type_) &&
!share::schema::is_fts_doc_word_aux(fts_arg->index_type_)) || !share::schema::is_fts_doc_word_aux(fts_arg->index_type_)) ||
@ -805,31 +804,39 @@ int ObFtsIndexBuilderUtil::inner_adjust_fts_arg(
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("invalid argument", K(ret), KPC(fts_arg), KP(allocator), LOG_WARN("invalid argument", K(ret), KPC(fts_arg), KP(allocator),
K(fts_cols.count()), K(index_column_cnt)); K(fts_cols.count()), K(index_column_cnt));
} } else {
for (int64_t i = 0; OB_SUCC(ret) && i < index_column_cnt; ++i) { // 1. add doc id column, word column to arg->index_columns
ObColumnSortItem fts_column; for (int64_t i = 0; OB_SUCC(ret) && i < index_column_cnt; ++i) {
const ObColumnSchemaV2 *fts_col = fts_cols.at(i); ObColumnSortItem fts_column;
if (OB_ISNULL(fts_col)) { const ObColumnSchemaV2 *fts_col = fts_cols.at(i);
ret = OB_ERR_UNEXPECTED; if (OB_ISNULL(fts_col)) {
LOG_WARN("fts_col is null", K(ret), K(i)); ret = OB_ERR_UNEXPECTED;
} else if (OB_FAIL(ob_write_string(*allocator, LOG_WARN("fts_col is null", K(ret), K(i));
fts_col->get_column_name_str(), } else if (OB_FAIL(ob_write_string(*allocator,
fts_column.column_name_))) { fts_col->get_column_name_str(),
//to keep the memory lifetime of column_name consistent with index_arg fts_column.column_name_))) {
LOG_WARN("deep copy column name failed", K(ret)); //to keep the memory lifetime of column_name consistent with index_arg
} else if (OB_FAIL(fts_arg->index_columns_.push_back(fts_column))) { LOG_WARN("deep copy column name failed", K(ret));
LOG_WARN("failed to push back index column", K(ret)); } else if (OB_FAIL(fts_arg->index_columns_.push_back(fts_column))) {
LOG_WARN("failed to push back index column", K(ret));
}
}
// 2. add word count column to arg->store_columns
const ObColumnSchemaV2 *word_count_col = fts_cols.at(index_column_cnt);
ObString word_count_col_name;
if (FAILEDx(ob_write_string(*allocator, word_count_col->get_column_name_str(), word_count_col_name))) {
LOG_WARN("fail to deep copy word count column name", K(ret));
} else if (OB_FAIL(fts_arg->store_columns_.push_back(word_count_col_name))) {
LOG_WARN("failed to push back word count column", K(ret));
}
// 3. add document length column to arg->store_columns
const ObColumnSchemaV2 *doc_length_col = fts_cols.at(index_column_cnt + 1);
ObString doc_length_col_name;
if (FAILEDx(ob_write_string(*allocator, doc_length_col->get_column_name_str(), doc_length_col_name))) {
LOG_WARN("fail to deep copy doc length column", K(ret));
} else if (OB_FAIL(fts_arg->store_columns_.push_back(doc_length_col_name))) {
LOG_WARN("fail to push document length column", K(ret));
} }
}
// 2. add word count column to arg->store_columns
const ObColumnSchemaV2 *word_count_col = fts_cols.at(index_column_cnt);
if (FAILEDx(fts_arg->store_columns_.push_back(word_count_col->get_column_name_str()))) {
LOG_WARN("failed to push back word count column", K(ret));
}
// 3. add document length column to arg->store_columns
const ObColumnSchemaV2 *doc_length_col = fts_cols.at(index_column_cnt + 1);
if (FAILEDx(fts_arg->store_columns_.push_back(doc_length_col->get_column_name_str()))) {
LOG_WARN("fail to push document length column", K(ret));
} }
return ret; return ret;
} }