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 8852388  GEODE-9532: Register LongWrapperSerializer before 
Region.put() (#6799) (#6843)
8852388 is described below

commit 88523888bf83c58301c6c6b2978762ec649fb876
Author: Jianxia Chen <[email protected]>
AuthorDate: Fri Sep 3 12:43:43 2021 -0700

    GEODE-9532: Register LongWrapperSerializer before Region.put() (#6799) 
(#6843)
    
    (cherry picked from commit 10abff6cb6722a56b03305251076c9c78e948dd3)
---
 .../geode/cache30/MultiVMRegionTestCase.java       | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)

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 e4b4e44..2d9a7f2 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
@@ -3814,6 +3814,19 @@ public abstract class MultiVMRegionTestCase extends 
RegionTestCase {
         createRegion(name);
       });
 
+      // Make sure vm0 and vm1 have both registered the LongWrapperSerializer 
after vm2 reconnects
+      // 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();
+      });
+
+      vm1.invoke(() -> {
+        // see the comments in "get" CacheSerializableRunnable above
+        waitForLongWrapperSerializerRegistration();
+      });
+
       vm2.invoke("Put long", () -> {
         Region<Object, Object> region = getRootRegion().getSubregion(name);
         region.put(key2, new LongWrapper(longValue));
@@ -3848,6 +3861,18 @@ public abstract class MultiVMRegionTestCase extends 
RegionTestCase {
     }
   }
 
+  private void waitForLongWrapperSerializerRegistration() {
+    // see the comments in "get" CacheSerializableRunnable in 
testNoDataSerializer()
+    final int savVal = InternalDataSerializer.GetMarker.WAIT_MS;
+    InternalDataSerializer.GetMarker.WAIT_MS = 1;
+    try {
+      await("DataSerializer with id 121 was never registered")
+          .until(() -> InternalDataSerializer.getSerializer((byte) 121) != 
null);
+    } finally {
+      InternalDataSerializer.GetMarker.WAIT_MS = savVal;
+    }
+  }
+
   /**
    * Tests what happens when one VM attempts to read an object for which it 
does not have a
    * registered <code>Instantiator</code>.

Reply via email to