Source:
<code>public Set<String> initialize() { try { if (!stateDirectory.lockGlobalState()) { throw new LockException(String.format("Failed to lock the global state directory: %s", baseDir)); } } catch (final IOException e) { throw new LockException(String.format("Failed to lock the global state directory: %s", baseDir), e); } try { checkpointFileCache.putAll(checkpointFile.read()); } catch (final IOException e) { try { stateDirectory.unlockGlobalState(); } catch (final IOException e1) { log.error("Failed to unlock the global state directory", e); } throw new StreamsException("Failed to read checkpoints for global state globalStores", e); } final List<StateStore> stateStores = topology.globalStateStores(); <START> final Map<String, String> storeNameToTopic = topology.storeToChangelogTopic(); <END> final Set<String> stateStoreTopics = new HashSet<>(); for (final StateStore stateStore : stateStores) { globalStoreNames.add(stateStore.name()); final String sourceTopic = storeNameToTopic.get(stateStore.name()); stateStoreTopics.add(sourceTopic); stateStore.init(globalProcessorContext, stateStore); } checkpointFileCache.keySet().forEach(tp -> { if (!stateStoreTopics.contains(tp.topic())) { log.error("Encountered a topic-partition in the global checkpoint file not associated with any global" + " state store, topic-partition: {}, checkpoint file: {}. If this topic-partition is no longer valid," + " an application reset and state store directory cleanup will be required.", tp.topic(), checkpointFile.toString()); try { stateDirectory.unlockGlobalState(); } catch (final IOException e) { log.error("Failed to unlock the global state directory", e); } throw new StreamsException("Encountered a topic-partition not associated with any global state store"); } }); return Collections.unmodifiableSet(globalStoreNames); }</code><technical_language>Nit: storeNameToTopic -> storeNameToChangelog</technical_language>

Target:
public Set<String> initialize() { try { if (!stateDirectory.lockGlobalState()) { throw new LockException(String.format("Failed to lock the global state directory: %s", baseDir)); } } catch (final IOException e) { throw new LockException(String.format("Failed to lock the global state directory: %s", baseDir), e); } try { checkpointFileCache.putAll(checkpointFile.read()); } catch (final IOException e) { try { stateDirectory.unlockGlobalState(); } catch (final IOException e1) { log.error("Failed to unlock the global state directory", e); } throw new StreamsException("Failed to read checkpoints for global state globalStores", e); } final List<StateStore> stateStores = topology.globalStateStores(); final Map<String, String> storeNameToChangelog = topology.storeToChangelogTopic(); final Set<String> changelogTopics = new HashSet<>(); for (final StateStore stateStore : stateStores) { globalStoreNames.add(stateStore.name()); final String sourceTopic = storeNameToChangelog.get(stateStore.name()); changelogTopics.add(sourceTopic); stateStore.init(globalProcessorContext, stateStore); } checkpointFileCache.keySet().forEach(tp -> { if (!changelogTopics.contains(tp.topic())) { log.error("Encountered a topic-partition in the global checkpoint file not associated with any global" + " state store, topic-partition: {}, checkpoint file: {}. If this topic-partition is no longer valid," + " an application reset and state store directory cleanup will be required.", tp.topic(), checkpointFile.toString()); try { stateDirectory.unlockGlobalState(); } catch (final IOException e) { log.error("Failed to unlock the global state directory", e); } throw new StreamsException("Encountered a topic-partition not associated with any global state store"); } }); return Collections.unmodifiableSet(globalStoreNames); }