#1929 Skip mysql meta schema field width check (#1937)

* #1929 Skip mysql meta schema field width check

Signed-off-by: groot <yihua.mo@zilliz.com>

* typo

Signed-off-by: groot <yihua.mo@zilliz.com>

* merge master

Signed-off-by: groot <yihua.mo@zilliz.com>
pull/1971/head
groot 2020-04-18 10:26:22 +08:00 committed by GitHub
parent 59035d9892
commit 85de706d22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -6,6 +6,7 @@ Please mark all change in change log and use the issue from GitHub
## Bug
- \#1705 Limit the insert data batch size
- \#1929 Skip MySQL meta schema field width check
## Feature

View File

@ -80,6 +80,15 @@ class MetaField {
IsEqual(const MetaField& field) const {
size_t name_len_min = field.name_.length() > name_.length() ? name_.length() : field.name_.length();
size_t type_len_min = field.type_.length() > type_.length() ? type_.length() : field.type_.length();
// only check field type, don't check field width, for example: VARCHAR(255) and VARCHAR(100) is equal
std::vector<std::string> type_split;
milvus::server::StringHelpFunctions::SplitStringByDelimeter(type_, "(", type_split);
if (!type_split.empty()) {
type_len_min = type_split[0].length() > type_len_min ? type_len_min : type_split[0].length();
}
// field name must be equal, ignore type width
return strncasecmp(field.name_.c_str(), name_.c_str(), name_len_min) == 0 &&
strncasecmp(field.type_.c_str(), type_.c_str(), type_len_min) == 0;
}