未验证 提交 5437814d 编写于 作者: C chen qingxiang 提交者: GitHub

fix bugs in inserting vectors test case (#3045)

* fix bug in test case
Signed-off-by: Ngodchen0212 <qingxiang.chen@zilliz.com>

* fix bugs in test case
Signed-off-by: Ngodchen0212 <qingxiang.chen@zilliz.com>

* fix bug in DB GetEntityById interface
Signed-off-by: Ngodchen0212 <qingxiang.chen@zilliz.com>
上级 508eaff0
...@@ -1108,7 +1108,7 @@ DBImpl::ExecWalRecord(const wal::MXLogRecord& record) { ...@@ -1108,7 +1108,7 @@ DBImpl::ExecWalRecord(const wal::MXLogRecord& record) {
switch (record.type) { switch (record.type) {
case wal::MXLogType::Entity: { case wal::MXLogType::Entity: {
int64_t collection_name = 0, partition_id = 0; int64_t collection_name = 0, partition_id = 0;
auto status = get_collection_partition_id(record, collection_name, partition_id); status = get_collection_partition_id(record, collection_name, partition_id);
if (!status.ok()) { if (!status.ok()) {
LOG_WAL_ERROR_ << LogOut("[%s][%ld] ", "insert", 0) << status.message(); LOG_WAL_ERROR_ << LogOut("[%s][%ld] ", "insert", 0) << status.message();
return status; return status;
...@@ -1124,7 +1124,7 @@ DBImpl::ExecWalRecord(const wal::MXLogRecord& record) { ...@@ -1124,7 +1124,7 @@ DBImpl::ExecWalRecord(const wal::MXLogRecord& record) {
case wal::MXLogType::Delete: { case wal::MXLogType::Delete: {
snapshot::ScopedSnapshotT ss; snapshot::ScopedSnapshotT ss;
auto status = snapshot::Snapshots::GetInstance().GetSnapshot(ss, record.collection_id); status = snapshot::Snapshots::GetInstance().GetSnapshot(ss, record.collection_id);
if (!status.ok()) { if (!status.ok()) {
LOG_WAL_ERROR_ << LogOut("[%s][%ld] ", "delete", 0) << "Get snapshot fail: " << status.message(); LOG_WAL_ERROR_ << LogOut("[%s][%ld] ", "delete", 0) << "Get snapshot fail: " << status.message();
return status; return status;
...@@ -1148,7 +1148,7 @@ DBImpl::ExecWalRecord(const wal::MXLogRecord& record) { ...@@ -1148,7 +1148,7 @@ DBImpl::ExecWalRecord(const wal::MXLogRecord& record) {
if (!record.collection_id.empty()) { if (!record.collection_id.empty()) {
// flush one collection // flush one collection
snapshot::ScopedSnapshotT ss; snapshot::ScopedSnapshotT ss;
auto status = snapshot::Snapshots::GetInstance().GetSnapshot(ss, record.collection_id); status = snapshot::Snapshots::GetInstance().GetSnapshot(ss, record.collection_id);
if (!status.ok()) { if (!status.ok()) {
LOG_WAL_ERROR_ << LogOut("[%s][%ld] ", "flush", 0) << "Get snapshot fail: " << status.message(); LOG_WAL_ERROR_ << LogOut("[%s][%ld] ", "flush", 0) << "Get snapshot fail: " << status.message();
return status; return status;
...@@ -1175,7 +1175,7 @@ DBImpl::ExecWalRecord(const wal::MXLogRecord& record) { ...@@ -1175,7 +1175,7 @@ DBImpl::ExecWalRecord(const wal::MXLogRecord& record) {
std::set<std::string> flushed_collections; std::set<std::string> flushed_collections;
for (auto id : collection_names) { for (auto id : collection_names) {
snapshot::ScopedSnapshotT ss; snapshot::ScopedSnapshotT ss;
auto status = snapshot::Snapshots::GetInstance().GetSnapshot(ss, id); status = snapshot::Snapshots::GetInstance().GetSnapshot(ss, id);
if (!status.ok()) { if (!status.ok()) {
LOG_WAL_ERROR_ << LogOut("[%s][%ld] ", "flush", 0) << "Get snapshot fail: " << status.message(); LOG_WAL_ERROR_ << LogOut("[%s][%ld] ", "flush", 0) << "Get snapshot fail: " << status.message();
return status; return status;
...@@ -1239,7 +1239,7 @@ DBImpl::BackgroundMerge(std::set<std::string> collection_names, bool force_merge ...@@ -1239,7 +1239,7 @@ DBImpl::BackgroundMerge(std::set<std::string> collection_names, bool force_merge
merge_mgr_ptr_->UseStrategy(MergeStrategyType::ADAPTIVE); merge_mgr_ptr_->UseStrategy(MergeStrategyType::ADAPTIVE);
} }
auto status = merge_mgr_ptr_->MergeFiles(collection_name); status = merge_mgr_ptr_->MergeFiles(collection_name);
merge_mgr_ptr_->UseStrategy(old_strategy); merge_mgr_ptr_->UseStrategy(old_strategy);
if (!status.ok()) { if (!status.ok()) {
LOG_ENGINE_ERROR_ << "Failed to get merge files for collection: " << collection_name LOG_ENGINE_ERROR_ << "Failed to get merge files for collection: " << collection_name
......
...@@ -164,7 +164,7 @@ SegmentReader::LoadEntities(const std::string& field_name, const std::vector<int ...@@ -164,7 +164,7 @@ SegmentReader::LoadEntities(const std::string& field_name, const std::vector<int
codec::ReadRanges ranges; codec::ReadRanges ranges;
for (auto offset : offsets) { for (auto offset : offsets) {
ranges.push_back(codec::ReadRange(offset, field_width)); ranges.push_back(codec::ReadRange(offset * field_width, field_width));
} }
auto& ss_codec = codec::Codec::instance(); auto& ss_codec = codec::Codec::instance();
ss_codec.GetBlockFormat()->Read(fs_ptr_, file_path, ranges, raw); ss_codec.GetBlockFormat()->Read(fs_ptr_, file_path, ranges, raw);
......
...@@ -1255,6 +1255,11 @@ GrpcRequestHandler::Insert(::grpc::ServerContext* context, const ::milvus::grpc: ...@@ -1255,6 +1255,11 @@ GrpcRequestHandler::Insert(::grpc::ServerContext* context, const ::milvus::grpc:
auto valid_row_count = [&](int32_t& base, int32_t test) -> bool { auto valid_row_count = [&](int32_t& base, int32_t test) -> bool {
if (base < 0) { if (base < 0) {
base = test; base = test;
if (request->entity_id_array_size() > 0 && base != request->entity_id_array_size()) {
auto status = Status{SERVER_INVALID_ROWRECORD_ARRAY, "ID size not matches entity size"};
SET_RESPONSE(response->mutable_status(), status, context);
return false;
}
} else if (base != test) { } else if (base != test) {
auto status = Status{SERVER_INVALID_ROWRECORD_ARRAY, "Field row count inconsist"}; auto status = Status{SERVER_INVALID_ROWRECORD_ARRAY, "Field row count inconsist"};
SET_RESPONSE(response->mutable_status(), status, context); SET_RESPONSE(response->mutable_status(), status, context);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册