You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/03/24 12:44:31 UTC

[GitHub] [ozone] JacksonYao287 edited a comment on pull request #2079: HDDS-4981. Remove SequenceIdGenerator#StateManagerImpl

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();**// it is not depend on 'isLeader'
       this.isLeader = isLeader;
       this.transactionBuffer = buffer;
     }
   ```
   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();
   ```
   ```
       final SCMHAInvocationHandler invocationHandler
               **= new SCMHAInvocationHandler(SEQUENCE_ID, impl, ratisServer);**
   ```
   ```
     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' is not 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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org