DomGarguilo commented on code in PR #6471:
URL: https://github.com/apache/accumulo/pull/6471#discussion_r3574203594


##########
server/base/src/main/java/org/apache/accumulo/server/util/adminCommand/Fate.java:
##########
@@ -152,6 +160,14 @@ static class FateOpts extends ServerOpts {
     @Parameter(names = {"-i", "--info"},
         description = "Includes detailed transaction information when 
printing")
     boolean printDetails;
+
+    @Parameter(names = {"-n", "--numSplits"},
+        description = "Generate N split points for the fate table and print to 
stdout. N should always be greater than 1.")

Review Comment:
   ```suggestion
       @Parameter(names = {"-n", "--num-splits"},
           description = "Generate N split points for the fate table and print 
to stdout. N must be >= 1.")
   ```



##########
server/base/src/main/java/org/apache/accumulo/server/util/adminCommand/Fate.java:
##########
@@ -267,6 +287,38 @@ public void execute(JCommander cl, FateOpts options) 
throws Exception {
     }
   }
 
+  private void preSplitFateTable(FateOpts options) throws Exception {
+    List<String> splits = generateSplits(options.numSplits);
+
+    if (options.splitsFile != null) {
+      try (PrintWriter writer = new PrintWriter(new BufferedWriter(
+          new 
OutputStreamWriter(Files.newOutputStream(Path.of(options.splitsFile)), 
UTF_8)))) {

Review Comment:
   I usually try not to nest constructors in a try-with-resources block. 
Usually things work out okay but putting each object constructed on its own 
line makes it more certain that each object will be cleaned up properly in the 
try-with-resources block as opposed to relying on the closure of the outmost 
object to cascade down and close the rest. 



##########
server/base/src/main/java/org/apache/accumulo/server/util/adminCommand/Fate.java:
##########
@@ -152,6 +160,14 @@ static class FateOpts extends ServerOpts {
     @Parameter(names = {"-i", "--info"},
         description = "Includes detailed transaction information when 
printing")
     boolean printDetails;
+
+    @Parameter(names = {"-n", "--numSplits"},
+        description = "Generate N split points for the fate table and print to 
stdout. N should always be greater than 1.")
+    int numSplits = 1;

Review Comment:
   ```suggestion
       int numSplits = -1;
   ```
   I think we need to default to -1 here so that split generation is opt-in. If 
we leave it as `1`, every fate invocation takes the numSplits > 0 branch and 
returns before normal commands like `--print`, `--cancel`, etc. can run



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

Reply via email to