never mind, please disregard the last email, the current code works fine.
I went through the code, it seems that "doc" is also compared . but the doc says http://avro.apache.org/docs/1.5.1/spec.html#Schema+Resolution "A schema's "doc" fields are ignored for the purposes of schema resolution. Hence, the "doc" portion of a schema may be dropped at serialization." On Fri, Aug 19, 2011 at 4:49 PM, Yang <[email protected]> wrote: > now I rely on schema resolution to enable my server to move onto a > newer schema, while allowing clients to keeping using > old schemas for a while. > > when the server moves onto a newer schema, if I do not change the > schema name, and hence the class name of the generated classes, > old clients think that they are seeing the same schema, so schema > resolution does not take place (correct me if I'm wrong here, but I > remember the rule for schema resolution to happen is that both package > name and class name must be the same). > > so when I move to newer schema, I create a new package (namespace in > avro), and move the old schema into the new package , > > for example, I have > > com.mycompany.v1.MyAvroRecord > .v2.MyAvroRecord > ...... > > so every time I evolve, I just modify the schema, recompile. but I > have to modify all the "import" code in my server. > > > it would be easier if we modify the resolution triggering rule so that > every class has a serial number, and as long as serial number is > different, schema resolution is required. this way,server code does > not need to be modified with a new "import com.mycompany.v2.* " on > every schema version increase. > > Thanks > Yang >
