You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2019/09/05 21:44:52 UTC

[GitHub] [zookeeper] hanm commented on a change in pull request #1034: ZOOKEEPER-3491 Specify commitLogCount value using a system property

hanm commented on a change in pull request #1034: ZOOKEEPER-3491 Specify commitLogCount value using a system property
URL: https://github.com/apache/zookeeper/pull/1034#discussion_r321496783
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/ZKDatabase.java
 ##########
 @@ -120,6 +124,23 @@ public ZKDatabase(FileTxnSnapLog snapLog) {
             snapshotSizeFactor = DEFAULT_SNAPSHOT_SIZE_FACTOR;
         }
         LOG.info("{} = {}", SNAPSHOT_SIZE_FACTOR, snapshotSizeFactor);
+
+        try {
+            commitLogCount = Integer.parseInt(
+                    System.getProperty(COMMIT_LOG_COUNT,
+                            Integer.toString(DEFAULT_COMMIT_LOG_COUNT)));
+            if (commitLogCount < DEFAULT_COMMIT_LOG_COUNT) {
+                commitLogCount = DEFAULT_COMMIT_LOG_COUNT;
+                LOG.warn("The configured {} is less than the recommended {}" +
+                                ", going to use the recommended one",
+                        COMMIT_LOG_COUNT, DEFAULT_COMMIT_LOG_COUNT);
+            }
+        } catch (NumberFormatException e) {
+            LOG.error("Error parsing {} - use default value {}",
+                    COMMIT_LOG_COUNT, DEFAULT_COMMIT_LOG_COUNT);
+            commitLogCount = DEFAULT_COMMIT_LOG_COUNT;
+        }
+        LOG.info(COMMIT_LOG_COUNT + "=" + commitLogCount);
 
 Review comment:
   nit about log format: `LOG.info("{}={}", COMMIT_LOG_COUNT, commitLogCount);` (thanks to @enixon who taught me this recently).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services