未验证 提交 736bb61e 编写于 作者: G groot 提交者: GitHub

validate compact threshold (#3495)

Signed-off-by: Ngroot <yihua.mo@zilliz.com>
上级 239d4449
......@@ -448,5 +448,15 @@ ValidateInsertDataSize(const engine::DataChunkPtr& data) {
return Status::OK();
}
Status
ValidateCompactThreshold(double threshold) {
if (threshold > 1.0 || threshold < 0.0) {
std::string msg = "Invalid compact threshold: " + std::to_string(threshold) + ". Should be in range [0.0, 1.0]";
return Status(SERVER_INVALID_ROWRECORD_ARRAY, msg);
}
return Status::OK();
}
} // namespace server
} // namespace milvus
......@@ -55,5 +55,8 @@ ValidatePartitionTags(const std::vector<std::string>& partition_tags);
extern Status
ValidateInsertDataSize(const engine::DataChunkPtr& data);
extern Status
ValidateCompactThreshold(double threshold);
} // namespace server
} // namespace milvus
......@@ -43,6 +43,11 @@ CompactReq::OnExecute() {
std::string hdr = "CompactReq(collection=" + collection_name_ + ")";
TimeRecorderAuto rc(hdr);
auto status = ValidateCompactThreshold(compact_threshold_);
if (!status.ok()) {
return status;
}
bool exist = false;
STATUS_CHECK(DBWrapper::DB()->HasCollection(collection_name_, exist));
if (!exist) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册