yabinmeng opened a new issue #10106:
URL: https://github.com/apache/pulsar/issues/10106


   **Describe the bug**
   I was doing some geo-replication related testing and I found out  that 
Exclusive subscription mode is NOT respected across regions.
   
   **To Reproduce**
   Steps to reproduce the behavior:
   
   **NOTE**: In my test, hosts in ClusterA is in subnet "172.16.10.xxx" and 
ClusterB is in subnet "172.16.20.xxxx".
   
   1. In **ClusterA**, start a consumer **ConsumerA1** in Exclusive mode on a 
topic (georep/default/t100), under subscription **mysbu**.
   ```
   ubuntu@ip-172-16-10-181:~$ pulsar-client consume -s mysub 
persistent://georep/default/t100 -n 0
   ... ...
   14:26:12.905 [pulsar-client-io-1-1] INFO  
org.apache.pulsar.client.impl.ConnectionPool - [[id: 0x72b1aa9d, 
L:/172.16.10.181:60830 - 
R:ip-172-16-10-63.us-east-2.compute.internal/172.16.10.63:6650]] Connected to 
server
   14:26:12.908 [pulsar-client-io-1-1] INFO  
org.apache.pulsar.client.impl.ConsumerImpl - 
[persistent://georep/default/t100][mysub] Subscribing to topic on cnx [id: 
0x72b1aa9d, L:/172.16.10.181:60830 - 
R:ip-172-16-10-63.us-east-2.compute.internal/172.16.10.63:6650], consumerId 0
   14:26:12.936 [pulsar-client-io-1-1] INFO  
org.apache.pulsar.client.impl.ConsumerImpl - 
[persistent://georep/default/t100][mysub] Subscribed to topic on 
ip-172-16-10-63.us-east-2.compute.internal/172.16.10.63:6650 -- consumer: 0
   ```
   
   2. In **ClusterA**, start another consumer **ConsumerA2** in Exclusive mode 
on the same topic under the same subscription. It failed to start as expected.
   
   ```
   ubuntu@ip-172-16-10-181:~$ pulsar-client consume -s mysub 
persistent://georep/default/t100 -n 0
   ... ... 
   14:26:25.083 [pulsar-client-io-1-1] INFO  
org.apache.pulsar.client.impl.ConnectionPool - [[id: 0xdb715690, 
L:/172.16.10.181:60834 - 
R:ip-172-16-10-63.us-east-2.compute.internal/172.16.10.63:6650]] Connected to 
server
   14:26:25.086 [pulsar-client-io-1-1] INFO  
org.apache.pulsar.client.impl.ConsumerImpl - 
[persistent://georep/default/t100][mysub] Subscribing to topic on cnx [id: 
0xdb715690, L:/172.16.10.181:60834 - 
R:ip-172-16-10-63.us-east-2.compute.internal/172.16.10.63:6650], consumerId 0
   14:26:25.095 [pulsar-client-io-1-1] WARN  
org.apache.pulsar.client.impl.ClientCnx - [id: 0xdb715690, 
L:/172.16.10.181:60834 - 
R:ip-172-16-10-63.us-east-2.compute.internal/172.16.10.63:6650] Received error 
from server: Exclusive consumer is already connected
   14:26:25.096 [pulsar-client-io-1-1] WARN  
org.apache.pulsar.client.impl.ConsumerImpl - 
[persistent://georep/default/t100][mysub] Failed to subscribe to topic on 
ip-172-16-10-63.us-east-2.compute.internal/172.16.10.63:6650
   14:26:25.097 [main] ERROR org.apache.pulsar.client.cli.PulsarClientTool - 
Error while consuming messages
   14:26:25.097 [main] ERROR org.apache.pulsar.client.cli.PulsarClientTool - 
Exclusive consumer is already connected
   org.apache.pulsar.client.api.PulsarClientException$ConsumerBusyException: 
Exclusive consumer is already connected
        at 
org.apache.pulsar.client.api.PulsarClientException.unwrap(PulsarClientException.java:946)
 ~[org.apache.pulsar-pulsar-client-api-2.7.1.jar:2.7.1]
        at 
org.apache.pulsar.client.impl.ConsumerBuilderImpl.subscribe(ConsumerBuilderImpl.java:102)
 ~[org.apache.pulsar-pulsar-client-original-2.7.1.jar:2.7.1]
        at org.apache.pulsar.client.cli.CmdConsume.consume(CmdConsume.java:222) 
[org.apache.pulsar-pulsar-client-tools-2.7.1.jar:2.7.1]
        at org.apache.pulsar.client.cli.CmdConsume.run(CmdConsume.java:191) 
[org.apache.pulsar-pulsar-client-tools-2.7.1.jar:2.7.1]
        at 
org.apache.pulsar.client.cli.PulsarClientTool.run(PulsarClientTool.java:177) 
[org.apache.pulsar-pulsar-client-tools-2.7.1.jar:2.7.1]
        at 
org.apache.pulsar.client.cli.PulsarClientTool.main(PulsarClientTool.java:209) 
[org.apache.pulsar-pulsar-client-tools-2.7.1.jar:2.7.1]
   ```
   
   3. In **ClusterB**, start a consumer **ConsumerB1** in Exclusive mode on the 
same topic under the same subscription. It connects successfully
   
   ```
   ubuntu@ip-172-16-20-181:~$ pulsar-client consume -s mysub 
persistent://georep/default/t100 -n 0
   ... ...
   14:26:31.759 [pulsar-client-io-1-1] INFO  
org.apache.pulsar.client.impl.ConnectionPool - [[id: 0xab3ece4e, 
L:/172.16.20.181:45436 - 
R:ip-172-16-20-240.us-east-2.compute.internal/172.16.20.240:6650]] Connected to 
server
   14:26:31.763 [pulsar-client-io-1-1] INFO  
org.apache.pulsar.client.impl.ConsumerImpl - 
[persistent://georep/default/t100][mysub] Subscribing to topic on cnx [id: 
0xab3ece4e, L:/172.16.20.181:45436 - 
R:ip-172-16-20-240.us-east-2.compute.internal/172.16.20.240:6650], consumerId 0
   14:26:31.776 [pulsar-client-io-1-1] INFO  
org.apache.pulsar.client.impl.ConsumerImpl - 
[persistent://georep/default/t100][mysub] Subscribed to topic on 
ip-172-16-20-240.us-east-2.compute.internal/172.16.20.240:6650 -- consumer: 0
   ```
   
   **Expected behavior**
   Pulsar document is really not clear in general about what would be the right 
behavior of subscription mode across regions. But for Exclusive mode, I would 
think it makes more sense to only allow one consumer to connect under one 
subscription all the time.
   
   **Screenshots**
   If applicable, add screenshots to help explain your problem.
   
   **Desktop (please complete the following information):**
    - OS: Ubuntu 18.04
   
   **Additional context**
   - Pulsar 2.7.1


-- 
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:
[email protected]


Reply via email to