arp7 commented on a change in pull request #1130: HDDS-1827. Load Snapshot info 
when OM Ratis server starts.
URL: https://github.com/apache/hadoop/pull/1130#discussion_r316474797
 
 

 ##########
 File path: 
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerHA.java
 ##########
 @@ -1063,4 +1066,101 @@ static String createKey(OzoneBucket ozoneBucket) 
throws IOException {
     ozoneOutputStream.close();
     return keyName;
   }
+
+  @Test
+  public void testOMRestart() throws Exception {
+    // Get the leader OM
+    String leaderOMNodeId = objectStore.getClientProxy().getOMProxyProvider()
+        .getCurrentProxyOMNodeId();
+    OzoneManager leaderOM = cluster.getOzoneManager(leaderOMNodeId);
+
+    // Get follower OMs
+    OzoneManager followerOM1 = cluster.getOzoneManager(
+        leaderOM.getPeerNodes().get(0).getOMNodeId());
+    OzoneManager followerOM2 = cluster.getOzoneManager(
+        leaderOM.getPeerNodes().get(1).getOMNodeId());
+
+    // Do some transactions so that the log index increases
+    String userName = "user" + RandomStringUtils.randomNumeric(5);
+    String adminName = "admin" + RandomStringUtils.randomNumeric(5);
+    String volumeName = "volume" + RandomStringUtils.randomNumeric(5);
+    String bucketName = "bucket" + RandomStringUtils.randomNumeric(5);
+
+    VolumeArgs createVolumeArgs = VolumeArgs.newBuilder()
+        .setOwner(userName)
+        .setAdmin(adminName)
+        .build();
+
+    objectStore.createVolume(volumeName, createVolumeArgs);
+    OzoneVolume retVolumeinfo = objectStore.getVolume(volumeName);
+
+    retVolumeinfo.createBucket(bucketName);
+    OzoneBucket ozoneBucket = retVolumeinfo.getBucket(bucketName);
+
+    for (int i = 0; i < 10; i++) {
+      createKey(ozoneBucket);
+    }
+
+    long lastAppliedTxOnFollowerOM =
+        followerOM1.getOmRatisServer().getStateMachineLastAppliedIndex();
+
+    // Stop one follower OM
+    followerOM1.stop();
+
+    // Do more transactions. Stopped OM should miss these transactions and
+    // the logs corresponding to atleast some of the missed transactions
+    // should be purged. This will force the OM to install snapshot when
+    // restarted.
+    long minNewTxIndex = lastAppliedTxOnFollowerOM + (LOG_PURGE_GAP * 10);
 
 Review comment:
   There is no guarantee that the purge has occurred right?

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


With regards,
Apache Git Services

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

Reply via email to