GlenGeng commented on a change in pull request #2079:
URL: https://github.com/apache/ozone/pull/2079#discussion_r600999896



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/MockSCMHAManager.java
##########
@@ -71,6 +76,11 @@ private MockSCMHAManager(boolean isLeader, 
DBTransactionBuffer buffer) {
     this.transactionBuffer = buffer;
   }
 
+  private MockSCMHAManager(SCMDBTransactionBufferImpl buffer) {
+    this.transactionBuffer = buffer;

Review comment:
       The change in `MockSCMHAManager` is not needed. 
   The bypass ratis scm is based on the `MockRatisServer`.

##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SequenceIdGenerator.java
##########
@@ -91,15 +91,11 @@ public SequenceIdGenerator(ConfigurationSource conf,
     this.batchSize = conf.getInt(OZONE_SCM_SEQUENCE_ID_BATCH_SIZE,
         OZONE_SCM_SEQUENCE_ID_BATCH_SIZE_DEFAULT);
 
-    if (SCMHAUtils.isSCMHAEnabled(conf)) {
-      this.stateManager = new StateManagerHAImpl.Builder()
-          .setRatisServer(scmhaManager.getRatisServer())
-          .setDBTransactionBuffer(scmhaManager.getDBTransactionBuffer())
-          .setSequenceIdTable(sequenceIdTable)
-          .build();
-    } else {
-      this.stateManager = new StateManagerImpl(sequenceIdTable);
-    }
+    Preconditions.checkNotNull(scmhaManager);
+    this.stateManager = new StateManagerHAImpl.Builder()
+        .setRatisServer(scmhaManager.getRatisServer())
+        .setDBTransactionBuffer(scmhaManager.getDBTransactionBuffer())
+        .setSequenceIdTable(sequenceIdTable).build();

Review comment:
       Please help rename `StateManagerHAImpl` to `StateManagerImpl`.

##########
File path: 
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/ha/TestSequenceIDGenerator.java
##########
@@ -19,23 +19,26 @@
 import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import org.apache.hadoop.hdds.scm.metadata.SCMMetadataStore;
 import org.apache.hadoop.hdds.scm.metadata.SCMMetadataStoreImpl;
+import org.apache.hadoop.hdds.scm.metadata.SCMDBTransactionBufferImpl;
 import org.apache.hadoop.ozone.container.common.SCMTestUtils;
+
 import org.junit.Assert;
 import org.junit.Test;
 
-import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_HA_ENABLE_KEY;
 import static 
org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_SEQUENCE_ID_BATCH_SIZE;
 
 public class TestSequenceIDGenerator {
   @Test
   public void testSequenceIDGenUponNonRatis() throws Exception {
     OzoneConfiguration conf = SCMTestUtils.getConf();
-    conf.setBoolean(OZONE_SCM_HA_ENABLE_KEY, false);
     SCMMetadataStore scmMetadataStore = new SCMMetadataStoreImpl(conf);
     scmMetadataStore.start(conf);
 
+    SCMHAManager scmHAManager = MockSCMHAManager.getInstance(

Review comment:
       ```
       SCMHAManager scmHAManager = MockSCMHAManager.getInstance(true,
           new SCMDBTransactionBufferImpl());
   ```




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