You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by ma...@apache.org on 2021/06/13 07:31:03 UTC
[zookeeper] branch master updated: ZOOKEEPER-3821: Improve
getSnapCount and getGlobalOutstandingLimit
This is an automated email from the ASF dual-hosted git repository.
maoling 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 32e40e8 ZOOKEEPER-3821: Improve getSnapCount and getGlobalOutstandingLimit
32e40e8 is described below
commit 32e40e8cee36ddba1973875ab6637912719271fa
Author: dengliming <li...@gmail.com>
AuthorDate: Sun Jun 13 15:30:41 2021 +0800
ZOOKEEPER-3821: Improve getSnapCount and getGlobalOutstandingLimit
Author: dengliming <li...@gmail.com>
Reviewers: Enrico Olivelli <eo...@apache.org>, Andor Molnar <an...@apache.org>, maoling <ma...@apache.org>
Closes #1352 from dengliming/ZOOKEEPER-3821
---
.../apache/zookeeper/server/ZooKeeperServer.java | 29 +++++++---------------
1 file changed, 9 insertions(+), 20 deletions(-)
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 6a42417..aeeebb9 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
@@ -194,6 +194,8 @@ public class ZooKeeperServer implements SessionExpirer, ServerStats.Provider {
protected String initialConfig;
protected boolean reconfigEnabled;
private final RequestPathMetricsCollector requestPathMetricsCollector;
+ private static final int DEFAULT_SNAP_COUNT = 100000;
+ private static final int DEFAULT_GLOBAL_OUTSTANDING_LIMIT = 1000;
private boolean localSessionEnabled = false;
protected enum State {
@@ -1183,30 +1185,17 @@ public class ZooKeeperServer implements SessionExpirer, ServerStats.Provider {
}
public static int getSnapCount() {
- String sc = System.getProperty(SNAP_COUNT);
- try {
- int snapCount = Integer.parseInt(sc);
-
- // snapCount must be 2 or more. See org.apache.zookeeper.server.SyncRequestProcessor
- if (snapCount < 2) {
- LOG.warn("SnapCount should be 2 or more. Now, snapCount is reset to 2");
- snapCount = 2;
- }
- return snapCount;
- } catch (Exception e) {
- return 100000;
+ int snapCount = Integer.getInteger(SNAP_COUNT, DEFAULT_SNAP_COUNT);
+ // snapCount must be 2 or more. See org.apache.zookeeper.server.SyncRequestProcessor
+ if (snapCount < 2) {
+ LOG.warn("SnapCount should be 2 or more. Now, snapCount is reset to 2");
+ snapCount = 2;
}
+ return snapCount;
}
public int getGlobalOutstandingLimit() {
- String sc = System.getProperty(GLOBAL_OUTSTANDING_LIMIT);
- int limit;
- try {
- limit = Integer.parseInt(sc);
- } catch (Exception e) {
- limit = 1000;
- }
- return limit;
+ return Integer.getInteger(GLOBAL_OUTSTANDING_LIMIT, DEFAULT_GLOBAL_OUTSTANDING_LIMIT);
}
public static long getSnapSizeInBytes() {