smengcl commented on code in PR #12005:
URL: https://github.com/apache/ozone/pull/12005#discussion_r4534438953


##########
hadoop-ozone/cli-debug/src/main/java/org/apache/hadoop/ozone/debug/ldb/DBScanner.java:
##########
@@ -265,8 +265,7 @@ private boolean displayTable(ManagedRocksIterator iterator,
     while (iterator.get().isValid() && withinLimit(globalCount)) {
       String fileNameTarget = recordsPerFile > 0 ? fileName + "." + 
fileSuffix++ :
           fileName;
-      try (PrintWriter out = new PrintWriter(new BufferedWriter(
-          new PrintWriter(fileNameTarget, UTF_8.name())))) {
+      try (PrintStream out = new 
PrintStream(Files.newOutputStream(Paths.get(fileNameTarget)))) {

Review Comment:
   The old code wrote the file as UTF-8 through a `BufferedWriter`. The new 
`PrintStream` uses the platform default charset (still locale dependent on JDK 
17), and it has no buffer, so every `print`/`println` from `LogWriter` becomes 
a separate write to the file. That could make `ldb scan --out` on a large table 
noticeably slower. Would it make sense to keep both, e.g.
   
   ```java
   try (PrintStream out = new PrintStream(new 
BufferedOutputStream(Files.newOutputStream(Paths.get(fileNameTarget))), false, 
UTF_8.name())) {
   ```



##########
hadoop-hdds/test-utils/src/main/java/org/apache/ozone/test/GenericTestUtils.java:
##########
@@ -308,11 +309,20 @@ protected PrintStreamCapturer(PrintStream out, 
Consumer<PrintStream> install) {
       }
     }
 
+    public PrintWriter asPrintWriter() {

Review Comment:
   nit: `asPrintWriter()` does not seem to be used anywhere in the PR. Maybe 
drop it, unless it would be used in a follow-up?



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