Kowshik Prakasam created KAFKA-12977: ----------------------------------------
Summary: Eliminate temporary ProducerStateManager in Log recovery logic Key: KAFKA-12977 URL: https://issues.apache.org/jira/browse/KAFKA-12977 Project: Kafka Issue Type: Improvement Reporter: Kowshik Prakasam The temporary ProducerStateManager (PSM) instance created in the Log recovery logic (inside LogLoader) is a source of complexity and confusion. For example, when fixing KAFKA-12964 (see [PR# 10896|https://github.com/apache/kafka/pull/10896]) we figured that there are cases where the temporary PSM instance's state goes out of sync with the real PSM instance (within LoadLogParams). And we need to adjust the code suitably to handle for the consequences of these 2 instances being out of sync. To fix this, we should just get rid of the temporary PSM instance which is used in the following places: # In LogLoader.recoverLog(), we could just pass in the real PSM. # In LogLoader.completeSwapOperations(), we try to avoid recovering segment here in [PR #10763|https://github.com/apache/kafka/pull/10763]. # In LogLoader.loadSegmentFiles(), we probably need to clean this part of the logic a bit. If we are missing index file or the index file is corrupted, typically we can just rebuild the index without changing PSM. If the segment is truncated while rebuilding the index, we actually want to follow the process in step 1, by just removing the rest of the segments. So, we could also get rid of the temporary PSM in this case. -- This message was sent by Atlassian Jira (v8.3.4#803005)