@Override
    public void toData(PdxWriter writer) {
      if (getVersion() == 3) {
        writer.writeInt("f2", f2);
      }
      writer.writeInt("f1", f1);
      if (getVersion() == 2) {
        writer.writeInt("f2", f2);
      }
    }
Make sure that if a class adds a field that pdx serialization will preserve the extra field.
geode-core/src/integrationTest/java/org/apache/geode/pdx/PdxSerializableJUnitTest.java