bookkeeper-distributedlog-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From si...@apache.org
Subject incubator-distributedlog git commit: DL-151: TestBKLogReadHandler#testGetFirstDLSNWithOpenLedger is flaky
Date Wed, 28 Dec 2016 00:46:28 GMT
Repository: incubator-distributedlog
Updated Branches:
  refs/heads/master 1503e1994 -> f9a078330


DL-151: TestBKLogReadHandler#testGetFirstDLSNWithOpenLedger is flaky

- Flush/Commit records only after the data are written
- Disable immediate flush
- Reduce num writes from 100 to 10

Author: Sijie Guo <sijieg@twitter.com>

Reviewers: Leigh Stewart <lstewart@apache.org>

Closes #84 from sijie/sijie/FixTestGetFirstDLSNWithOpenLedger


Project: http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/commit/f9a07833
Tree: http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/tree/f9a07833
Diff: http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/diff/f9a07833

Branch: refs/heads/master
Commit: f9a07833052181495b86f2e1ead4166a841cdde8
Parents: 1503e19
Author: Sijie Guo <sijieg@twitter.com>
Authored: Tue Dec 27 16:47:06 2016 -0800
Committer: Sijie Guo <sijie@apache.org>
Committed: Tue Dec 27 16:47:06 2016 -0800

----------------------------------------------------------------------
 .../distributedlog/TestBKLogReadHandler.java       | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/f9a07833/distributedlog-core/src/test/java/com/twitter/distributedlog/TestBKLogReadHandler.java
----------------------------------------------------------------------
diff --git a/distributedlog-core/src/test/java/com/twitter/distributedlog/TestBKLogReadHandler.java
b/distributedlog-core/src/test/java/com/twitter/distributedlog/TestBKLogReadHandler.java
index 51d0552..48c07ed 100644
--- a/distributedlog-core/src/test/java/com/twitter/distributedlog/TestBKLogReadHandler.java
+++ b/distributedlog-core/src/test/java/com/twitter/distributedlog/TestBKLogReadHandler.java
@@ -164,10 +164,10 @@ public class TestBKLogReadHandler extends TestDistributedLogBase {
 
         DistributedLogConfiguration confLocal = new DistributedLogConfiguration();
         confLocal.loadConf(conf);
-        confLocal.setImmediateFlushEnabled(true);
+        confLocal.setImmediateFlushEnabled(false);
         confLocal.setOutputBufferSize(0);
 
-        int numEntriesPerSegment = 100;
+        int numEntriesPerSegment = 10;
         DistributedLogManager dlm1 = createNewDLM(confLocal, dlName);
         long txid = 1;
 
@@ -177,15 +177,14 @@ public class TestBKLogReadHandler extends TestDistributedLogBase {
             futures.add(out.write(DLMTestUtil.getLogRecordInstance(txid)));
             ++txid;
         }
-        for (Future<DLSN> future : futures) {
-            Await.result(future);
-        }
-
-        BKLogReadHandler readHandler =
-            ((BKDistributedLogManager) dlm1).createReadHandler();
+        FutureUtils.result(Future.collect(futures));
+        // commit
+        LogRecord controlRecord = new LogRecord(txid, DistributedLogConstants.CONTROL_RECORD_CONTENT);
+        controlRecord.setControl();
+        FutureUtils.result(out.write(controlRecord));
 
         DLSN last = dlm1.getLastDLSN();
-        assertEquals(new DLSN(1,99,0), last);
+        assertEquals(new DLSN(1,9,0), last);
         DLSN first = Await.result(dlm1.getFirstDLSNAsync());
         assertEquals(new DLSN(1,0,0), first);
         Utils.close(out);


Mime
View raw message