Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(zookeeper): show system znodes in root listing

Guoyu Su313ae2d071f2
diff --git a/agents/drivers/zookeeper/src/main/java/com/dbx/agent/zookeeper/ZooKeeperAgent.java b/agents/drivers/zookeeper/src/main/java/com/dbx/agent/zookeeper/ZooKeeperAgent.java
index c353c47e22..309960944c 100644
--- a/agents/drivers/zookeeper/src/main/java/com/dbx/agent/zookeeper/ZooKeeperAgent.java
+++ b/agents/drivers/zookeeper/src/main/java/com/dbx/agent/zookeeper/ZooKeeperAgent.java
@@ -140,7 +140,6 @@ public final class ZooKeeperAgent {
}
List<String> paths = recursive ? listRecursive(active, root) : listDirectChildren(active, root);
- paths.removeIf(path -> shouldHideFromRootListing(root, path));
Collections.sort(paths);
int offset = cursor == null ? 0 : Math.max(0, cursor.offset);
int end = Math.min(paths.size(), offset + limit);
@@ -480,10 +479,6 @@ public final class ZooKeeperAgent {
}
}
- private static boolean shouldHideFromRootListing(String root, String path) {
- return "/".equals(root) && ("/zookeeper".equals(path) || path.startsWith("/zookeeper/"));
- }
-
private static boolean hasTlsOptions(JsonObject connection) {
return boolOrDefault(connection, "ssl", false)
|| firstNonBlank(
diff --git a/agents/drivers/zookeeper/src/test/java/com/dbx/agent/zookeeper/ZooKeeperAgentTest.java b/agents/drivers/zookeeper/src/test/java/com/dbx/agent/zookeeper/ZooKeeperAgentTest.java
index 83ea7d8dd4..9e30769e57 100644
--- a/agents/drivers/zookeeper/src/test/java/com/dbx/agent/zookeeper/ZooKeeperAgentTest.java
+++ b/agents/drivers/zookeeper/src/test/java/com/dbx/agent/zookeeper/ZooKeeperAgentTest.java
@@ -398,7 +398,7 @@ final class ZooKeeperAgentTest {
JsonObject list = result(request(5, "kv_list_prefix", "{\"prefix\":\"/\",\"recursive\":false}"));
- Assertions.assertEquals(List.of("/app", "/config"), listedKeys(list));
+ Assertions.assertEquals(List.of("/app", "/config", "/zookeeper"), listedKeys(list));
Assertions.assertTrue(list.get("continuation").isJsonNull());
}
}
@@ -412,7 +412,10 @@ final class ZooKeeperAgentTest {
JsonObject list = result(request(5, "kv_list_prefix", "{\"prefix\":\"/\"}"));
- Assertions.assertEquals(List.of("/app", "/app/name", "/config"), listedKeys(list));
+ Assertions.assertEquals(
+ List.of("/app", "/app/name", "/config", "/zookeeper", "/zookeeper/config", "/zookeeper/quota"),
+ listedKeys(list)
+ );
Assertions.assertTrue(list.get("continuation").isJsonNull());
}
}
@@ -426,7 +429,10 @@ final class ZooKeeperAgentTest {
JsonObject list = result(request(6, "kv_list_prefix", "{\"prefix\":\"/\",\"recursive\":true}"));
- Assertions.assertEquals(List.of("/app", "/app/name", "/config"), listedKeys(list));
+ Assertions.assertEquals(
+ List.of("/app", "/app/name", "/config", "/zookeeper", "/zookeeper/config", "/zookeeper/quota"),
+ listedKeys(list)
+ );
}
}
@@ -457,11 +463,19 @@ final class ZooKeeperAgentTest {
"kv_list_prefix",
"{\"prefix\":\"/\",\"limit\":2,\"continuation\":\"" + continuation + "\"}"
));
+ String secondContinuation = second.get("continuation").getAsString();
+ JsonObject third = result(request(
+ 7,
+ "kv_list_prefix",
+ "{\"prefix\":\"/\",\"limit\":2,\"continuation\":\"" + secondContinuation + "\"}"
+ ));
Assertions.assertEquals(List.of("/a", "/b"), listedKeys(first));
Assertions.assertFalse(continuation.isBlank());
- Assertions.assertEquals(List.of("/c"), listedKeys(second));
- Assertions.assertTrue(second.get("continuation").isJsonNull());
+ Assertions.assertEquals(List.of("/c", "/zookeeper"), listedKeys(second));
+ Assertions.assertFalse(secondContinuation.isBlank());
+ Assertions.assertEquals(List.of("/zookeeper/config", "/zookeeper/quota"), listedKeys(third));
+ Assertions.assertTrue(third.get("continuation").isJsonNull());
}
}