peterxcli commented on code in PR #7768:
URL: https://github.com/apache/ozone/pull/7768#discussion_r1932250101


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneRepairShell.java:
##########
@@ -105,23 +112,44 @@ public void testUpdateTransactionInfoTable() throws 
Exception {
             String.format("The highest transaction info has been updated to: 
(t:%s, i:%s)", testTerm, testIndex)
         );
 
-    String cmdOut2 = scanTransactionInfoTable(dbPath);
+    String cmdOut2 = scanTransactionInfoTable(dbPath, component);
     assertThat(cmdOut2).contains(testTerm + "#" + testIndex);
 
     withTextFromSystemIn("y")
-        .execute(() -> cmd.execute("om", "update-transaction",
+        .execute(() -> cmd.execute(component, "update-transaction",
             "--db", dbPath,
             "--term", originalHighestTermIndex[0],
             "--index", originalHighestTermIndex[1]));
     cluster.getOzoneManager().restart();
     try (OzoneClient ozoneClient = cluster.newClient()) {
-      ozoneClient.getObjectStore().createVolume("vol1");
+      ozoneClient.getObjectStore().createVolume("vol-" + component);
+    }
+  }
+
+  private String getDbPath(String component) {
+    switch (component) {
+    case "om":
+      return OMStorage.getOmDbDir(conf) + "/" + OM_DB_NAME;
+    case "scm":
+      return ServerUtils.getScmDbDir(conf) + "/" + SCM_DB_NAME;
+    default: return "";
+    }
+  }
+
+  private String getColumnFamilyName(String component) {
+    switch (component) {
+    case "om":
+      return OMDBDefinition.TRANSACTION_INFO_TABLE.getName();
+    case "scm":
+      return SCMDBDefinition.TRANSACTIONINFO.getName();
+    default:
+      return "";

Review Comment:
   Would you like to use same method as 
[#7758](https://github.com/apache/ozone/pull/7758/files#diff-af5fee03802ad1c9466d2be3a1e3a868c7485c9e66512f42c361b0520bba121cR125-R133)?
   ```suggestion
     private DBColumnFamilyDefinition<String, TransactionInfo> 
getColumnFamily() {
       Component component = serviceToBeOffline();
       switch (component) {
       case OM:
         return OMDBDefinition.TRANSACTION_INFO_TABLE;
       case SCM:
         return SCMDBDefinition.TRANSACTIONINFO;
       default:
         throw new IllegalStateException("This tool does not support component: 
" + component);
       }
   ```



##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneRepairShell.java:
##########
@@ -105,23 +112,44 @@ public void testUpdateTransactionInfoTable() throws 
Exception {
             String.format("The highest transaction info has been updated to: 
(t:%s, i:%s)", testTerm, testIndex)
         );
 
-    String cmdOut2 = scanTransactionInfoTable(dbPath);
+    String cmdOut2 = scanTransactionInfoTable(dbPath, component);
     assertThat(cmdOut2).contains(testTerm + "#" + testIndex);
 
     withTextFromSystemIn("y")
-        .execute(() -> cmd.execute("om", "update-transaction",
+        .execute(() -> cmd.execute(component, "update-transaction",
             "--db", dbPath,
             "--term", originalHighestTermIndex[0],
             "--index", originalHighestTermIndex[1]));
     cluster.getOzoneManager().restart();
     try (OzoneClient ozoneClient = cluster.newClient()) {
-      ozoneClient.getObjectStore().createVolume("vol1");
+      ozoneClient.getObjectStore().createVolume("vol-" + component);
+    }
+  }
+
+  private String getDbPath(String component) {
+    switch (component) {
+    case "om":
+      return OMStorage.getOmDbDir(conf) + "/" + OM_DB_NAME;
+    case "scm":
+      return ServerUtils.getScmDbDir(conf) + "/" + SCM_DB_NAME;
+    default: return "";
+    }

Review Comment:
   If so, could you please make this default case here to raise an error?



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

To unsubscribe, e-mail: [email protected]

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