Removed Error Log to Avoid Spam Logging (#2201)
Removed an unnecessary and misleading error log in ZkClient. This cleans up the logging and avoids clutter.
diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkBaseDataAccessor.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkBaseDataAccessor.java
index 0ce99d5..40abb2a 100644
--- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkBaseDataAccessor.java
+++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkBaseDataAccessor.java
@@ -434,6 +434,36 @@
}
@Test
+ public void testDeleteNodeWithChildren() {
+ String root = _rootPath;
+
+ ZkBaseDataAccessor<ZNRecord> accessor = new ZkBaseDataAccessor<>(_gZkClient);
+
+ // CreateChildren
+ List<ZNRecord> records = new ArrayList<>();
+ List<String> paths = new ArrayList<>();
+ for (int i = 0; i < 10; i++) {
+ String msgId = "msg_" + i;
+ paths.add(PropertyPathBuilder.instanceMessage(root, "host_1", msgId));
+ records.add(new ZNRecord(msgId));
+ }
+ boolean[] success = accessor.createChildren(paths, records, AccessOption.PERSISTENT);
+
+ // Attempt to remove parent. Shouldn't throw an error or warning log.
+ // Should return True if recursive deletion succeeds.
+ Assert.assertTrue(accessor.remove(PropertyPathBuilder.instanceMessage(root, "host_1"), 0),
+ "Should return True despite log errors.");
+
+ // Assert child message nodes were removed when calling remove on parent
+ for (int i = 0; i < 10; i++) {
+ String msgId = "msg_" + i;
+ String path = PropertyPathBuilder.instanceMessage(root, "host_1", msgId);
+ boolean pathExists = _gZkClient.exists(path);
+ Assert.assertFalse(pathExists, "Message znode should have been removed by accessor msgId=" + msgId);
+ }
+ }
+
+ @Test
public void testSyncGet() {
String className = TestHelper.getTestClassName();
String methodName = TestHelper.getTestMethodName();
diff --git a/zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java b/zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java
index e483265..a24a098 100644
--- a/zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java
+++ b/zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java
@@ -2066,14 +2066,11 @@
success = true;
} catch (ZkNoNodeException e) {
success = false;
- if (LOG.isDebugEnabled()) {
- LOG.debug("zkclient {}, Failed to delete path {}, znode does not exist!", _uid, path);
- }
+ LOG.debug("zkclient {}, Failed to delete path {}, znode does not exist!", _uid, path);
}
record(path, null, startT, ZkClientMonitor.AccessType.WRITE);
} catch (Exception e) {
recordFailure(path, ZkClientMonitor.AccessType.WRITE);
- LOG.warn("zkclient {}, Failed to delete path {}! ", _uid, path, e);
throw e;
} finally {
long endT = System.currentTimeMillis();