Hi Juan Jose, I think Alberto is asking about how the check is done, not about why its done. The method he is asking about is mixing the two ways we know for handling backward compatibility. One is creating the "toDataPre_GEODE_X_X_X" and "fromDataPre_GEODE_X_X_X" methods. And the other one is using ifs to check the versions. But this method is mixing both of them.
BR/ Alberto B. ________________________________ De: Ju@N <jujora...@gmail.com> Enviado: martes, 19 de mayo de 2020 14:54 Para: dev@geode.apache.org <dev@geode.apache.org> Asunto: Re: Question about version checks inside fromData method in GatewaySenderEventImpl Hello Alberto, It looks like the property *isConcurrencyConflict* was added as part of *GEODE-3967* [1] and this was released as part of Geode 1.9.0; that seems to the reason why the check is in place: if we get an instance of *GatewaySenderEventImpl* from a member running a version higher than 1.9.0 then we are 100% sure that the serialized form will contain the new field so we can parse it, if the serialized *GatewaySenderEventImpl *comes from an older member the filed won't be there so we don't even try to parse it. Hope I didn't miss anything. Cheers. [1]: https://issues.apache.org/jira/browse/GEODE-3967 On Tue, 19 May 2020 at 13:14, Alberto Gomez <alberto.go...@est.tech> wrote: > Hi, > > Looking at the fromData method of GatewaySenderEventImpl I see that it > contains a conditional reading of the isConcurrencyConflict when version is > greater than Geode 1.9.0 one. See below: > > @Override > public void fromData(DataInput in, > DeserializationContext context) throws IOException, > ClassNotFoundException { > fromDataPre_GEODE_1_9_0_0(in, context); > if (version >= Version.GEODE_1_9_0.ordinal()) { > this.isConcurrencyConflict = DataSerializer.readBoolean(in); > } > } > > I have looked at the implementation of this method in other classes and > have not seen this checking of version pattern. I have also observed that > if the "if" is removed some backward compatibility tests fail. > > Could anybody tell me why this check (the if) is necessary given that > there is already a fromDataPre_GEODE_1_9_0 method in the class? > > Thanks in advance, > > -Alberto G. > -- Ju@N