You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by GitBox <gi...@apache.org> on 2019/03/19 12:27:43 UTC

[GitHub] [zookeeper] eolivelli commented on a change in pull request #859: ZOOKEEPER-3323: Add TxnSnapLog metrics

eolivelli commented on a change in pull request #859: ZOOKEEPER-3323: Add TxnSnapLog metrics
URL: https://github.com/apache/zookeeper/pull/859#discussion_r266860647
 
 

 ##########
 File path: zookeeper-server/src/test/java/org/apache/zookeeper/server/persistence/FileTxnSnapLogMetricsTest.java
 ##########
 @@ -0,0 +1,52 @@
+package org.apache.zookeeper.server.persistence;
+
+import org.apache.zookeeper.*;
+import org.apache.zookeeper.server.ServerMetrics;
+import org.apache.zookeeper.server.SyncRequestProcessor;
+import org.apache.zookeeper.test.ClientBase;
+import org.apache.zookeeper.test.QuorumUtil;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+
+import static org.hamcrest.number.OrderingComparison.greaterThan;
+import static org.hamcrest.number.OrderingComparison.greaterThanOrEqualTo;
+
+public class FileTxnSnapLogMetricsTest extends ZKTestCase {
+
+    @Test
+    public void testFileTxnSnapLogMetrics() throws Exception {
+        SyncRequestProcessor.setSnapCount(100);
+
+        QuorumUtil util = new QuorumUtil(1);
+        util.startAll();
+
+        byte[] data = new byte[500];
+        // make sure a snapshot is taken and some txns are not in a snapshot
+        ZooKeeper zk = ClientBase.createZKClient(util.getConnString());
+        for (int i=0; i<150; i++){
+            zk.create("/path" + i, data, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
+        }
+
+        Thread.sleep(500);
 
 Review comment:
   why do we need this sleep ?
   This would be a flaky test in the future,
   can't we wait for a condition ?

----------------------------------------------------------------
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