When upgrading from Flink 1.5.3 to Flink 1.7.0, the migration of broadcast state throws the following error:
The broadcast is using a MapState with StringSerializer as key serializer and a custom JsonSerializer as value serializer.
There was no changes in the TypeSerializers used, only upgrade of version.
With some debugging I see that at the moment of the validation of the compatibility of states in the DefaultOperatorStateBackend class, the "registeredBroadcastStates" containing the data about the 'old' state, contains wrong association of the key and value serializer. This is, JsonSerializer appears as key serializer and StringSerializer appears as value serializer. (when it should be the contrary)
After more digging, I see that the "OperatorBackendStateMetaInfoReaderV2V3" class is the responsible of this swap here: