You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2022/07/07 18:07:30 UTC

[GitHub] [accumulo] EdColeman commented on a diff in pull request #2801: Add fate summary command option

EdColeman commented on code in PR #2801:
URL: https://github.com/apache/accumulo/pull/2801#discussion_r916151318


##########
test/src/main/java/org/apache/accumulo/test/shell/ShellServerIT.java:
##########
@@ -2139,6 +2139,100 @@ public void testFateCommandWithSlowCompaction() throws Exception {
     if (orgProps != null) {
       System.setProperty("accumulo.properties", orgProps);
     }
+  }
+
+  @Test
+  public void testFateSummaryCommandWithSlowCompaction() throws Exception {
+    String namespace = "ns1";
+    final String table = namespace + "." + getUniqueNames(1)[0];
 
+    String orgProps = System.getProperty("accumulo.properties");
+
+    System.setProperty("accumulo.properties",
+        "file://" + getCluster().getConfig().getAccumuloPropsFile().getCanonicalPath());
+    // compact
+    ts.exec("createnamespace " + namespace);
+    ts.exec("createtable " + table);
+    ts.exec("addsplits h m r w -t " + table);
+    ts.exec("offline -t " + table);
+    ts.exec("online h m r w -t " + table);
+
+    // setup SlowIterator to sleep for 10 seconds
+    ts.exec("config -t " + table
+        + " -s table.iterator.majc.slow=1,org.apache.accumulo.test.functional.SlowIterator");
+    ts.exec("config -t " + table + " -s table.iterator.majc.slow.opt.sleepTime=10000");
+
+    // make two files
+    ts.exec("insert a1 b c v_a1");
+    ts.exec("insert a2 b c v_a2");
+    ts.exec("flush -w");
+    ts.exec("insert x1 b c v_x1");
+    ts.exec("insert x2 b c v_x2");
+    ts.exec("flush -w");
+
+    // no transactions running
+
+    String cmdOut =
+        ts.exec("fate -summary -np json -t NEW IN_PROGRESS FAILED", true, "reportTime", true);
+    // strip command included in shell output
+    String jsonOut = cmdOut.substring(cmdOut.indexOf("{"));
+    SummaryReport report = SummaryReport.fromJson(jsonOut);
+
+    // validate blank report
+    assertNotNull(report);
+    assertNotEquals(0, report.getReportTime());
+    assertEquals(Set.of("NEW", "IN_PROGRESS", "FAILED"), report.getStatusFilterNames());
+    assertEquals(Map.of(), report.getStatusCounts());
+    assertEquals(Map.of(), report.getStepCounts());
+    assertEquals(Map.of(), report.getCmdCounts());
+    assertEquals(Set.of(), report.getFateDetails());
+
+    ts.exec("fate -summary -np", true, "Report Time:", true);
+
+    // merge two files into one
+    ts.exec("compact -t " + table);
+    Thread.sleep(1_000);
+    // start 2nd transaction
+    ts.exec("compact -t " + table);
+    Thread.sleep(3_000);
+
+    // 2 compactions should be running so parse the output to get one of the transaction ids
+    log.debug("Calling fate summary");
+    ts.exec("fate -summary -np", true, "Report Time:", true);

Review Comment:
   It is testing different option configurations, In this case no filters.  The first call 
   ```
   ts.exec("fate -summary -np", true, "Report Time:", true);
   ```
   basically checks the output is created - the call succeeds and has a report time.  The second call asks for json output (and no filters) - with the json, it is easier to validate additional things, more that the command didn't 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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org