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/06 10:39:20 UTC

[GitHub] [pulsar] hangc0276 opened a new issue #7189: 【Bug】get last messageId with failed exception

hangc0276 opened a new issue #7189:
URL: https://github.com/apache/pulsar/issues/7189


   **Describe the bug**
   When I use flink to consume pulsar topic, flink-pulsar-connector will use admin http request to get last messageId. However, i get the following exception in broker side:
   ```
   17:37:47.033 [pulsar-web-41-23] ERROR org.apache.pulsar.broker.admin.impl.PersistentTopicsBase - [null] Failed to get last messageId persistent://test/test/test-partition-22
   javax.ws.rs.WebApplicationException: HTTP 307 Temporary Redirect
           at org.apache.pulsar.broker.web.PulsarWebResource.validateTopicOwnership(PulsarWebResource.java:596) ~[org.apache.pulsar-pulsar-broker-2.5.1.jar:2.5.1]
           at org.apache.pulsar.broker.admin.impl.PersistentTopicsBase.validateReadOperationOnTopic(PersistentTopicsBase.java:238) ~[org.apache.pulsar-pulsar-broker-2.5.1.jar:2.5.1]
           at org.apache.pulsar.broker.admin.impl.PersistentTopicsBase.internalGetLastMessageId(PersistentTopicsBase.java:2285) [org.apache.pulsar-pulsar-broker-2.5.1.jar:2.5.1]
           at org.apache.pulsar.broker.admin.v2.PersistentTopics.getLastMessageId(PersistentTopics.java:1063) [org.apache.pulsar-pulsar-broker-2.5.1.jar:2.5.1]
           at jdk.internal.reflect.GeneratedMethodAccessor133.invoke(Unknown Source) ~[?:?]
           at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
           at java.lang.reflect.Method.invoke(Method.java:564) ~[?:?]
           at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:76) [org.glassfish.jersey.core-jersey-server-2.27.jar:?]
           at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:148) [org.glassfish.jersey.core-jersey-server-2.27.jar:?]
           at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:191) [org.glassfish.jersey.core-jersey-server-2.27.jar:?]
           at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$VoidOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:183) [org.glassfish.jersey.core-jersey-server-2.27.jar:?]
           at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:103) [org.glassfish.jersey.core-jersey-server-2.27.jar:?]
           at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:493) [org.glassfish.jersey.core-jersey-server-2.27.jar:?]
           at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:415) [org.glassfish.jersey.core-jersey-server-2.27.jar:?]
           at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:104) [org.glassfish.jersey.core-jersey-server-2.27.jar:?]
           at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:277) [org.glassfish.jersey.core-jersey-server-2.27.jar:?]
           at org.glassfish.jersey.internal.Errors$1.call(Errors.java:272) [org.glassfish.jersey.core-jersey-common-2.27.jar:?]
           at org.glassfish.jersey.internal.Errors$1.call(Errors.java:268) [org.glassfish.jersey.core-jersey-common-2.27.jar:?]
           at org.glassfish.jersey.internal.Errors.process(Errors.java:316) [org.glassfish.jersey.core-jersey-common-2.27.jar:?]
           at org.glassfish.jersey.internal.Errors.process(Errors.java:298) [org.glassfish.jersey.core-jersey-common-2.27.jar:?]
           at org.glassfish.jersey.internal.Errors.process(Errors.java:268) [org.glassfish.jersey.core-jersey-common-2.27.jar:?]
           at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:289) [org.glassfish.jersey.core-jersey-common-2.27.jar:?]
           at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:256) [org.glassfish.jersey.core-jersey-server-2.27.jar:?]
           at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:703) [org.glassfish.jersey.core-jersey-server-2.27.jar:?]
           at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:416) [org.glassfish.jersey.containers-jersey-container-servlet-core-2.27.jar:?]
           at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:370) [org.glassfish.jersey.containers-jersey-container-servlet-core-2.27.jar:?]
           at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:389) [o
   ```
   When checking the code, i found the `Temporary Redirect` should be the expected behavior when the request topic not owned by the current broker. 
   ```
   if (!nsService.isServiceUnitOwned(topicName)) {
   	boolean newAuthoritative = isLeaderBroker(pulsar());
   	// Replace the host and port of the current request and redirect
   	URI redirect = UriBuilder.fromUri(uri.getRequestUri()).host(webUrl.get().getHost())
   		.port(webUrl.get().getPort()).replaceQueryParam("authoritative", newAuthoritative).build();
   	// Redirect
   	log.debug("Redirecting the rest call to {}", redirect);
   	throw new WebApplicationException(Response.temporaryRedirect(redirect).build());
   }
   ```
   **Expected behavior**
   When the requested topic not owned by current broker, i will trigger `Temporary Redirect`, and we should not use log error level to print the exception stack. 
   In my opinion, printing the exception stack with debug level will better. Because we will monitor the brokers' error messages and alert to the person on duty.
   
   @sijie @jiazhai @codelipenghui  Could you give me some ideas?


----------------------------------------------------------------
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 closed issue #7189: 【Bug】get last messageId with failed exception

Posted by GitBox <gi...@apache.org>.
codelipenghui closed issue #7189:
URL: https://github.com/apache/pulsar/issues/7189


   


----------------------------------------------------------------
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 issue #7189: 【Bug】get last messageId with failed exception

Posted by GitBox <gi...@apache.org>.
sijie commented on issue #7189:
URL: https://github.com/apache/pulsar/issues/7189#issuecomment-640318421


   @hangc0276 that sounds good to me.


----------------------------------------------------------------
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] hangc0276 commented on issue #7189: 【Bug】get last messageId with failed exception

Posted by GitBox <gi...@apache.org>.
hangc0276 commented on issue #7189:
URL: https://github.com/apache/pulsar/issues/7189#issuecomment-640346064


   > @hangc0276 that sounds good to me.
   
   @sijie Ok, i will fix this problem soon.


----------------------------------------------------------------
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