[FLINK-37553] Make ForStKeyedStateBackend update NamespaceSerializer during restoring state#26416
Conversation
…during restoring state
| @Nonnull | ||
| public TypeSerializerSchemaCompatibility<N> updateNamespaceSerializer( | ||
| TypeSerializer<N> newNamespaceSerializer) { | ||
| return namespaceSerializerProvider.registerNewSerializerForRestoredState( |
There was a problem hiding this comment.
nit: is the New in the method name required?
registerNewSerializerForRestoredState -> registerSerializerForRestoredState
There was a problem hiding this comment.
Well this is the name of existing interface, we'd better keep this in current PR.
|
|
||
| TypeSerializerSchemaCompatibility<N> s = | ||
| restoredKvStateMetaInfo.updateNamespaceSerializer(namespaceSerializer); | ||
| if (s.isCompatibleAfterMigration() || s.isIncompatible()) { |
There was a problem hiding this comment.
I am curious about the difference between isCompatibleAfterMigration() and isIncompatible(). If the difference is meaningful, should we include these different incompatibilities in the error message to help make the message more useful?
It would even better if the compatibility checks returned the reason for the incompatibility. Maybe throwing an exception in a checkIncompatibility method and construct different messages in the Exception might be better as we then log out the root cause of the incompatibility. WDYT?
There was a problem hiding this comment.
@mayuehappy We could distinguish the messages for two cases. For the isCompatibleAfterMigration, we may say 'The new namespace serializer () can be compatible with the old one () after migration. But ForSt does not support state migration yet.'
There was a problem hiding this comment.
@Zakelly Thanks for the reply. As I remember, NamespaceSerializer should not support migration, even RocksdbStateBackend does. So do we still need to distinguish here?
fredia
left a comment
There was a problem hiding this comment.
@mayuehappy Thanks for the PR, LGTM
…g/apache/flink/state/forst/ForStStateMigrationTest.java Co-authored-by: Yanfei Lei <fredialei@gmail.com>
…during restoring state (apache#26416)
…during restoring state
What is the purpose of the change
Make ForStKeyedStateBackend update NamespaceSerializer during restoring state
Brief change log
updateNamespaceSerializerinRegisteredKeyValueStateBackendMetaInfoVerifying this change
(Please pick either of the following options)
This change is a trivial rework
This change added tests and can be verified as follows:
add unit test ForStStateMigrationTest#testStateNamespaceSerializerChanged
Does this pull request potentially affect one of the following parts:
@Public(Evolving): (no)Documentation