xichen01 commented on code in PR #6420:
URL: https://github.com/apache/ozone/pull/6420#discussion_r1535781181
##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBScanner.java:
##########
@@ -218,10 +225,17 @@ 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);
+ while (iterator.get().isValid()) {
+ try (PrintWriter out = new PrintWriter(new BufferedWriter(
+ new PrintWriter(fileName + fileSuffix, UTF_8.name())))) {
Review Comment:
If `preFileRecords` is not specified, we'd better make the filename the same
as the previous filename (without `fileSuffix`)
##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBScanner.java:
##########
@@ -288,6 +302,9 @@ private void processRecords(ManagedRocksIterator iterator,
batch = new ArrayList<>(batchSize);
sequenceId++;
}
+ if ((preFileRecords > -1) && (count >= preFileRecords)) {
Review Comment:
Seems like the `ldb` will generate unlimited empty file If the
`preFileRecords` is zero.
##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBScanner.java:
##########
@@ -148,6 +150,11 @@ public class DBScanner implements Callable<Void>,
SubcommandWithParent {
defaultValue = "10")
private int threadCount;
+ @CommandLine.Option(names = {"--pre-file-records"},
+ description = "The number of print records per file.",
+ defaultValue = "-1")
+ private long preFileRecords;
Review Comment:
Nit: suggest `--max-records-per-file`
--
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]