You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by an...@apache.org on 2019/05/20 10:24:58 UTC

[zookeeper] branch master updated: ZOOKEEPER-3396: Flaky test in RestoreCommittedLogTest

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

andor 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 1264e9f  ZOOKEEPER-3396: Flaky test in RestoreCommittedLogTest
1264e9f is described below

commit 1264e9f2ba8e8724a9352387b22e784716816722
Author: Brian Nixon <ni...@fb.com>
AuthorDate: Mon May 20 12:24:52 2019 +0200

    ZOOKEEPER-3396: Flaky test in RestoreCommittedLogTest
    
    Adjusting parameters of RestoreCommittedLogTest to avoid failures caused by threshold configured to be below the minimum allowed file size
    
    Author: Brian Nixon <ni...@fb.com>
    
    Reviewers: eolivelli@apache.org, andor@apache.org
    
    Closes #949 from enixon/patch-snap-size
---
 zookeeper-docs/src/main/resources/markdown/zookeeperAdmin.md       | 6 ++++--
 .../java/org/apache/zookeeper/test/RestoreCommittedLogTest.java    | 7 +++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/zookeeper-docs/src/main/resources/markdown/zookeeperAdmin.md b/zookeeper-docs/src/main/resources/markdown/zookeeperAdmin.md
index 9996db9..1c8b9fd 100644
--- a/zookeeper-docs/src/main/resources/markdown/zookeeperAdmin.md
+++ b/zookeeper-docs/src/main/resources/markdown/zookeeperAdmin.md
@@ -636,8 +636,10 @@ property, when available, is noted below.
     from taking a snapshot at the same time, each ZooKeeper server
     will take a snapshot when the size in bytes of the set of transactions in the
     transaction log reaches a runtime generated random value in the \[snapSize/2+1, snapSize]
-    range. The default snapSizeLimitInKb is 4,194,304 (4GB). A non-positive
-    value will disable the feature.
+    range. Each file system has a minimum standard file size and in order
+    to for valid functioning of this feature, the number chosen must be larger
+    than that value. The default snapSizeLimitInKb is 4,194,304 (4GB).
+    A non-positive value will disable the feature.
 
 * *txnLogSizeLimitInKb* :
     (Java system property: **zookeeper.txnLogSizeLimitInKb**)
diff --git a/zookeeper-server/src/test/java/org/apache/zookeeper/test/RestoreCommittedLogTest.java b/zookeeper-server/src/test/java/org/apache/zookeeper/test/RestoreCommittedLogTest.java
index e630b85..7425561 100644
--- a/zookeeper-server/src/test/java/org/apache/zookeeper/test/RestoreCommittedLogTest.java
+++ b/zookeeper-server/src/test/java/org/apache/zookeeper/test/RestoreCommittedLogTest.java
@@ -53,7 +53,7 @@ public class RestoreCommittedLogTest extends ZKTestCase{
     @Test
     public void testRestoreCommittedLogWithSnapSize() throws Exception {
         final int minExpectedSnapshots = 5;
-        final int minTxnsToSnap = 40;
+        final int minTxnsToSnap = 256;
         final int numTransactions = minExpectedSnapshots * minTxnsToSnap;
         final StringBuilder sb = new StringBuilder();
         for (int i = 0; i < 4*1024; i++) {
@@ -61,7 +61,10 @@ public class RestoreCommittedLogTest extends ZKTestCase{
         }
         final byte[] data = sb.toString().getBytes();
 
-        SyncRequestProcessor.setSnapCount(numTransactions * 1000);
+        SyncRequestProcessor.setSnapCount(numTransactions * 1000 /* just some high number */);
+        // The test breaks if this number is less than the smallest size file
+        // created on the system, as revealed through File::length.
+        // Setting to about 1 Mb.
         SyncRequestProcessor.setSnapSizeInBytes(minTxnsToSnap * data.length);
 
         testRestoreCommittedLog(numTransactions, data, minExpectedSnapshots);