carp84 opened a new pull request #8570: [FLINK-11987] [state] Make serializer 
lazy initialization thread safe in StateDescriptor
URL: https://github.com/apache/flink/pull/8570
 
 
   ## What is the purpose of the change
   
   This PR aims at making the lazy initialization of 
`StateDescriptor.serializer` thread safe, more details about what problem there 
will be w/o the fix please refer to 
[JIRA](https://issues.apache.org/jira/browse/FLINK-11987).
   
   This PR supersedes [PR#8331](https://github.com/apache/flink/pull/8331) as 
per discussed there.
   
   ## Brief change log
   
   Changes mainly inlcude:
   * Use CAS when lazily initializing `serializer` in 
`StateDescriptor#initializeSerializerUnlessSet`, to make sure only one 
serializer will be used.
   * Remove the nullify of `typeInfo` in 
`StateDescriptor#initializeSerializerUnlessSet` to prevent NPE as observed in 
`FlinkKafkaProducer011` from jira description.
   * Added a new UT case in `StateDescriptorTest` to reproduce the problem and 
verify the fix.
   
   
   ## Verifying this change
   
   Added a `testSerializerLazyInitializeInParallel` test case in 
`StateDescriptorTest` for verification.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: (yes)
        - `StateDescriptor` is annotated with `@PublicEvolving` while changes 
here don't involve any modification on method/interface signatures.
     - The serializers: (yes)
        - The change here assures only one single serializer instance will be 
returned by `StateDescriptor.getSerializer` after lazy initialization while 
previously no such assurance.
     - The runtime per-record code paths (performance sensitive): (no)
     - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Yarn/Mesos, ZooKeeper: (no)
     - The S3 file system connector: (no)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (no)
     - If yes, how is the feature documented? (not applicable)
   

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


With regards,
Apache Git Services

Reply via email to