xichen01 commented on code in PR #6420:
URL: https://github.com/apache/ozone/pull/6420#discussion_r1538752357


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBScanner.java:
##########
@@ -218,10 +225,24 @@ private boolean displayTable(ManagedRocksIterator 
iterator,
     }
 
     // Write to file output
-    try (PrintWriter out = new PrintWriter(new BufferedWriter(
-        new PrintWriter(fileName, UTF_8.name())))) {
-      return displayTable(iterator, dbColumnFamilyDef, out, schemaV3);
+    if (preFileRecords > 0) {
+      while (iterator.get().isValid()) {
+        try (PrintWriter out = new PrintWriter(new BufferedWriter(
+                new PrintWriter(fileName + fileSuffix, UTF_8.name())))) {
+          if (!displayTable(iterator, dbColumnFamilyDef, out, schemaV3)) {
+            return false;
+          }
+        }
+        fileSuffix++;
+      }
+    } else {

Review Comment:
   Perhaps we can simplify this `if... else`
   Like:
   ```
   //...
   String  fileNameXXX = preFileRecords > 0 ? fileName + fileSuffix++ : 
fileName;
   //...
   new PrintWriter(fileNameXXX, UTF_8.name())
   ```



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