masteryhx commented on code in PR #19142: URL: https://github.com/apache/flink/pull/19142#discussion_r853015290
########## flink-runtime/src/main/java/org/apache/flink/runtime/state/StateBackendLoader.java: ########## @@ -358,17 +360,51 @@ public static boolean stateBackendFromApplicationOrConfigOrDefaultUseManagedMemo return false; } + /** + * Load state backend which may wrap the original state backend for recovery. + * + * @param originalStateBackend StateBackend loaded from application or config. + * @param classLoader User code classloader. + * @param keyedStateHandles The state handles for restore. + * @return Wrapped state backend for recovery. + * @throws DynamicCodeLoadingException Thrown if keyed state handles of wrapped state backend + * are found and the class was not found or could not be instantiated. + */ + public static StateBackend loadStateBackendFromKeyedStateHandles( + StateBackend originalStateBackend, + ClassLoader classLoader, + Collection<KeyedStateHandle> keyedStateHandles) + throws DynamicCodeLoadingException { + if (keyedStateHandles.stream() + .anyMatch(stateHandle -> stateHandle instanceof ChangelogStateBackendHandle) + && !isChangelogStateBackend(originalStateBackend)) { Review Comment: Agree. I have swapped them. -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org