avijayanhwx commented on a change in pull request #982:
URL: https://github.com/apache/hadoop-ozone/pull/982#discussion_r433479809



##########
File path: 
hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/db/TestRDBStore.java
##########
@@ -348,5 +348,40 @@ public void testGetDBUpdatesSince() throws Exception {
     }
   }
 
+  @Test
+  public void testDowngrade() throws Exception {
+
+    // Write data to current DB which has 6 column families at the time of
+    // writing this test.
+    for (String family : families) {
+      try (Table table = rdbStore.getTable(family)) {
+        byte[] key = family.getBytes(StandardCharsets.UTF_8);
+        byte[] value =
+            RandomStringUtils.random(10).getBytes(StandardCharsets.UTF_8);
+        table.put(key, value);
+      }
+    }
+    // Close current DB.
+    rdbStore.close();
+
+    // Reopen DB with the last column family removed.
+    options = new DBOptions();
+    options.setCreateIfMissing(true);
+    options.setCreateMissingColumnFamilies(true);
+    configSet = new HashSet<>();
+    List<String> familiesMinusOne = families.subList(0, families.size() - 1);
+    for(String name : familiesMinusOne) {
+      TableConfig newConfig = new TableConfig(name, new ColumnFamilyOptions());
+      configSet.add(newConfig);
+    }
+    rdbStore = new RDBStore(rdbStore.getDbLocation(), options, configSet);
+    for (String family : familiesMinusOne) {

Review comment:
       Added check for the extra column family.




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