Skip to content

Commit

Permalink
Damn create space (vesoft-inc#468)
Browse files Browse the repository at this point in the history
* add more check about parse host result (vesoft-inc#3628)

* fix meta crash after create space (vesoft-inc#3660)

Co-authored-by: Yichen Wang <18348405+Aiee@users.noreply.github.com>

* fix test case...

Co-authored-by: yaphet <4414314+darionyaphet@users.noreply.github.com>
Co-authored-by: Yichen Wang <18348405+Aiee@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 8, 2022
1 parent b4b18a8 commit 1390b96
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/meta/processors/parts/CreateSpaceProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ void CreateSpaceProcessor::process(const cpp2::CreateSpaceReq& req) {
for (auto& host : hosts) {
auto key = MetaKeyUtils::hostKey(host.host, host.port);
auto ret = doGet(key);
if (!nebula::ok(ret)) {
code = nebula::error(ret);
LOG(ERROR) << "Get host " << host << " failed.";
break;
}

HostInfo info = HostInfo::decode(nebula::value(ret));
if (now - info.lastHBTimeInMilliSec_ <
FLAGS_heartbeat_interval_secs * FLAGS_expired_time_factor * 1000) {
Expand All @@ -206,6 +212,8 @@ void CreateSpaceProcessor::process(const cpp2::CreateSpaceReq& req) {
LOG(WARNING) << "Host " << host << " expired";
}
}

CHECK_CODE_AND_BREAK();
zoneHosts[zone] = std::move(hosts);
}

Expand Down
2 changes: 1 addition & 1 deletion src/meta/test/VariableTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ TEST(VariableTest, VariableTest) {
{
// Register storage machine
std::vector<HostAddr> addresses;
for (int32_t i = 0; i < 3; i++) {
for (int32_t i = 0; i <= 3; i++) {
addresses.emplace_back(std::to_string(i), i);
}
TestUtils::registerHB(kv.get(), addresses, cpp2::HostRole::STORAGE);
Expand Down

0 comments on commit 1390b96

Please sign in to comment.