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>
This commit is contained in:
BossZou 2020-05-29 13:32:49 +08:00 committed by GitHub
parent 7c72dcf4d3
commit 0e25bab619
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 12 deletions

View File

@ -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

View File

@ -2320,12 +2320,6 @@ MySQLMetaImpl::FilesByID(const std::vector<size_t>& 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();

View File

@ -1652,14 +1652,10 @@ SqliteMetaImpl::FilesByID(const std::vector<size_t>& ids, FilesHolder& files_hol
&SegmentSchema::created_on_,
&SegmentSchema::updated_time_);
std::vector<int> 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<std::mutex> meta_lock(meta_mutex_);

View File

@ -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;