Skip to content

Commit 25b82fd

Browse files
obdevfootka
authored andcommitted
[CP] fix dml set can_skip flag of hybrid vector index adaptor
Co-authored-by: footka <672528926@qq.com>
1 parent 32145b5 commit 25b82fd

2 files changed

Lines changed: 39 additions & 47 deletions

File tree

src/share/schema/ob_table_dml_param.cpp

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -198,27 +198,16 @@ int ObTableSchemaParam::convert(const ObTableSchema *schema)
198198
|| schema->is_vec_vid_rowkey_type()
199199
|| schema->is_hybrid_vec_index_log_type()
200200
|| schema->is_hybrid_vec_index_embedded_type()) {
201-
if (schema->is_vec_delta_buffer_type()) {
201+
if (schema->is_vec_delta_buffer_type()
202+
|| schema->is_hybrid_vec_index_embedded_type()
203+
|| schema->is_hybrid_vec_index_log_type()) {
202204
if (OB_FAIL(ob_write_string(allocator_, schema->get_index_params(), vec_index_param_))) {
203-
LOG_WARN("fail to copy vec index param", K(ret), K(schema->get_index_params()));
205+
LOG_WARN("fail to copy vec index param", K(ret), K(schema->get_index_params()), K(schema->get_index_type()));
204206
} else if (OB_FAIL(ObVectorIndexUtil::get_vector_index_column_dim(*schema, vec_dim_))) {
205-
LOG_WARN("fail to get vector col dim", K(ret));
207+
LOG_WARN("fail to get vector col dim", K(ret), K(schema->get_index_type()));
206208
} else if (vec_dim_ == 0) {
207209
ret = OB_ERR_UNEXPECTED;
208-
LOG_WARN("get vector dim is zero, fail to calc", K(ret), K(vec_dim_), KPC(schema));
209-
}
210-
} else if (schema->is_hybrid_vec_index_embedded_type()) {
211-
if (OB_FAIL(ob_write_string(allocator_, schema->get_index_params(), vec_index_param_))) {
212-
LOG_WARN("fail to copy vec index param", K(ret), K(schema->get_index_params()));
213-
} else if (OB_FAIL(ObVectorIndexUtil::get_vector_index_column_dim(*schema, vec_dim_))) {
214-
LOG_WARN("fail to get vector col dim", K(ret));
215-
} else if (vec_dim_ == 0) {
216-
ret = OB_ERR_UNEXPECTED;
217-
LOG_WARN("get vector dim is zero, fail to calc", K(ret), K(vec_dim_), KPC(schema));
218-
}
219-
} else if (schema->is_hybrid_vec_index_log_type()) {
220-
if (OB_FAIL(ob_write_string(allocator_, schema->get_index_params(), vec_index_param_))) {
221-
LOG_WARN("fail to copy vec index param", K(ret), K(schema->get_index_params()));
210+
LOG_WARN("get vector dim is zero, fail to calc", K(ret), K(vec_dim_), KPC(schema), K(schema->get_index_type()));
222211
}
223212
}
224213
for (int64_t i = 0; OB_SUCC(ret) && i < schema->get_column_count(); ++i) {

src/storage/ls/ob_ls_tablet_service.cpp

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4965,40 +4965,43 @@ int ObLSTabletService::insert_vector_index_rows(
49654965
}
49664966
} else if (table_param.is_hybrid_vector_index_log()) {
49674967
const blocksstable::ObDmlFlag dml_flag = run_ctx.dml_flag_;
4968-
if (dml_flag == ObDmlFlag::DF_DELETE) {
4969-
ObString vec_idx_param = run_ctx.dml_param_.table_param_->get_data_table().get_vec_index_param();
4970-
int64_t vec_dim = run_ctx.dml_param_.table_param_->get_data_table().get_vec_dim();
4971-
const uint64_t vec_id_col_id = run_ctx.dml_param_.table_param_->get_data_table().get_vec_id_col_id();
4972-
const uint64_t vec_vector_col_id = run_ctx.dml_param_.table_param_->get_data_table().get_vec_vector_col_id();
4973-
// get vector col idx
4974-
int64_t vec_id_idx = OB_INVALID_INDEX;
4975-
int64_t vector_idx = OB_INVALID_INDEX;
4976-
for (int64_t i = 0; OB_SUCC(ret) && i < run_ctx.dml_param_.table_param_->get_col_descs().count(); i++) {
4977-
uint64_t col_id = run_ctx.dml_param_.table_param_->get_col_descs().at(i).col_id_;
4978-
if (col_id == vec_id_col_id) {
4979-
vec_id_idx = i;
4980-
} else if (col_id == vec_vector_col_id) {
4981-
vector_idx = i;
4968+
ObString vec_idx_param = run_ctx.dml_param_.table_param_->get_data_table().get_vec_index_param();
4969+
int64_t vec_dim = run_ctx.dml_param_.table_param_->get_data_table().get_vec_dim();
4970+
ObPluginVectorIndexAdapterGuard adaptor_guard;
4971+
ObPluginVectorIndexService *vec_index_service = MTL(ObPluginVectorIndexService *);
4972+
if (OB_FAIL(vec_index_service->acquire_adapter_guard(run_ctx.store_ctx_.ls_id_,
4973+
run_ctx.relative_table_.get_tablet_id(),
4974+
ObIndexType::INDEX_TYPE_HYBRID_INDEX_LOG_LOCAL,
4975+
adaptor_guard,
4976+
&vec_idx_param,
4977+
vec_dim))) {
4978+
LOG_WARN("fail to get ObPluginVectorIndexAdapter", K(ret), K(run_ctx.store_ctx_), K(run_ctx.relative_table_));
4979+
} else {
4980+
if (dml_flag == ObDmlFlag::DF_DELETE) {
4981+
const uint64_t vec_id_col_id = run_ctx.dml_param_.table_param_->get_data_table().get_vec_id_col_id();
4982+
const uint64_t vec_vector_col_id = run_ctx.dml_param_.table_param_->get_data_table().get_vec_vector_col_id();
4983+
// get vector col idx
4984+
int64_t vec_id_idx = OB_INVALID_INDEX;
4985+
int64_t vector_idx = OB_INVALID_INDEX;
4986+
for (int64_t i = 0; OB_SUCC(ret) && i < run_ctx.dml_param_.table_param_->get_col_descs().count(); i++) {
4987+
uint64_t col_id = run_ctx.dml_param_.table_param_->get_col_descs().at(i).col_id_;
4988+
if (col_id == vec_id_col_id) {
4989+
vec_id_idx = i;
4990+
} else if (col_id == vec_vector_col_id) {
4991+
vector_idx = i;
4992+
}
49824993
}
4983-
}
4984-
if (vec_id_idx == OB_INVALID_INDEX || vector_idx == OB_INVALID_INDEX) {
4985-
ret = OB_ERR_UNEXPECTED;
4986-
LOG_WARN("fail to get vec index column idxs", K(ret), K(vec_id_col_id), K(vec_vector_col_id),
4987-
K(vec_id_idx), K(vector_idx));
4988-
} else {
4989-
ObPluginVectorIndexService *vec_index_service = MTL(ObPluginVectorIndexService *);
4990-
ObPluginVectorIndexAdapterGuard adaptor_guard;
4991-
if (OB_FAIL(vec_index_service->acquire_adapter_guard(run_ctx.store_ctx_.ls_id_,
4992-
run_ctx.relative_table_.get_tablet_id(),
4993-
ObIndexType::INDEX_TYPE_HYBRID_INDEX_LOG_LOCAL,
4994-
adaptor_guard,
4995-
&vec_idx_param,
4996-
vec_dim))) {
4997-
LOG_WARN("fail to get ObPluginVectorIndexAdapter", K(ret), K(run_ctx.store_ctx_), K(run_ctx.relative_table_));
4994+
if (vec_id_idx == OB_INVALID_INDEX || vector_idx == OB_INVALID_INDEX) {
4995+
ret = OB_ERR_UNEXPECTED;
4996+
LOG_WARN("fail to get vec index column idxs", K(ret), K(vec_id_col_id), K(vec_vector_col_id),
4997+
K(vec_id_idx), K(vector_idx));
49984998
} else if (OB_FAIL(adaptor_guard.get_adatper()->handle_insert_incr_table_rows(rows, vec_id_idx, vector_idx, row_count))) {
4999-
LOG_WARN("fail to handle delete hybrid vec index log table rows", K(ret), KP(rows), K(row_count));
4999+
LOG_WARN("fail to handle delete hybrid vec index log table rows", K(ret), KP(rows), K(row_count));
50005000
}
50015001
}
5002+
if (OB_SUCC(ret)) {
5003+
adaptor_guard.get_adatper()->update_can_skip(NOT_SKIP);
5004+
}
50025005
}
50035006
} else if (table_param.is_hybrid_vector_index_embedded()) {
50045007
ObString vec_idx_param = run_ctx.dml_param_.table_param_->get_data_table().get_vec_index_param();

0 commit comments

Comments
 (0)