JacksonYao287 edited a comment on pull request #2079:
URL: https://github.com/apache/ozone/pull/2079#issuecomment-805789475


   > Check `ReconStorageContainerManagerFacade`, in the test, the non ratis id 
gen can use below `MockSCMHAManager`
   > 
   > ```
   >     this.scmhaManager = MockSCMHAManager.getInstance(
   >         true, new SCMDBTransactionBufferImpl());
   > ```
   
   @GlenGeng 
   the code in MockSCMHAManager is below 
   ```
   private MockSCMHAManager(boolean isLeader, DBTransactionBuffer buffer) {
       this.ratisServer = new MockRatisServer();
       this.isLeader = isLeader;
       this.transactionBuffer = buffer;
     }
   ```
   this.ratisServer will always be not null and it is not depend on whether 
'isLeader' is true
   so , after the above method is called , the 'ratisServer' in 
MockSCMHAManager will not be null;
   
   the code in SequenceIdGenerator is below
   ```
         this.stateManager = new StateManagerHAImpl.Builder()
             .setRatisServer(scmhaManager.getRatisServer())
             .setDBTransactionBuffer(scmhaManager.getDBTransactionBuffer())
             .setSequenceIdTable(sequenceIdTable)
             .build();
   ```
    here,the ratisServer in statemanager will not be true
   
   ```
       final SCMHAInvocationHandler invocationHandler
               = new SCMHAInvocationHandler(SEQUENCE_ID, impl, ratisServer);
   ```
   
   so,the ratisHandler will not be null
   ```
     public Object invoke(final Object proxy, final Method method,
                          final Object[] args) throws Throwable {
       try {
         long startTime = Time.monotonicNow();
         final Object result =
             ratisHandler != null && 
method.isAnnotationPresent(Replicate.class) ?
                 invokeRatis(method, args) :
                 invokeLocal(method, args);
         LOG.debug("Call: {} took {} ms", method, Time.monotonicNow() - 
startTime);
         return result;
       } catch(InvocationTargetException iEx) {
         throw iEx.getCause();
       }
     }
   ```
   so , we can see that if the 'ratisHandler' wiil not be null and the method 
is comment with '@Replicate' , invokeRatis will be called。
   


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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to