You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/06/04 03:53:36 UTC
[GitHub] [pulsar] liudezhi2098 opened a new pull request #7164: fix get partitioned metadata throws NullPointerException
liudezhi2098 opened a new pull request #7164:
URL: https://github.com/apache/pulsar/pull/7164
Master Issue: #7163
## Motivation
Sometimes get partitioned metadata will throws NullPointerException, because the NamespaceService not initialized yet , so needed a judgment .
## Modifications
BrokerService
```java
if(pulsar.getNamespaceService() == null){
return CompletableFuture.completedFuture(null);
}
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] sijie commented on a change in pull request #7164: fix get partitioned metadata throws NullPointerException
Posted by GitBox <gi...@apache.org>.
sijie commented on a change in pull request #7164:
URL: https://github.com/apache/pulsar/pull/7164#discussion_r436421730
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
##########
@@ -1918,6 +1918,9 @@ private void createPendingLoadTopic() {
}
public CompletableFuture<PartitionedTopicMetadata> fetchPartitionedTopicMetadataCheckAllowAutoCreationAsync(TopicName topicName) {
+ if(pulsar.getNamespaceService() == null){
+ return FutureUtil.failedFuture(new NullPointerException("namespaceService is null"));
Review comment:
I think we should return an explicit error to tell the application that the namespace service is not ready.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] merlimat commented on a change in pull request #7164: fix get partitioned metadata throws NullPointerException
Posted by GitBox <gi...@apache.org>.
merlimat commented on a change in pull request #7164:
URL: https://github.com/apache/pulsar/pull/7164#discussion_r435348955
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
##########
@@ -1918,6 +1918,9 @@ private void createPendingLoadTopic() {
}
public CompletableFuture<PartitionedTopicMetadata> fetchPartitionedTopicMetadataCheckAllowAutoCreationAsync(TopicName topicName) {
+ if(pulsar.getNamespaceService() == null){
+ return CompletableFuture.completedFuture(null);
Review comment:
We should return an error in the future at this point, otherwise we're moving the NPE somewhere else
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] codelipenghui merged pull request #7164: fix get partitioned metadata throws NullPointerException
Posted by GitBox <gi...@apache.org>.
codelipenghui merged pull request #7164:
URL: https://github.com/apache/pulsar/pull/7164
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] liudezhi2098 commented on a change in pull request #7164: fix get partitioned metadata throws NullPointerException
Posted by GitBox <gi...@apache.org>.
liudezhi2098 commented on a change in pull request #7164:
URL: https://github.com/apache/pulsar/pull/7164#discussion_r435677229
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
##########
@@ -1918,6 +1918,9 @@ private void createPendingLoadTopic() {
}
public CompletableFuture<PartitionedTopicMetadata> fetchPartitionedTopicMetadataCheckAllowAutoCreationAsync(TopicName topicName) {
+ if(pulsar.getNamespaceService() == null){
+ return CompletableFuture.completedFuture(null);
Review comment:
OK
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org