You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/01/27 20:01:27 UTC

[GitHub] igalshilman opened a new pull request #7580: [FLINK-11436] Fix Java deserialization failure of the AvroSerializer

igalshilman opened a new pull request #7580: [FLINK-11436] Fix Java deserialization failure of the AvroSerializer
URL: https://github.com/apache/flink/pull/7580
 
 
   ## What is the purpose of the change
   
   During the release of Flink-1.7 the value of `AvroSerializer.serialVersionUID` was uptick to 2 (was 1 before)
   And although the AvroSerializer (along with it's snapshot class) were migrated to the new serialization
   abstraction (hence free of Java serialization), there were composite serializers that were not migrated and were serialized with Java serialization.
   
   In case that one of the nested serializers were Avro we would bump into deserialization exception due to a wrong `serialVersionUID`. 
   
   Unfortunately it is not possible to revert the `serialVersionUID` back to 1, because users might have snapshots with `serialVersionUID = 2` present already.
   To overcome this we first need to make sure that the `AvroSerializer` is being Java deserialized with `FailureTolerantObjectInputStream`, and then we determine the serialized layout by looking at the fields in `readObject`: 
   
   ```		
   pre 1.7 	field order (left to right):   	[schemaString, 	type]
   post 1.7 	field order (left to right):	[previousSchema,	schema,		type]
   ```
   
   We would use the first field to distinguish between the two different layouts.
   To complicate things even further in pre 1.7, the field @schemaString could be
   null or a string, but, in post 1.7, the field @previousSchema was never set to null, therefore
   we can use the first field to determine the version.
   
   ## Brief change log
   
   * 0225979548 Add the `AvroSerializer` to the list of serializers that we ignore `serialVersionUID` mismatches for.
   * 5045a5a46a Minor refactoring to enable creating a `SerializedAvroSchema` from a `schemaString`
   * 9aef45c569 Explicitly reading the fields in `AvroSerializer#readObject`.
   
   ## Verifying this change
   
   The changes are covered with `AvroSerializerMigrationTest`.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (yes / **no**)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / **no**)
     - The serializers: (**yes** / no / don't know)
     - The runtime per-record code paths (performance sensitive): (yes / **no** / don't know)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (yes / **no** / don't know)
     - The S3 file system connector: (yes / **no** / don't know)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (yes / **no**)
     - If yes, how is the feature documented? (**not applicable** / docs / JavaDocs / not documented)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services