congbobo184 opened a new pull request #11357:
URL: https://github.com/apache/pulsar/pull/11357


   ## Motivation
   now transaction coordinator init use `addNamespaceBundleOwnershipListener`, 
but it will not ensure transaction coordinator has been loaded correctly.
   
   
![image](https://user-images.githubusercontent.com/39078850/126097255-2dd005bc-7e10-415a-873d-7ea54914ab6e.png)
   As shown in this picture, when add transaction coordinator fail, this 
coordinator will not init again. Client do transaction op will all get 
`CoordinatorNotFoundException`.
   
   ## implement
   when client do transaction op, we don't have corresponding coordinator, we 
also can init again, but every transaction client op will init transaction 
again. so should add a comman `TcClientConnect`. The client must connect to tc 
successfully then we can do transaction op. when client in `CONNECTING` state, 
client will return fail.
   ```
   message CommandTcClientConnect {
       required uint64 request_id = 1;
       required uint64 tc_id = 2 [default = 0];
   }
   ```
   
   This command mainly responsible for loading tc. when client op get 
`CoordinatorNotFoundException`, client will do lookup and reconnect tc. and in 
the one broker, only one tc will initing with the same tcId. When tc append log 
get `ManagedLedgerFencedException` broker will remove this tc. if client send 
`CommandTcClientConnect` to this broker, broker will check the ownerShip, then 
decide whether to load this tc.
    
   
   ### Verifying this change
   Add the tests for it
   
   Does this pull request potentially affect one of the following parts:
   If yes was chosen, please highlight the changes
   
   Dependencies (does it add or upgrade a dependency): (no)
   The public API: (no)
   The schema: (no)
   The default values of configurations: (no)
   The wire protocol: (no)
   The rest endpoints: (no)
   The admin cli options: (no)
   Anything that affects deployment: (no)
   
   


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