You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by as...@apache.org on 2015/11/05 23:32:47 UTC

[1/3] incubator-geode git commit: GEODE-526: Fix oplog unit test race condition

Repository: incubator-geode
Updated Branches:
  refs/heads/develop af3199e45 -> b2b2de8b2


GEODE-526: Fix oplog unit test race condition

KRF files are created asynchronously. The test needs to wait for the files to be
created before checking header content.


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

Branch: refs/heads/develop
Commit: 066c11ebdb26fffbdad89d1bf2a045b6cca1fc56
Parents: ee4cc01
Author: Ashvin Agrawal <as...@apache.org>
Authored: Wed Nov 4 13:54:45 2015 -0800
Committer: Ashvin Agrawal <as...@apache.org>
Committed: Wed Nov 4 13:54:45 2015 -0800

----------------------------------------------------------------------
 .../gemstone/gemfire/internal/cache/Oplog.java  |  1 -
 .../gemfire/internal/cache/OplogJUnitTest.java  | 46 +++++++++++---------
 2 files changed, 26 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/066c11eb/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/Oplog.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/Oplog.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/Oplog.java
index f0b33f1..cd197f2 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/Oplog.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/Oplog.java
@@ -107,7 +107,6 @@ import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
 import com.gemstone.gemfire.internal.logging.log4j.LogMarker;
-import com.gemstone.gemfire.internal.offheap.MemoryChunkWithRefCount;
 import com.gemstone.gemfire.internal.offheap.OffHeapHelper;
 import com.gemstone.gemfire.internal.offheap.SimpleMemoryAllocatorImpl;
 import com.gemstone.gemfire.internal.offheap.StoredObject;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/066c11eb/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OplogJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OplogJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OplogJUnitTest.java
index 1fc39bf..433af3d 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OplogJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OplogJUnitTest.java
@@ -27,15 +27,18 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Random;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
-
-import junit.framework.Assert;
+import java.util.stream.IntStream;
 
 import org.apache.commons.io.FileUtils;
 import org.junit.After;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -55,6 +58,7 @@ import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
 import com.gemstone.gemfire.internal.InternalDataSerializer;
 import com.gemstone.gemfire.internal.cache.Oplog.OPLOG_TYPE;
 import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.jayway.awaitility.Awaitility;
 
 import dunit.DistributedTestCase;
 import dunit.DistributedTestCase.WaitCriterion;
@@ -3806,8 +3810,8 @@ public class OplogJUnitTest extends DiskRegionTestingBase
     return sum;
   }
    
