This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
commit 159ebc76e7f95739743ff7b95c0094c67a23e607 Author: yujun <yu.jun.re...@gmail.com> AuthorDate: Mon Apr 8 08:49:09 2024 +0800 [fix](npe) fix kafka be id npe (#33151) --- .../main/java/org/apache/doris/datasource/kafka/KafkaUtil.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/kafka/KafkaUtil.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/kafka/KafkaUtil.java index aee2aadac28..12a32da5a9c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/kafka/KafkaUtil.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/kafka/KafkaUtil.java @@ -47,13 +47,15 @@ public class KafkaUtil { Map<String, String> convertedCustomProperties) throws UserException { TNetworkAddress address = null; Backend be = null; + long beId = -1L; try { List<Long> backendIds = Env.getCurrentSystemInfo().getAllBackendIds(true); if (backendIds.isEmpty()) { throw new LoadException("Failed to get all partitions. No alive backends"); } Collections.shuffle(backendIds); - be = Env.getCurrentSystemInfo().getBackend(backendIds.get(0)); + beId = backendIds.get(0); + be = Env.getCurrentSystemInfo().getBackend(beId); address = new TNetworkAddress(be.getHost(), be.getBrpcPort()); // create request @@ -79,9 +81,9 @@ public class KafkaUtil { return result.getKafkaMetaResult().getPartitionIdsList(); } } catch (Exception e) { - LOG.warn("failed to get partitions from backend[{}].", be.getId(), e); + LOG.warn("failed to get partitions from backend[{}].", beId, e); throw new LoadException( - "Failed to get all partitions of kafka topic: " + topic + " from backend[" + be.getId() + "Failed to get all partitions of kafka topic: " + topic + " from backend[" + beId + "]. error: " + e.getMessage()); } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org