Shawyeok commented on PR #20363: URL: https://github.com/apache/pulsar/pull/20363#issuecomment-1561122907
> I'd appreciate it if you can provide a znode view of execution steps to demonstrate the exception. Try me break down into two steps to explain how this error could be produced in [#14779][1]: 1. When topic back to `node1`, it will only initialize the managed-ledger without initializing any cursors, due to cache consistency pseudo call stack: ``` MetaStore#getCursor ManagedLedgerImpl#initializeCursors MetaStore#asyncUpdateLedgerIds ManagedLedgerImpl#asyncCreateLedger ManagedLedgerImpl#initializeBookKeeper MetaStore#getManagedLedgerInfo ManagedLedgerImpl#initialize ``` https://github.com/apache/pulsar/blob/1e664b7f550ffa28d3c810f3b7d6d625d5905eb3/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L570-L572 2. When a consumer reconnects to `node1`, the broker only checks if the cursor has been loaded into memory https://github.com/apache/pulsar/blob/1e664b7f550ffa28d3c810f3b7d6d625d5905eb3/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L981-L982 pseudo call stack: ``` AbstractMetadataStore#put MetaStore#asyncUpdateCursorInfo ManagedCursorImpl#persistPositionMetaStore ManagedCursorImpl#switchToNewLedger ManagedCursorImpl#createNewMetadataLedger ManagedCursorImpl#initialize ManagedLedger#asyncOpenCursor PersistentTopic#getDurableSubscription PersistentTopic#internalSubscribe PersistentTopic#subscribe ServerCnx#handleSubscribe ``` BTW, **broker will try create a cursor znode which already exists in zk, so it'll receive `NODEEXISTS`.** Here's `NODEEXISTS` how to be handled, a `BADVERSION`: https://github.com/apache/pulsar/blob/3f2978d32223d61f04db1de330f5b167a63925ae/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKMetadataStore.java#L244-L246 In summary, this is how I observed the occurrence of BadVersionException. [1]: https://github.com/apache/pulsar/issues/14779#issuecomment-1554473113 -- 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]
