This is an automated email from the ASF dual-hosted git repository.

nealsun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git


The following commit(s) were added to refs/heads/master by this push:
     new 70e9b4b42 Removed Error Log to Avoid Spam Logging (#2201)
70e9b4b42 is described below

commit 70e9b4b42e835de81f1941004016b3185907264e
Author: Marcosrico <[email protected]>
AuthorDate: Tue Sep 13 13:07:35 2022 -0400

    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.
---
 .../helix/manager/zk/TestZkBaseDataAccessor.java   | 30 ++++++++++++++++++++++
 .../apache/helix/zookeeper/zkclient/ZkClient.java  |  5 +---
 2 files changed, 31 insertions(+), 4 deletions(-)

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 0ce99d59e..40abb2aee 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
@@ -433,6 +433,36 @@ public class TestZkBaseDataAccessor extends ZkUnitTestBase 
{
     System.out.println("END " + testName + " at " + new 
Date(System.currentTimeMillis()));
   }
 
+  @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();
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 e4832656b..a24a098dd 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 @@ public class ZkClient implements Watcher {
         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();

Reply via email to