Skip to content

Commit 2a7533b

Browse files
committed
fix: address comments
1 parent 6afe123 commit 2a7533b

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/server/cluster/cluster_defs.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ enum class NodeHealth : std::uint8_t { FAIL, LOADING, ONLINE, HIDDEN };
9898
std::string_view ToString(NodeHealth nh);
9999

100100
struct ClusterExtendedNodeInfo : ClusterNodeInfo {
101-
NodeHealth health = NodeHealth::FAIL;
101+
NodeHealth health = NodeHealth::ONLINE;
102102
};
103103

104104
struct MigrationInfo {

src/server/cluster/cluster_family.cc

+3-2
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ void ClusterNodesImpl(const ClusterShardInfos& config, string_view my_id,
307307

308308
string result;
309309

310-
auto WriteNode = [&](const ClusterNodeInfo& node, string_view role, string_view master_id,
310+
auto WriteNode = [&](const ClusterExtendedNodeInfo& node, string_view role, string_view master_id,
311311
const SlotRanges& ranges) {
312312
absl::StrAppend(&result, node.id, " ");
313313

@@ -320,7 +320,8 @@ void ClusterNodesImpl(const ClusterShardInfos& config, string_view my_id,
320320

321321
absl::StrAppend(&result, master_id, " ");
322322

323-
absl::StrAppend(&result, "0 0 0 connected");
323+
absl::StrAppend(&result,
324+
node.health != NodeHealth::FAIL ? "0 0 0 connected" : "0 0 0 disconnected");
324325

325326
for (const auto& range : ranges) {
326327
absl::StrAppend(&result, " ", range.start);

src/server/cluster/cluster_family_test.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -432,12 +432,12 @@ TEST_F(ClusterFamilyTest, ClusterConfigFullMultipleInstances) {
432432
"qwerty1")))))));
433433

434434
EXPECT_THAT(Run({"cluster", "nodes"}),
435-
"abcd1234 10.0.0.1:7000@7000 master - 0 0 0 connected 0-10000\n"
435+
"abcd1234 10.0.0.1:7000@7000 master - 0 0 0 disconnected 0-10000\n"
436436
"wxyz 10.0.0.10:8000@8000 slave abcd1234 0 0 0 connected\n"
437437
"efgh7890 10.0.0.2:7001@7001 master - 0 0 0 connected 10001-16383\n"
438438
"qwerty 10.0.0.11:8001@8001 slave efgh7890 0 0 0 connected\n"
439439
"qwerty1 10.0.0.12:8002@8002 slave efgh7890 0 0 0 connected\n"
440-
"qwerty2 10.0.0.13:8003@8003 slave efgh7890 0 0 0 connected\n");
440+
"qwerty2 10.0.0.13:8003@8003 slave efgh7890 0 0 0 disconnected\n");
441441

442442
absl::InsecureBitGen eng;
443443
while (true) {

0 commit comments

Comments
 (0)