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

jchen21 pushed a commit to branch support/1.14
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/support/1.14 by this push:
     new eeed28b  GEODE-9583: Flush the disk stores before unregistering all 
serializers (#6854)
eeed28b is described below

commit eeed28b7563fe702fcf1588b668299bc71b23eec
Author: Jianxia Chen <[email protected]>
AuthorDate: Wed Sep 15 11:04:43 2021 -0700

    GEODE-9583: Flush the disk stores before unregistering all serializers 
(#6854)
    
    (cherry picked from commit 0a579bde6777cfd75654a59527b5ea3dc37af550)
---
 .../geode/cache30/MultiVMRegionTestCase.java       | 26 ++++++++++++++++------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git 
a/geode-dunit/src/main/java/org/apache/geode/cache30/MultiVMRegionTestCase.java 
b/geode-dunit/src/main/java/org/apache/geode/cache30/MultiVMRegionTestCase.java
index 2d9a7f2..3ca71f9 100644
--- 
a/geode-dunit/src/main/java/org/apache/geode/cache30/MultiVMRegionTestCase.java
+++ 
b/geode-dunit/src/main/java/org/apache/geode/cache30/MultiVMRegionTestCase.java
@@ -96,6 +96,7 @@ import org.apache.geode.internal.AvailablePortHelper;
 import org.apache.geode.internal.HeapDataOutputStream;
 import org.apache.geode.internal.InternalDataSerializer;
 import org.apache.geode.internal.InternalInstantiator;
+import org.apache.geode.internal.cache.DiskStoreImpl;
 import org.apache.geode.internal.cache.EntryExpiryTask;
 import org.apache.geode.internal.cache.ExpiryTask;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
@@ -107,6 +108,7 @@ import org.apache.geode.internal.cache.TXManagerImpl;
 import org.apache.geode.internal.cache.TXStateProxy;
 import org.apache.geode.internal.cache.Token;
 import org.apache.geode.internal.cache.TombstoneService;
+import org.apache.geode.internal.cache.persistence.DiskRecoveryStore;
 import org.apache.geode.internal.cache.versions.RegionVersionVector;
 import org.apache.geode.internal.cache.versions.VersionSource;
 import org.apache.geode.internal.cache.versions.VersionTag;
@@ -3818,14 +3820,12 @@ public abstract class MultiVMRegionTestCase extends 
RegionTestCase {
       // and before vm2 puts any instance of LongWrapper in the region
       // This is to avoid async disk store FlusherThread serializing any 
instance of LongWrapper
       // before the LongWrapperSerializer is registered
-      vm0.invoke(() -> {
-        waitForLongWrapperSerializerRegistration();
-      });
+      vm0.invoke("waitForLongWrapperSerializerRegistration",
+          this::waitForLongWrapperSerializerRegistration);
 
-      vm1.invoke(() -> {
-        // see the comments in "get" CacheSerializableRunnable above
-        waitForLongWrapperSerializerRegistration();
-      });
+      // see the comments in "get" CacheSerializableRunnable above
+      vm1.invoke("waitForLongWrapperSerializerRegistration",
+          this::waitForLongWrapperSerializerRegistration);
 
       vm2.invoke("Put long", () -> {
         Region<Object, Object> region = getRootRegion().getSubregion(name);
@@ -3857,10 +3857,22 @@ public abstract class MultiVMRegionTestCase extends 
RegionTestCase {
       // responses.
     } finally {
       Wait.pause(1500);
+      Stream.of(vm0, vm1, vm2).forEach(vm -> vm.invoke("Flush disk store",
+          () -> flushDiskStore(name)));
       unregisterAllSerializers();
     }
   }
 
+  private void flushDiskStore(String name) {
+    if (getRootRegion() != null && getRootRegion().getSubregion(name) != null) 
{
+      DiskStoreImpl diskStore =
+          ((DiskRecoveryStore) 
getRootRegion().getSubregion(name)).getDiskStore();
+      if (diskStore != null) {
+        diskStore.flush();
+      }
+    }
+  }
+
   private void waitForLongWrapperSerializerRegistration() {
     // see the comments in "get" CacheSerializableRunnable in 
testNoDataSerializer()
     final int savVal = InternalDataSerializer.GetMarker.WAIT_MS;

Reply via email to