Repository: helix Updated Branches: refs/heads/helix-0.6.x e89174053 -> e2e3fec2d
[HELIX-559] Fix Helix web admin performance issues, add missing a test Project: http://git-wip-us.apache.org/repos/asf/helix/repo Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/e2e3fec2 Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/e2e3fec2 Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/e2e3fec2 Branch: refs/heads/helix-0.6.x Commit: e2e3fec2daaba859f8b9ff40c9bb08720f63db02 Parents: e891740 Author: zzhang <[email protected]> Authored: Mon Dec 15 13:17:01 2014 -0800 Committer: zzhang <[email protected]> Committed: Mon Dec 15 13:17:01 2014 -0800 ---------------------------------------------------------------------- .../webapp/resources/TestResourceUtil.java | 42 ++++++++++++++++++++ .../helix/manager/zk/ZkAsyncCallbacks.java | 4 +- 2 files changed, 44 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/helix/blob/e2e3fec2/helix-admin-webapp/src/test/java/org/apache/helix/webapp/resources/TestResourceUtil.java ---------------------------------------------------------------------- diff --git a/helix-admin-webapp/src/test/java/org/apache/helix/webapp/resources/TestResourceUtil.java b/helix-admin-webapp/src/test/java/org/apache/helix/webapp/resources/TestResourceUtil.java new file mode 100644 index 0000000..06eac49 --- /dev/null +++ b/helix-admin-webapp/src/test/java/org/apache/helix/webapp/resources/TestResourceUtil.java @@ -0,0 +1,42 @@ +package org.apache.helix.webapp.resources; + + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +import org.apache.helix.model.IdealState; +import org.apache.helix.webapp.resources.ClusterRepresentationUtil; +import org.apache.helix.webapp.resources.ResourceUtil; +import org.testng.Assert; +import org.testng.annotations.Test; + +public class TestResourceUtil { + + @Test + public void testReadSimpleFieldWithoutDer() throws Exception { + IdealState idealState = new IdealState("MyDB"); + idealState.setInstanceGroupTag("MyTag"); + String recordStr = ClusterRepresentationUtil.ZNRecordToJson(idealState.getRecord()); + String value = + ResourceUtil.extractSimpleFieldFromZNRecord(recordStr, + IdealState.IdealStateProperty.INSTANCE_GROUP_TAG.toString()); + Assert.assertEquals(value, "MyTag"); + } +} http://git-wip-us.apache.org/repos/asf/helix/blob/e2e3fec2/helix-core/src/main/java/org/apache/helix/manager/zk/ZkAsyncCallbacks.java ---------------------------------------------------------------------- diff --git a/helix-core/src/main/java/org/apache/helix/manager/zk/ZkAsyncCallbacks.java b/helix-core/src/main/java/org/apache/helix/manager/zk/ZkAsyncCallbacks.java index 755ca52..a0279ff 100644 --- a/helix-core/src/main/java/org/apache/helix/manager/zk/ZkAsyncCallbacks.java +++ b/helix-core/src/main/java/org/apache/helix/manager/zk/ZkAsyncCallbacks.java @@ -123,8 +123,8 @@ public class ZkAsyncCallbacks { int _rc = -1; public void callback(int rc, String path, Object ctx) { - if (rc != 0) { - LOG.warn(this + ", rc:" + Code.get(rc) + ", path: " + path); + if (rc != 0 && LOG.isDebugEnabled()) { + LOG.debug(this + ", rc:" + Code.get(rc) + ", path: " + path); } _rc = rc; handle();
