Skip to content

Commit 0c31da1

Browse files
authored
feat: ignore managed_service_info flag for cluster (#4803)
* feat: ignore managed_service_info flag for cluster
1 parent 624e111 commit 0c31da1

File tree

2 files changed

+5
-21
lines changed

2 files changed

+5
-21
lines changed

src/server/cluster/cluster_family.cc

+1-18
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,6 @@ constexpr char kIdNotFound[] = "syncid not found";
6363
constexpr string_view kClusterDisabled =
6464
"Cluster is disabled. Enabled via passing --cluster_mode=emulated|yes";
6565

66-
ClusterShardInfos GetConfigForStats(ConnectionContext* cntx) {
67-
CHECK(!IsClusterEmulated());
68-
CHECK(ClusterConfig::Current() != nullptr);
69-
70-
auto config = ClusterConfig::Current()->GetConfig();
71-
if (cntx->conn()->IsPrivileged() || !absl::GetFlag(FLAGS_managed_service_info)) {
72-
return config;
73-
}
74-
75-
auto shards_info = config.Unwrap();
76-
for (auto& node : shards_info) {
77-
node.replicas.clear();
78-
}
79-
80-
return shards_info;
81-
}
82-
8366
} // namespace
8467

8568
ClusterFamily::ClusterFamily(ServerFamily* server_family) : server_family_(server_family) {
@@ -122,7 +105,7 @@ std::optional<ClusterShardInfos> ClusterFamily::GetShardInfos(ConnectionContext*
122105
}
123106

124107
if (ClusterConfig::Current() != nullptr) {
125-
return GetConfigForStats(cntx);
108+
return ClusterConfig::Current()->GetConfig();
126109
}
127110
return nullopt;
128111
}

tests/dragonfly/cluster_test.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -539,15 +539,16 @@ async def test_cluster_managed_service_info(df_factory):
539539
assert await c_master.execute_command("CLUSTER SHARDS") == expected_full_cluster_shards
540540
assert await c_master_admin.execute_command("CLUSTER SHARDS") == expected_full_cluster_shards
541541

542+
# this flag doesn't affect cluster anymore so the results will be the same
542543
await c_master.execute_command("config set managed_service_info true")
543544

544-
assert await c_master.execute_command("CLUSTER SLOTS") == expected_hidden_cluster_slots
545+
assert await c_master.execute_command("CLUSTER SLOTS") == expected_full_cluster_slots
545546
assert await c_master_admin.execute_command("CLUSTER SLOTS") == expected_full_cluster_slots
546547

547-
assert await c_master.execute_command("CLUSTER NODES") == expected_hidden_cluster_nodes
548+
assert await c_master.execute_command("CLUSTER NODES") == expected_full_cluster_nodes
548549
assert await c_master_admin.execute_command("CLUSTER NODES") == expected_full_cluster_nodes
549550

550-
assert await c_master.execute_command("CLUSTER SHARDS") == expected_hidden_cluster_shards
551+
assert await c_master.execute_command("CLUSTER SHARDS") == expected_full_cluster_shards
551552
assert await c_master_admin.execute_command("CLUSTER SHARDS") == expected_full_cluster_shards
552553

553554

0 commit comments

Comments
 (0)