This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new b81cdf3a9ca [fix](npe) fix kafka be id npe (#33151) (#34039)
b81cdf3a9ca is described below
commit b81cdf3a9cace58b598ac49dccbc3940d49c390b
Author: yujun <[email protected]>
AuthorDate: Wed Apr 24 15:19:55 2024 +0800
[fix](npe) fix kafka be id npe (#33151) (#34039)
---
.../src/main/java/org/apache/doris/common/util/KafkaUtil.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/common/util/KafkaUtil.java
b/fe/fe-core/src/main/java/org/apache/doris/common/util/KafkaUtil.java
index 6538c1fb040..60f423773e7 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/util/KafkaUtil.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/KafkaUtil.java
@@ -48,13 +48,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
@@ -80,9 +82,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: [email protected]
For additional commands, e-mail: [email protected]