lh0156 commented on code in PR #22937:
URL: https://github.com/apache/kafka/pull/22937#discussion_r3701406322
##########
clients/src/main/java/org/apache/kafka/common/config/TopicConfig.java:
##########
@@ -199,7 +199,13 @@ public class TopicConfig {
public static final String UNCLEAN_LEADER_ELECTION_ENABLE_CONFIG =
"unclean.leader.election.enable";
public static final String UNCLEAN_LEADER_ELECTION_ENABLE_DOC = "Indicates
whether to enable replicas " +
"not in the ISR set to be elected as leader as a last resort, even
though doing so may result in data " +
- "loss.<p>Note: In KRaft mode, when enabling this config dynamically,
it needs to wait for the unclean leader election" +
+ "loss. Enabling this configuration for a topic that uses transactions
is incompatible with exactly-once " +
+ "semantics. An unclean election can remove a transaction's COMMIT or
ABORT marker from the elected replica, " +
+ "causing consumers with <code>isolation.level=read_committed</code> to
stop at the last stable offset. " +
+ "If this occurs, use <code>kafka-transactions.sh find-hanging</code>
to identify the affected transaction and " +
+ "<code>kafka-transactions.sh abort</code> to recover it. Verify the
transaction and partition before aborting " +
+ "it, since an unclean election may already have caused data loss." +
+ "<p>Note: In KRaft mode, when enabling this config dynamically, it
needs to wait for the unclean leader election " +
Review Comment:
I verified the command behavior and updated the documentation in ff259c28d9.
The guidance is conditional: find-hanging scans DescribeProducers and
transaction metadata to identify open producer transactions whose partition
marker is missing. If the producer state is still available, abort --topic
<topic> --partition <partition> --start-offset <offset> validates that open
transaction and issues the abort. It cannot restore records or markers that
were lost by the unclean election, so the updated text calls that out
explicitly.
The existing TransactionsCommandTest coverage passed, including
testFindHangingNoMappedTransactionalId and the broker 3.0+ start-offset abort
path. I have not claimed an end-to-end unclean-election reproduction.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]