MS-622 Delete vectors should be failed if date range is invalid

Former-commit-id: bedb2fcb458f9f2cd94c02d3095044aff8630f6b
pull/191/head
starlord 2019-10-10 10:45:11 +08:00
parent a56d6042e6
commit e4889de803
3 changed files with 12 additions and 8 deletions

View File

@ -11,6 +11,7 @@ Please mark all change in change log and use the ticket from JIRA.
- MS-587 - Count get wrong result after adding vectors and index built immediately - MS-587 - Count get wrong result after adding vectors and index built immediately
- MS-599 - search wrong result when table created with metric_type: IP - MS-599 - search wrong result when table created with metric_type: IP
- MS-601 - Docker logs error caused by get CPUTemperature error - MS-601 - Docker logs error caused by get CPUTemperature error
- MS-622 - Delete vectors should be failed if date range is invalid
## Improvement ## Improvement
- MS-552 - Add and change the easylogging library - MS-552 - Add and change the easylogging library

View File

@ -111,12 +111,15 @@ CentOS 7:
$ yum install clang $ yum install clang
Ubuntu 16.04: Ubuntu 16.04:
$ sudo apt-get install clang-tidy $ sudo apt-get install clang-tidy
$ sudo su
$ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - $ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
$ sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main" $ apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main"
$ sudo apt-get update $ apt-get update
$ sudo apt-get install clang-format-6.0 $ apt-get install clang-format-6.0
Ubuntu 18.04: Ubuntu 18.04:
$ sudo apt-get install clang-tidy clang-format $ sudo apt-get install clang-tidy clang-format
$ rm cmake_build/CMakeCache.txt
``` ```
```shell ```shell
$ ./build.sh -l $ ./build.sh -l

View File

@ -42,6 +42,8 @@ static const char* DQL_TASK_GROUP = "dql";
static const char* DDL_DML_TASK_GROUP = "ddl_dml"; static const char* DDL_DML_TASK_GROUP = "ddl_dml";
static const char* PING_TASK_GROUP = "ping"; static const char* PING_TASK_GROUP = "ping";
constexpr int64_t DAY_SECONDS = 24 * 60 * 60;
using DB_META = milvus::engine::meta::Meta; using DB_META = milvus::engine::meta::Meta;
using DB_DATE = milvus::engine::meta::DateT; using DB_DATE = milvus::engine::meta::DateT;
@ -78,8 +80,6 @@ IndexType(engine::EngineType type) {
return map_type[type]; return map_type[type];
} }
constexpr int64_t DAY_SECONDS = 24 * 60 * 60;
Status Status
ConvertTimeRangeToDBDates(const std::vector<::milvus::grpc::Range>& range_array, std::vector<DB_DATE>& dates) { ConvertTimeRangeToDBDates(const std::vector<::milvus::grpc::Range>& range_array, std::vector<DB_DATE>& dates) {
dates.clear(); dates.clear();
@ -94,10 +94,10 @@ ConvertTimeRangeToDBDates(const std::vector<::milvus::grpc::Range>& range_array,
return Status(SERVER_INVALID_TIME_RANGE, "Invalid time range: " + range.start_value()); return Status(SERVER_INVALID_TIME_RANGE, "Invalid time range: " + range.start_value());
} }
int64_t days = (tt_end > tt_start) ? (tt_end - tt_start) / DAY_SECONDS : (tt_start - tt_end) / DAY_SECONDS; int64_t days = (tt_end - tt_start) / DAY_SECONDS;
if (days == 0) { if (days <= 0) {
return Status(SERVER_INVALID_TIME_RANGE, return Status(SERVER_INVALID_TIME_RANGE,
"Invalid time range: " + range.start_value() + " to " + range.end_value()); "Invalid time range: The start-date should be smaller than end-date!");
} }
// range: [start_day, end_day) // range: [start_day, end_day)