SEPURI-SAI-KRISHNA commented on PR #28161:
URL: https://github.com/apache/flink/pull/28161#issuecomment-5581136749

   `copy()` has the same problem and isn't in the diff. It reaches fields by 
position too, via `avroData.deepCopy(runtimeSchema, from)`, so a record still 
carrying the previous schema fails there the way it did in `serialize()`. On 
master, with the schema pairs your new tests define:
   
   ```java
   AvroSerializer<GenericRecord> s = new AvroSerializer<>(GenericRecord.class, 
A_B_C_D);
   GenericRecord old =
           new GenericRecordBuilder(A_C_D).set("a", "A").set("c", "C").set("d", 
"D").build();
   
   s.copy(old); // ArrayIndexOutOfBoundsException: Index 3 out of bounds for 
length 3
   ```
   
   FIRST_NAME against FIRST_REQUIRED_LAST_OPTIONAL fails the same way. Nothing 
covers it today: `SerializerTestBase#testCopy` only copies records the same 
serializer produced.
   
   It is reachable on HashMapStateBackend. `HeapKeyedStateBackend` leaves 
non-TTL migration until checkpoint time, so restored values sit in the state 
table with the old schema while the new serializer is installed, and 
`CopyOnWriteStateMap` calls `getStateSerializer().copy(e.state)` on 
copy-on-write.
   
   `TypeSerializer#copy` doesn't declare `IOException`, so routing it through 
the same helper would need a `FlinkRuntimeException` wrap.
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to