You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bs...@apache.org on 2020/01/06 19:56:26 UTC

[geode] branch feature/GEODE-7649 created (now c11c856)

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

bschuchardt pushed a change to branch feature/GEODE-7649
in repository https://gitbox.apache.org/repos/asf/geode.git.


      at c11c856  GEODE-7649 upgrade tests fail when v1.11 is added to geode-old-versions

This branch includes the following new commits:

     new c11c856  GEODE-7649 upgrade tests fail when v1.11 is added to geode-old-versions

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[geode] 01/01: GEODE-7649 upgrade tests fail when v1.11 is added to geode-old-versions

Posted by bs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bschuchardt pushed a commit to branch feature/GEODE-7649
in repository https://gitbox.apache.org/repos/asf/geode.git

commit c11c856e0b12a409cd48e9f7fab26583e2b189af
Author: Bruce Schuchardt <bs...@pivotal.io>
AuthorDate: Mon Jan 6 11:53:12 2020 -0800

    GEODE-7649 upgrade tests fail when v1.11 is added to geode-old-versions
    
    Geode v1.11 inadvertently changed the form of its saved membership view
    by using a FileOutputStream to write it to disk instead of using
    an ObjectOutputStream.  The latter writes additional information during
    serialization.
    
    Note: there is already a test for this change that will start running
    when v1.12 is created and v1.11 is added as a geode-old-version in
    settings.gradle.
---
 .../internal/membership/gms/locator/GMSLocator.java | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/locator/GMSLocator.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/locator/GMSLocator.java
index 1bcdb43..09b8caf 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/locator/GMSLocator.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/locator/GMSLocator.java
@@ -362,7 +362,7 @@ public class GMSLocator<ID extends MemberIdentifier> implements Locator<ID> {
       oos.writeInt(LOCATOR_FILE_STAMP);
       oos.writeInt(Version.getCurrentVersion().ordinal());
       oos.flush();
-      DataOutputStream dataOutputStream = new DataOutputStream(fileStream);
+      DataOutputStream dataOutputStream = new DataOutputStream(oos);
       objectSerializer.writeObject(view, dataOutputStream);
     } catch (Exception e) {
       logger.warn(
@@ -439,7 +439,8 @@ public class GMSLocator<ID extends MemberIdentifier> implements Locator<ID> {
       return false;
     }
 
-    logger.info("Peer locator recovering from {}", file.getAbsolutePath());
+    logger.info("Peer locator recovering from {} with size {}",
+        file.getAbsolutePath(), file.length());
     try (FileInputStream fileInputStream = new FileInputStream(file);
         ObjectInputStream ois = new ObjectInputStream(fileInputStream)) {
       int stamp = ois.readInt();
@@ -449,15 +450,21 @@ public class GMSLocator<ID extends MemberIdentifier> implements Locator<ID> {
 
       int version = ois.readInt();
       int currentVersion = Version.getCurrentVersion().ordinal();
-      DataInputStream input = new DataInputStream(fileInputStream);
-      if (version != currentVersion) {
+      DataInputStream input;
+      if (version == currentVersion) {
+        input = new DataInputStream(ois);
+      } else if (version > currentVersion) {
+        return false;
+      } else {
         Version geodeVersion = Version.fromOrdinalNoThrow((short) version, false);
         logger.info("Peer locator found that persistent view was written with version {}",
             geodeVersion);
-        if (version > currentVersion) {
-          return false;
+        if (geodeVersion.equals(Version.GEODE_1_11_0)) {
+          // v1.11 did not create the file with an ObjectOutputStream, so don't use one here
+          input = new VersionedDataInputStream(fileInputStream, geodeVersion);
+        } else {
+          input = new VersionedDataInputStream(ois, geodeVersion);
         }
-        input = new VersionedDataInputStream(ois, geodeVersion);
       }
 
       // TBD - services isn't available when we recover from disk so this will throw an NPE