You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by ha...@apache.org on 2020/10/21 03:13:52 UTC
[zookeeper] branch master updated: ZOOKEEPER-3722: make logs of
ResponseCache more readable
This is an automated email from the ASF dual-hosted git repository.
hanm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zookeeper.git
The following commit(s) were added to refs/heads/master by this push:
new e453497 ZOOKEEPER-3722: make logs of ResponseCache more readable
e453497 is described below
commit e4534976898520b5c334a55761672dc03dff5727
Author: Nishanth Entoor <en...@gmail.com>
AuthorDate: Tue Oct 20 20:13:42 2020 -0700
ZOOKEEPER-3722: make logs of ResponseCache more readable
As per [ZOOKEEPER-3722](https://issues.apache.org/jira/browse/ZOOKEEPER-3722), we need to make ResponseCache logs more readable by adding the request type to the logs. For this I made the following changes:
- Added a parameter named requestType to ResponseCache constructor.
- Passed requestType as getData and getChild when the constructor is called to initialize readResponseCache and getChildrenResponseCache respectively.
Please let me know if additional changes are required.
Author: Nishanth Entoor <en...@gmail.com>
Reviewers: hanm, HorizonNet, maoling
Closes #1253 from nishanth-entoor/ZOOKEEPER-3722
---
.../src/main/java/org/apache/zookeeper/server/ResponseCache.java | 4 ++--
.../src/main/java/org/apache/zookeeper/server/ZooKeeperServer.java | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/server/ResponseCache.java b/zookeeper-server/src/main/java/org/apache/zookeeper/server/ResponseCache.java
index 4a76a0f..5c74caa 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/server/ResponseCache.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/server/ResponseCache.java
@@ -39,10 +39,10 @@ public class ResponseCache {
private final Map<String, Entry> cache;
- public ResponseCache(int cacheSize) {
+ public ResponseCache(int cacheSize, String requestType) {
this.cacheSize = cacheSize;
cache = Collections.synchronizedMap(new LRUCache<>(cacheSize));
- LOG.info("Response cache size is initialized with value {}.", cacheSize);
+ LOG.info("{} response cache size is initialized with value {}.", requestType, cacheSize);
}
public int getCacheSize() {
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperServer.java b/zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperServer.java
index 00550be..d277851 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperServer.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperServer.java
@@ -327,11 +327,11 @@ public class ZooKeeperServer implements SessionExpirer, ServerStats.Provider {
readResponseCache = new ResponseCache(Integer.getInteger(
GET_DATA_RESPONSE_CACHE_SIZE,
- ResponseCache.DEFAULT_RESPONSE_CACHE_SIZE));
+ ResponseCache.DEFAULT_RESPONSE_CACHE_SIZE), "getData");
getChildrenResponseCache = new ResponseCache(Integer.getInteger(
GET_CHILDREN_RESPONSE_CACHE_SIZE,
- ResponseCache.DEFAULT_RESPONSE_CACHE_SIZE));
+ ResponseCache.DEFAULT_RESPONSE_CACHE_SIZE), "getChildren");
this.initialConfig = initialConfig;