-  // disabled - this test frequently fails.  See bug #52213
-  public void disabledtestMagicSeqPresence() throws Exception {
+  @Test
+  public void testMagicSeqPresence() throws Exception {
     final int MAX_OPLOG_SIZE = 200;
     diskProps.setMaxOplogSize(MAX_OPLOG_SIZE);
     diskProps.setPersistBackup(true);
@@ -3815,34 +3819,35 @@ public class OplogJUnitTest extends DiskRegionTestingBase
     diskProps.setSynchronous(true);
     diskProps.setOverflow(false);
     diskProps.setDiskDirsAndSizes(new File[] { dirs[0] }, new int[] { 4000 });
-    region = DiskRegionHelperFactory.getSyncPersistOnlyRegion(cache, diskProps,
-        Scope.LOCAL);
+    region = DiskRegionHelperFactory.getSyncPersistOnlyRegion(cache, diskProps, Scope.LOCAL);
 
-    // at least 3 kinds of files will be verified
-    assertEquals(3, verifyOplogHeader(dirs[0]));
+    // 3 types of oplog files will be verified
+    verifyOplogHeader(dirs[0], ".if", ".crf", ".drf");
 
     try {
       LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER = true;
-      for (int i = 0; i < 10; ++i) {
-        region.put("key-" + i, "value-");
-      }
-      assertEquals(4, verifyOplogHeader(dirs[0]));
+      IntStream.range(0, 20).forEach(i -> region.put("key-" + i, "value-" + i));
+      // krf is created, so 4 types of oplog files will be verified
+      verifyOplogHeader(dirs[0], ".if", ".crf", ".drf", ".krf");
 
       region.close();
-      region = DiskRegionHelperFactory.getSyncPersistOnlyRegion(cache,
-          diskProps, Scope.LOCAL);
+      region = DiskRegionHelperFactory.getSyncPersistOnlyRegion(cache, diskProps, Scope.LOCAL);
 
-      assertEquals(4, verifyOplogHeader(dirs[0]));
+      verifyOplogHeader(dirs[0], ".if", ".crf", ".drf", ".krf");
       region.close();
     } finally {
       LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER = false;
     }
   }
 
-  /*
-   * returns number of types of files verified
-   */
-  private int verifyOplogHeader(File dir) throws IOException {
+  private void verifyOplogHeader(File dir, String ... oplogTypes) throws IOException {
+    
+    Awaitility.await().atMost(5, TimeUnit.SECONDS).until(() -> {
+      List<String> types = new ArrayList<>(Arrays.asList(oplogTypes));
+      Arrays.stream(dir.listFiles()).map(File::getName).map(f -> f.substring(f.indexOf("."))).forEach(types::remove);
+      return types.isEmpty();
+    });
+    
     File[] files = dir.listFiles();
      HashSet<String> verified = new HashSet<String>();
      for (File file : files) {
@@ -3880,7 +3885,8 @@ public class OplogJUnitTest extends DiskRegionTestingBase
        assertEquals("expected a read to return 8 but it returned " + count + " for file " + file, 8, count);
        assertTrue(Arrays.equals(expect, buf));
      }
-    return verified.size();
+     
+     assertEquals(oplogTypes.length, verified.size());
   }
   
    /**


[2/3] incubator-geode git commit: Merge remote-tracking branch 'origin/develop' into feature/GEODE-409

Posted by as...@apache.org.
Merge remote-tracking branch 'origin/develop' into feature/GEODE-409


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

Branch: refs/heads/develop
Commit: eced0c5b1ad2fc4c64242bba459b1ec7b2ada714
Parents: 066c11e af3199e
Author: Ashvin Agrawal <as...@apache.org>
Authored: Thu Nov 5 14:29:10 2015 -0800
Committer: Ashvin Agrawal <as...@apache.org>
Committed: Thu Nov 5 14:29:10 2015 -0800

----------------------------------------------------------------------
 gemfire-assembly/build.gradle                   |   8 +-
 gemfire-common/build.gradle                     |   3 +
 .../gemfire/annotations/Experimental.java       |  40 ++++
 .../annotations/ExperimentalJUnitTest.java      | 183 +++++++++++++++++++
 .../ClassInExperimentalPackage.java             |  11 ++
 .../experimentalpackage/package-info.java       |  11 ++
 .../ClassInNonExperimentalPackage.java          |  11 ++
 .../nonexperimentalpackage/package-info.java    |   8 +
 gemfire-core/build.gradle                       |   1 +
 .../asyncqueue/AsyncEventQueueFactory.java      |   2 +-
 .../MemoryThresholdsOffHeapDUnitTest.java       |  12 +-
 .../tier/sockets/HAInterestPart2DUnitTest.java  |  24 ++-
 gemfire-rebalancer/build.gradle                 |   1 +
 gemfire-spark-connector/doc/1_building.md       |   2 +
 gemfire-web/build.gradle                        |  18 +-
 settings.gradle                                 |   1 +
 16 files changed, 322 insertions(+), 14 deletions(-)
----------------------------------------------------------------------



[3/3] incubator-geode git commit: Merge branch 'feature/GEODE-409' into develop

Posted by as...@apache.org.
Merge branch 'feature/GEODE-409' into develop


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

Branch: refs/heads/develop
Commit: b2b2de8b2945c6f1778c2b20b10448cc6e638538
Parents: af3199e eced0c5
Author: Ashvin Agrawal <as...@apache.org>
Authored: Thu Nov 5 14:31:35 2015 -0800
Committer: Ashvin Agrawal <as...@apache.org>
Committed: Thu Nov 5 14:31:35 2015 -0800

----------------------------------------------------------------------
 .../gemstone/gemfire/internal/cache/Oplog.java  |  1 -
 .../gemfire/internal/cache/OplogJUnitTest.java  | 46 +++++++++++---------
 2 files changed, 26 insertions(+), 21 deletions(-)
----------------------------------------------------------------------