rdhabalia opened a new pull request, #23579:
URL: https://github.com/apache/pulsar/pull/23579

   It should fix: #23564 
   
   ### Motivation
   
   Currently if topic gets fenced for some reason (eg: Metadata-BadVersion) 
then broker is not allowing non-durable sub to be created and keep failing with 
below errors because broker is not closing and recreating topic to recover this 
error in case of non-durable sub where as broker does it during dutable-sub or 
producer creation.
   ```
   Caused by: 
org.apache.bookkeeper.mledger.ManagedLedgerException$ManagedLedgerFencedException:
 java.lang.Exception: Attempted to use a fenced managed ledger
   Caused by: java.lang.Exception: Attempted to use a fenced managed ledger
           at 
org.apache.bookkeeper.mledger.ManagedLedgerException$ManagedLedgerFencedException.<init>(ManagedLedgerException.java:80)
 ~[org.apache.pulsar-managed-ledger-3.3.4.jar:3.3.4]
           at 
org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl.checkFenced(ManagedLedgerImpl.java:3922)
 ~[org.apache.pulsar-managed-ledger-3.3.4.jar:3.3.4]
           at 
org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl.newNonDurableCursor(ManagedLedgerImpl.java:1126)
 ~[org.apache.pulsar-managed-ledger-3.3.4.jar:3.3.4]
           at 
org.apache.pulsar.broker.service.persistent.PersistentTopic.getNonDurableSubscription(PersistentTopic.java:1217)
 ~[org.apache.pulsar-pulsar-broker-3.3.4.jar:3.3.4]
           at 
org.apache.pulsar.broker.service.persistent.PersistentTopic.lambda$internalSubscribe$25(PersistentTopic.java:1032)
 ~[org.apache.pulsar-pulsar-broker-3.3.4.jar:3.3.4]
           ... 20 more
   2024-11-08T00:00:00,977+0000 [BookKeeperClientWorker-OrderedExecutor-0-0] 
WARN  org.apache.pulsar.broker.service.ServerCnx - 
[/1.1.1.1:36284][persistent://pulsar/broker-0:8080/healthcheck][healthCheck-10bdfffe-6fe4-44a5-b648-db8112c0b982]
 Failed to create consumer: consumerId=1345, java.lang.Exception: Attempted to 
use a fenced managed ledger
   java.util.concurrent.CompletionException: 
org.apache.bookkeeper.mledger.ManagedLedgerException$ManagedLedgerFencedException:
 java.lang.Exception: Attempted to use a fenced managed ledger
           at 
java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:332)
 ~[?:?]
           at 
java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1177)
 ~[?:?]
           at 
java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2309)
 ~[?:?]
           at 
org.apache.pulsar.broker.service.persistent.PersistentTopic.lambda$internalSubscribe$25(PersistentTopic.java:1035)
 ~[org.apache.pulsar-pulsar-broker-3.3.4.jar:3.3.4]
           at 
java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1187)
 ~[?:?]
           at 
java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2309)
 ~[?:?]
           at 
org.apache.pulsar.broker.service.persistent.PersistentTopic.internalSubscribe(PersistentTopic.java:956)
 ~[org.apache.pulsar-pulsar-broker-3.3.4.jar:3.3.4]
           at 
org.apache.pulsar.broker.service.persistent.PersistentTopic.subscribe(PersistentTopic.java:930)
 ~[org.apache.pulsar-pulsar-broker-3.3.4.jar:3.3.4]
           at 
org.apache.pulsar.broker.service.ServerCnx.lambda$handleSubscribe$19(ServerCnx.java:1351)
 ~[org.apache.pulsar-pulsar-broker-3.3.4.jar:3.3.4]
           at 
java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150)
 ~[?:?]
           at 
java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
 ~[?:?]
           at 
java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
 ~[?:?]
           at 
org.apache.pulsar.broker.service.schema.BookkeeperSchemaStorage$Functions.lambda$getLedgerEntry$0(BookkeeperSchemaStorage.java:684)
 ~[org.apache.pulsar-pulsar-broker-3.3.4.jar:3.3.4]
           at 
org.apache.bookkeeper.client.LedgerHandle$6.onSuccess(LedgerHandle.java:1050) 
[org.apache.bookkeeper-bookkeeper-server-4.17.1.jar:4.17.1]
           at 
org.apache.bookkeeper.client.LedgerHandle$6.onSuccess(LedgerHandle.java:1047) 
[org.apache.bookkeeper-bookkeeper-server-4.17.1.jar:4.17.1]
           at 
org.apache.bookkeeper.common.concurrent.FutureEventListener.accept(FutureEventListener.java:42)
 [org.apache.bookkeeper-bookkeeper-common-4.17.1.jar:4.17.1]
           at 
org.apache.bookkeeper.common.concurrent.FutureEventListener.accept(FutureEventListener.java:26)
 [org.apache.bookkeeper-bookkeeper-common-4.17.1.jar:4.17.1]
           at 
java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
 [?:?]
           at 
java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
 [?:?]
           at 
java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
 [?:?]
           at 
org.apache.bookkeeper.common.util.SingleThreadExecutor.safeRunTask(SingleThreadExecutor.java:137)
 [org.apache.bookkeeper-bookkeeper-common-4.17.1.jar:4.17.1]
           at 
org.apache.bookkeeper.common.util.SingleThreadExecutor.run(SingleThreadExecutor.java:107)
 [org.apache.bookkeeper-bookkeeper-common-4.17.1.jar:4.17.1]
           at 
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
 [io.netty-netty-common-4.1.111.Final.jar:4.1.111.Final]
           at java.base/java.lang.Thread.run(Thread.java:833) [?:?]
   ```
   
   ### Modifications
   
   Fix broker behavior to recover fenced topic and allow non-durable sub to 
connect on topic.
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This change is already covered by existing tests, such as *(please describe 
tests)*.
   
   *(or)*
   
   This change added tests and can be verified as follows:
   
   *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads 
(10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Does this pull request potentially affect one of the following parts:
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   *If the box was checked, please highlight the changes*
   
   - [ ] Dependencies (add or upgrade a dependency)
   - [ ] The public API
   - [ ] The schema
   - [ ] The default values of configurations
   - [ ] The threading model
   - [ ] The binary protocol
   - [ ] The REST endpoints
   - [ ] The admin CLI options
   - [ ] The metrics
   - [ ] Anything that affects deployment
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update 
later -->
   - [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: <!-- ENTER URL HERE -->
   
   <!--
   After opening this PR, the build in apache/pulsar will fail and instructions 
will
   be provided for opening a PR in the PR author's forked repository.
   
   apache/pulsar pull requests should be first tested in your own fork since 
the 
   apache/pulsar CI based on GitHub Actions has constrained resources and quota.
   GitHub Actions provides separate quota for pull requests that are executed 
in 
   a forked repository.
   
   The tests will be run in the forked repository until all PR review comments 
have
   been handled, the tests pass and the PR is approved by a reviewer.
   -->
   


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