You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2018/06/12 20:10:44 UTC

[GitHub] eolivelli closed pull request #1508: ISSUE-1490 BookieJournalForceTest is flaky

eolivelli closed pull request #1508: ISSUE-1490 BookieJournalForceTest is flaky
URL: https://github.com/apache/bookkeeper/pull/1508
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
index 1da043501..5ab9e9ec7 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
@@ -22,6 +22,7 @@
 package org.apache.bookkeeper.bookie;
 
 import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.MoreObjects;
 import com.google.common.base.Stopwatch;
 import com.google.common.util.concurrent.MoreExecutors;
 
@@ -390,6 +391,17 @@ public int process(boolean shouldForceWrite) throws IOException {
             }
         }
 
+        @Override
+        public String toString() {
+            return MoreObjects.toStringHelper(ForceWriteRequest.class)
+                .add("forceWriteWaiters", forceWriteWaiters)
+                .add("shouldClose", shouldClose)
+                .add("isMarker", isMarker)
+                .add("lastFlushedPosition", lastFlushedPosition)
+                .add("logId", logId)
+                .toString();
+        }
+
         public void closeFileIfNecessary() {
             // Close if shouldClose is set
             if (shouldClose) {
diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieJournalForceTest.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieJournalForceTest.java
index 3a8ad8646..7611b115f 100644
--- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieJournalForceTest.java
+++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieJournalForceTest.java
@@ -302,6 +302,8 @@ public void writeComplete(int rc, long ledgerId, long entryId, BookieSocketAddre
         LinkedBlockingQueue<ForceWriteRequest> supportQueue = new LinkedBlockingQueue<>();
         BlockingQueue<ForceWriteRequest> forceWriteRequests = mock(BlockingQueue.class);
         doAnswer((Answer) (InvocationOnMock iom) -> {
+            log.error("something put {} on journal queue", iom.getArgument(0),
+                    new Exception().fillInStackTrace());
             supportQueue.put(iom.getArgument(0));
             return null;
         }).when(forceWriteRequests).put(any(ForceWriteRequest.class));
@@ -320,6 +322,7 @@ public void testForceLedger() throws Exception {
         Bookie.checkDirectoryStructure(Bookie.getCurrentDirectory(journalDir));
 
         ServerConfiguration conf = TestBKConfiguration.newServerConfiguration();
+        conf.setJournalFlushWhenQueueEmpty(false);
         conf.setJournalDirName(journalDir.getPath());
 
         JournalChannel jc = spy(new JournalChannel(journalDir, 1));
@@ -364,7 +367,8 @@ public void writeComplete(int rc, long ledgerId, long entryId, BookieSocketAddre
 
         verify(jc, atLeast(1)).forceWrite(false);
 
-        assertEquals(0, supportQueue.size());
+        assertEquals("SupportQueue should be empty but was " + supportQueue,
+                0,  supportQueue.size());
 
         // verify that log marker advanced
         LastLogMark lastLogMarkAfterForceWrite = journal.getLastLogMark();


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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