From 0e25bab619ce9b2aefe4484854c5d329d9adf3d8 Mon Sep 17 00:00:00 2001 From: BossZou <40255591+BossZou@users.noreply.github.com> Date: Fri, 29 May 2020 13:32:49 +0800 Subject: [PATCH] Fix inconsistent reading and writing when using mishards (# 2367) (#2442) * Fix inconsistent reading and writing when using mishards (# 2367) Signed-off-by: yhz <413554850@qq.com> * CI retry Signed-off-by: yhz <413554850@qq.com> --- CHANGELOG.md | 1 + core/src/db/meta/MySQLMetaImpl.cpp | 6 ------ core/src/db/meta/SqliteMetaImpl.cpp | 6 +----- core/unittest/server/test_web.cpp | 2 +- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7149f45c0..295bad9d44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Please mark all change in change log and use the issue from GitHub # Milvus 0.10.0 (TBD) ## Bug +- \#2367 Fix inconsistent reading and writing when using mishards ## Feature - \#2363 Update branch version diff --git a/core/src/db/meta/MySQLMetaImpl.cpp b/core/src/db/meta/MySQLMetaImpl.cpp index 68029c6513..97c1f5658f 100644 --- a/core/src/db/meta/MySQLMetaImpl.cpp +++ b/core/src/db/meta/MySQLMetaImpl.cpp @@ -2320,12 +2320,6 @@ MySQLMetaImpl::FilesByID(const std::vector& ids, FilesHolder& files_hold statement << " WHERE (" << idStr << ")"; - // End - statement << " AND" - << " (file_type = " << std::to_string(SegmentSchema::RAW) - << " OR file_type = " << std::to_string(SegmentSchema::TO_INDEX) - << " OR file_type = " << std::to_string(SegmentSchema::INDEX) << ");"; - LOG_ENGINE_DEBUG_ << "FilesToSearch: " << statement.str(); res = statement.store(); diff --git a/core/src/db/meta/SqliteMetaImpl.cpp b/core/src/db/meta/SqliteMetaImpl.cpp index afb58f7591..3ea0fcafa9 100644 --- a/core/src/db/meta/SqliteMetaImpl.cpp +++ b/core/src/db/meta/SqliteMetaImpl.cpp @@ -1652,14 +1652,10 @@ SqliteMetaImpl::FilesByID(const std::vector& ids, FilesHolder& files_hol &SegmentSchema::created_on_, &SegmentSchema::updated_time_); - std::vector file_types = {(int)SegmentSchema::RAW, (int)SegmentSchema::TO_INDEX, - (int)SegmentSchema::INDEX}; - auto match_type = in(&SegmentSchema::file_type_, file_types); - // perform query decltype(ConnectorPtr->select(select_columns)) selected; auto match_fileid = in(&SegmentSchema::id_, ids); - auto filter = where(match_fileid and match_type); + auto filter = where(match_fileid); { // multi-threads call sqlite update may get exception('bad logic', etc), so we add a lock here std::lock_guard meta_lock(meta_mutex_); diff --git a/core/unittest/server/test_web.cpp b/core/unittest/server/test_web.cpp index 4b327b4bc8..7712318ffc 100644 --- a/core/unittest/server/test_web.cpp +++ b/core/unittest/server/test_web.cpp @@ -354,7 +354,7 @@ class WebControllerTest : public ::testing::Test { static void SetUpTestCase() { mkdir(CONTROLLER_TEST_CONFIG_DIR, S_IRWXU); - // Basic config + // Load basic config std::string config_path = std::string(CONTROLLER_TEST_CONFIG_DIR).append(CONTROLLER_TEST_CONFIG_FILE); std::fstream fs(config_path.c_str(), std::ios_base::out); fs << CONTROLLER_TEST_VALID_CONFIG_STR;