arnarg opened a new issue, #16331:
URL: https://github.com/apache/pulsar/issues/16331

   **Describe the bug**
   When attempting to set or get topic level policies in a namespace where 
`is_allow_auto_update_schema` is disabled I am unable to get or set any topic 
level policies. I get an exception `TopicPoliciesCacheNotInitException` (see 
#15891).
   
   I have also discovered the cause of this which is that the reader that reads 
the internal `__change_events` topic that is created in the namespace when 
topic level policies is enabled attempts to auto update the schema and therefor 
throws the exception `IncompatibleSchemaException`.
   
   **To Reproduce**
   Steps to reproduce the behavior:
   1. `./bin/pulsar-admin tenants create mytenant`
   2. `./bin/pulsar-admin namespaces create mytenant/ns`
   3. `./bin/pulsar-admin namespaces set-is-allow-auto-update-schema 
mytenant/ns --disable`
   4. `./bin/pulsar-admin topics create mytenant/ns/topic`
   5. `./bin/pulsar-admin topics get-message-ttl mytenant/ns/topic`
       - HTTP 500 Server Error
   6. `curl 
http://my-pulsar-broker.local/admin/v2/persistent/sampletenant/ns/topic/messageTTL`
       - Message: Topic policies cache have not init.
   
   **Expected behavior**
   I would expect topic level policies to work correctly.
   
   **Additional context**
   Pulsar version: 2.9.2
   
   ```
   2022-07-01T12:22:29,119+0000 [pulsar-io-4-1] ERROR 
org.apache.pulsar.broker.service.SystemTopicBasedTopicPoliciesService - 
[mytenant/ns] Failed to create reader on __change_events topic
   java.util.concurrent.CompletionException: 
org.apache.pulsar.client.api.PulsarClientException$IncompatibleSchemaException: 
{"errorMsg":"Schema not found and schema auto updating is 
disabled.","reqId":4307185312891752583, 
"remote":"dev01-neuron-pulsar-broker-1.dev01-neuron-pulsar-broker.dev01-neuron-pulsar.svc.cluster.local/10.128.2.91:6650",
 "local":"/10.130.2.163:48998"}
        at 
java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:331)
 ~[?:?]
        at 
java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:346)
 ~[?:?]
        at 
java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:777)
 ~[?:?]
        at 
java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506) 
[?:?]
        at 
java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2088)
 [?:?]
        at 
org.apache.pulsar.client.impl.ClientCnx.handleError(ClientCnx.java:715) 
[org.apache.pulsar-pulsar-client-original-2.9.2.jar:2.9.2]
        at 
org.apache.pulsar.common.protocol.PulsarDecoder.channelRead(PulsarDecoder.java:177)
 [org.apache.pulsar-pulsar-common-2.9.2.jar:2.9.2]
        at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
 [io.netty-netty-transport-4.1.74.Final.jar:4.1.74.Final]
        at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
 [io.netty-netty-transport-4.1.74.Final.jar:4.1.74.Final]
        at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
 [io.netty-netty-transport-4.1.74.Final.jar:4.1.74.Final]
        at 
io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:327)
 [io.netty-netty-codec-4.1.74.Final.jar:4.1.74.Final]
        at 
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:299)
 [io.netty-netty-codec-4.1.74.Final.jar:4.1.74.Final]
        at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
 [io.netty-netty-transport-4.1.74.Final.jar:4.1.74.Final]
        at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
 [io.netty-netty-transport-4.1.74.Final.jar:4.1.74.Final]
        at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
 [io.netty-netty-transport-4.1.74.Final.jar:4.1.74.Final]
        at 
io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
 [io.netty-netty-transport-4.1.74.Final.jar:4.1.74.Final]
        at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
 [io.netty-netty-transport-4.1.74.Final.jar:4.1.74.Final]
        at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
 [io.netty-netty-transport-4.1.74.Final.jar:4.1.74.Final]
        at 
io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
 [io.netty-netty-transport-4.1.74.Final.jar:4.1.74.Final]
        at 
io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:795)
 [io.netty-netty-transport-classes-epoll-4.1.74.Final.jar:4.1.74.Final]
        at 
io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:480) 
[io.netty-netty-transport-classes-epoll-4.1.74.Final.jar:4.1.74.Final]
        at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378) 
[io.netty-netty-transport-classes-epoll-4.1.74.Final.jar:4.1.74.Final]
        at 
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
 [io.netty-netty-common-4.1.74.Final.jar:4.1.74.Final]
        at 
io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) 
[io.netty-netty-common-4.1.74.Final.jar:4.1.74.Final]
        at 
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
 [io.netty-netty-common-4.1.74.Final.jar:4.1.74.Final]
        at java.lang.Thread.run(Thread.java:829) [?:?]
   Caused by: 
org.apache.pulsar.client.api.PulsarClientException$IncompatibleSchemaException: 
{"errorMsg":"Schema not found and schema auto updating is 
disabled.","reqId":4307185312891752583, 
"remote":"dev01-neuron-pulsar-broker-1.dev01-neuron-pulsar-broker.dev01-neuron-pulsar.svc.cluster.local/10.128.2.91:6650",
 "local":"/10.130.2.163:48998"}
        at 
org.apache.pulsar.client.impl.ClientCnx.getPulsarClientException(ClientCnx.java:1170)
 ~[org.apache.pulsar-pulsar-client-original-2.9.2.jar:2.9.2]
        at 
org.apache.pulsar.client.impl.ClientCnx.handleError(ClientCnx.java:716) 
~[org.apache.pulsar-pulsar-client-original-2.9.2.jar:2.9.2]
        ... 20 more
   ```
   
   There should probably be logic that publishes the schema explicitly before 
opening the reader.


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to