You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by sh...@apache.org on 2023/04/28 02:15:35 UTC
[kafka] branch trunk updated: MINOR: remove spurious call to fatalFaultHandler (#13651)
This is an automated email from the ASF dual-hosted git repository.
showuon pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new c708f7ba5f4 MINOR: remove spurious call to fatalFaultHandler (#13651)
c708f7ba5f4 is described below
commit c708f7ba5f4f449920cec57a5b69e84e92128b54
Author: Colin Patrick McCabe <cm...@apache.org>
AuthorDate: Thu Apr 27 19:15:26 2023 -0700
MINOR: remove spurious call to fatalFaultHandler (#13651)
Remove a spurious call to fatalFaultHandler accidentally introduced by KAFKA-14805. We should only
invoke the fatal fault handller if we are unable to generate the activation records. If we are
unable to write the activation records, a controller failover should be sufficient to remedy the
situation.
Co-authored-by: Luke Chen showuon@gmail.com
Reviewers: Luke Chen <sh...@gmail.com>, David Arthur <mu...@gmail.com>
---
.../org/apache/kafka/controller/QuorumController.java | 19 ++++++++++++-------
.../apache/kafka/controller/QuorumControllerTest.java | 2 +-
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/metadata/src/main/java/org/apache/kafka/controller/QuorumController.java b/metadata/src/main/java/org/apache/kafka/controller/QuorumController.java
index 7e5499fb076..16393983543 100644
--- a/metadata/src/main/java/org/apache/kafka/controller/QuorumController.java
+++ b/metadata/src/main/java/org/apache/kafka/controller/QuorumController.java
@@ -1181,10 +1181,6 @@ public final class QuorumController implements Controller {
new CompleteActivationEvent(),
EnumSet.of(DOES_NOT_UPDATE_QUEUE_TIME, RUNS_IN_PREMIGRATION)
);
- activationEvent.future.exceptionally(t -> {
- fatalFaultHandler.handleFault("exception while activating controller", t);
- return null;
- });
queue.prepend(activationEvent);
} catch (Throwable e) {
fatalFaultHandler.handleFault("exception while claiming leadership", e);
@@ -1275,12 +1271,21 @@ public final class QuorumController implements Controller {
}
return records;
}
+
class CompleteActivationEvent implements ControllerWriteOperation<Void> {
@Override
public ControllerResult<Void> generateRecordsAndResult() {
- List<ApiMessageAndVersion> records = generateActivationRecords(log, logReplayTracker.empty(),
- zkMigrationEnabled, bootstrapMetadata, featureControl);
- return ControllerResult.atomicOf(records, null);
+ try {
+ List<ApiMessageAndVersion> records = generateActivationRecords(log,
+ logReplayTracker.empty(),
+ zkMigrationEnabled,
+ bootstrapMetadata,
+ featureControl);
+ return ControllerResult.atomicOf(records, null);
+ } catch (Throwable t) {
+ throw fatalFaultHandler.handleFault("exception while completing controller " +
+ "activation", t);
+ }
}
@Override
diff --git a/metadata/src/test/java/org/apache/kafka/controller/QuorumControllerTest.java b/metadata/src/test/java/org/apache/kafka/controller/QuorumControllerTest.java
index 4f3a39b118d..afb83ffb27a 100644
--- a/metadata/src/test/java/org/apache/kafka/controller/QuorumControllerTest.java
+++ b/metadata/src/test/java/org/apache/kafka/controller/QuorumControllerTest.java
@@ -1359,7 +1359,7 @@ public class QuorumControllerTest {
assertEquals(
"The bootstrap metadata.version 3.3-IV0 does not support ZK migrations. Cannot continue with ZK migrations enabled.",
assertThrows(FaultHandlerException.class, () ->
- checkBootstrapZkMigrationRecord(MetadataVersion.IBP_3_3_IV0, true)).getCause().getCause().getMessage()
+ checkBootstrapZkMigrationRecord(MetadataVersion.IBP_3_3_IV0, true)).getCause().getMessage()
);
}