mirror of https://github.com/milvus-io/milvus.git
parent
9d5ddb28e4
commit
761f1e0666
|
@ -122,6 +122,7 @@ endif ()
|
|||
# **************************** Link Libraries with milvus engine ****************************
|
||||
target_link_libraries( milvus_engine
|
||||
PUBLIC knowhere
|
||||
server
|
||||
segment
|
||||
cache
|
||||
codecs
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "scheduler/job/SearchJob.h"
|
||||
#include "segment/SegmentReader.h"
|
||||
#include "segment/SegmentWriter.h"
|
||||
#include "server/ValidationUtil.h"
|
||||
#include "utils/Exception.h"
|
||||
#include "utils/StringHelpFunctions.h"
|
||||
#include "utils/TimeRecorder.h"
|
||||
|
@ -312,6 +313,7 @@ DBImpl::HasPartition(const std::string& collection_name, const std::string& part
|
|||
CHECK_INITIALIZED;
|
||||
|
||||
snapshot::ScopedSnapshotT ss;
|
||||
STATUS_CHECK(server::ValidatePartitionTags({partition_tag}));
|
||||
STATUS_CHECK(snapshot::Snapshots::GetInstance().GetSnapshot(ss, collection_name));
|
||||
|
||||
auto partition_tags = std::move(ss->GetPartitionNames());
|
||||
|
|
|
@ -116,7 +116,7 @@ ValidateCollectionName(const std::string& collection_name) {
|
|||
int64_t table_name_size = collection_name.size();
|
||||
for (int64_t i = 1; i < table_name_size; ++i) {
|
||||
char name_char = collection_name[i];
|
||||
if (name_char != '_' && std::isalnum(name_char) == 0) {
|
||||
if (name_char != '_' && name_char != '$' && std::isalnum(name_char) == 0) {
|
||||
std::string msg = invalid_msg + "Collection name can only contain numbers, letters, and underscores.";
|
||||
LOG_SERVER_ERROR_ << msg;
|
||||
return Status(SERVER_INVALID_COLLECTION_NAME, msg);
|
||||
|
@ -424,6 +424,40 @@ ValidateSearchTopk(int64_t top_k) {
|
|||
Status
|
||||
ValidatePartitionTags(const std::vector<std::string>& partition_tags) {
|
||||
for (const std::string& tag : partition_tags) {
|
||||
// Partition nametag shouldn't be empty.
|
||||
if (tag.empty()) {
|
||||
std::string msg = "Partition tag should not be empty.";
|
||||
LOG_SERVER_ERROR_ << msg;
|
||||
return Status(SERVER_INVALID_PARTITION_TAG, msg);
|
||||
}
|
||||
|
||||
std::string invalid_msg = "Invalid partition tag: " + tag + ". ";
|
||||
// Partition tag size shouldn't exceed 255.
|
||||
if (tag.size() > engine::MAX_NAME_LENGTH) {
|
||||
std::string msg = invalid_msg + "The length of a partition tag must be less than 255 characters.";
|
||||
LOG_SERVER_ERROR_ << msg;
|
||||
return Status(SERVER_INVALID_PARTITION_TAG, msg);
|
||||
}
|
||||
|
||||
// Partition tag first character should be underscore or character.
|
||||
char first_char = tag[0];
|
||||
if (first_char != '_' && std::isalnum(first_char) == 0) {
|
||||
std::string msg = invalid_msg + "The first character of a partition tag must be an underscore or letter.";
|
||||
LOG_SERVER_ERROR_ << msg;
|
||||
return Status(SERVER_INVALID_PARTITION_TAG, msg);
|
||||
}
|
||||
|
||||
int64_t tag_size = tag.size();
|
||||
for (int64_t i = 1; i < tag_size; ++i) {
|
||||
char name_char = tag[i];
|
||||
if (name_char != '_' && name_char != '$' && std::isalnum(name_char) == 0) {
|
||||
std::string msg = invalid_msg + "Partition tag can only contain numbers, letters, and underscores.";
|
||||
LOG_SERVER_ERROR_ << msg;
|
||||
return Status(SERVER_INVALID_PARTITION_TAG, msg);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// trim side-blank of tag, only compare valid characters
|
||||
// for example: " ab cd " is treated as "ab cd"
|
||||
std::string valid_tag = tag;
|
||||
|
@ -441,18 +475,7 @@ ValidatePartitionTags(const std::vector<std::string>& partition_tags) {
|
|||
LOG_SERVER_ERROR_ << msg;
|
||||
return Status(SERVER_INVALID_PARTITION_TAG, msg);
|
||||
}
|
||||
}
|
||||
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
Status
|
||||
ValidateInsertDataSize(const engine::DataChunkPtr& data) {
|
||||
int64_t chunk_size = engine::utils::GetSizeOfChunk(data);
|
||||
if (chunk_size > engine::MAX_INSERT_DATA_SIZE) {
|
||||
std::string msg = "The amount of data inserted each time cannot exceed " +
|
||||
std::to_string(engine::MAX_INSERT_DATA_SIZE / engine::MB) + " MB";
|
||||
return Status(SERVER_INVALID_ROWRECORD_ARRAY, msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
return Status::OK();
|
||||
|
|
|
@ -11,7 +11,7 @@ segment_row_count = 5000
|
|||
nprobe = 1
|
||||
top_k = 1
|
||||
epsilon = 0.0001
|
||||
tag = "1970-01-01"
|
||||
tag = "1970_01_01"
|
||||
nb = 6000
|
||||
nlist = 1024
|
||||
collection_id = "collection_stats"
|
||||
|
|
|
@ -13,7 +13,7 @@ dim = 128
|
|||
segment_row_count = 5000
|
||||
collection_id = "test_delete"
|
||||
DELETE_TIMEOUT = 60
|
||||
tag = "1970-01-01"
|
||||
tag = "1970_01_01"
|
||||
nb = 6000
|
||||
field_name = default_float_vec_field_name
|
||||
entity = gen_entities(1)
|
||||
|
|
|
@ -14,7 +14,7 @@ dim = 128
|
|||
segment_row_count = 5000
|
||||
collection_id = "test_get"
|
||||
DELETE_TIMEOUT = 60
|
||||
tag = "1970-01-01"
|
||||
tag = "1970_01_01"
|
||||
nb = 6000
|
||||
entity = gen_entities(1)
|
||||
binary_entity = gen_binary_entities(1)
|
||||
|
|
|
@ -12,7 +12,7 @@ dim = 128
|
|||
segment_row_count = 5000
|
||||
collection_id = "test_insert"
|
||||
ADD_TIMEOUT = 60
|
||||
tag = "1970-01-01"
|
||||
tag = "1970_01_01"
|
||||
insert_interval_time = 1.5
|
||||
nb = 6000
|
||||
field_name = default_float_vec_field_name
|
||||
|
|
|
@ -10,7 +10,7 @@ from utils import *
|
|||
dim = 128
|
||||
segment_row_count = 100000
|
||||
nb = 6000
|
||||
tag = "1970-01-01"
|
||||
tag = "1970_01_01"
|
||||
field_name = default_float_vec_field_name
|
||||
binary_field_name = default_binary_vec_field_name
|
||||
collection_id = "list_id_in_segment"
|
||||
|
|
|
@ -14,7 +14,7 @@ dim = 128
|
|||
segment_row_count = 5000
|
||||
top_k_limit = 2048
|
||||
collection_id = "search"
|
||||
tag = "1970-01-01"
|
||||
tag = "1970_01_01"
|
||||
insert_interval_time = 1.5
|
||||
nb = 6000
|
||||
top_k = 10
|
||||
|
|
|
@ -12,7 +12,7 @@ dim = 128
|
|||
index_file_size = 10
|
||||
collection_id = "mysql_failure"
|
||||
nprobe = 1
|
||||
tag = "1970-01-01"
|
||||
tag = "1970_01_01"
|
||||
|
||||
|
||||
class TestMysql:
|
||||
|
|
|
@ -13,7 +13,7 @@ dim = 128
|
|||
index_file_size = 10
|
||||
collection_id = "test_partition_restart"
|
||||
nprobe = 1
|
||||
tag = "1970-01-01"
|
||||
tag = "1970_01_01"
|
||||
|
||||
|
||||
class TestRestartBase:
|
||||
|
|
|
@ -11,7 +11,7 @@ index_file_size = 10
|
|||
COMPACT_TIMEOUT = 180
|
||||
nprobe = 1
|
||||
top_k = 1
|
||||
tag = "1970-01-01"
|
||||
tag = "1970_01_01"
|
||||
nb = 6000
|
||||
nq = 2
|
||||
segment_row_count = 5000
|
||||
|
|
|
@ -14,7 +14,7 @@ index_file_size = 10
|
|||
CONFIG_TIMEOUT = 80
|
||||
nprobe = 1
|
||||
top_k = 1
|
||||
tag = "1970-01-01"
|
||||
tag = "1970_01_01"
|
||||
nb = 6000
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ index_file_size = 10
|
|||
collection_id = "test_flush"
|
||||
DELETE_TIMEOUT = 60
|
||||
nprobe = 1
|
||||
tag = "1970-01-01"
|
||||
tag = "1970_01_01"
|
||||
top_k = 1
|
||||
nb = 6000
|
||||
tag = "partition_tag"
|
||||
|
|
|
@ -14,7 +14,7 @@ index_file_size = 10
|
|||
BUILD_TIMEOUT = 300
|
||||
nprobe = 1
|
||||
top_k = 5
|
||||
tag = "1970-01-01"
|
||||
tag = "1970_01_01"
|
||||
NLIST = 4046
|
||||
INVALID_NLIST = 100000000
|
||||
field_name = "float_vector"
|
||||
|
|
|
@ -12,7 +12,7 @@ dim = 128
|
|||
segment_row_count = 5000
|
||||
collection_id = "partition"
|
||||
nprobe = 1
|
||||
tag = "1970-01-01"
|
||||
tag = "1970_01_01"
|
||||
TIMEOUT = 120
|
||||
nb = 6000
|
||||
tag = "partition_tag"
|
||||
|
|
|
@ -10,7 +10,7 @@ dim = 128
|
|||
collection_id = "test_wal"
|
||||
segment_row_count = 5000
|
||||
WAL_TIMEOUT = 60
|
||||
tag = "1970-01-01"
|
||||
tag = "1970_01_01"
|
||||
insert_interval_time = 1.5
|
||||
nb = 6000
|
||||
field_name = "float_vector"
|
||||
|
|
Loading…
Reference in New Issue