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/06/01 15:52:29 UTC

[GitHub] [accumulo] DomGarguilo commented on a diff in pull request #2215: Remove the use of SiteConfiguration from FateCommand

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


##########
core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java:
##########
@@ -284,6 +287,42 @@ public void waitForBalance() throws AccumuloException {
 
   }
 
+  @Override
+  public void fateFail(List<String> txids) throws AccumuloException {
+    checkArgument(txids != null, "txids is null");
+    executeAdminOperation(AdminOperation.FAIL, txids, null);
+  }
+
+  @Override
+  public void fateDelete(List<String> txids) throws AccumuloException {
+    checkArgument(txids != null, "txids is null");
+    executeAdminOperation(AdminOperation.DELETE, txids, null);
+  }
+
+  @Override
+  public List<TransactionStatus> fateStatus(List<String> txids, List<String> tStatus)
+      throws AccumuloException {
+    checkArgument(txids != null, "txids is null");
+    List<TransactionStatus> txStatus = new ArrayList<>();
+    for (var tx : executeAdminOperation(AdminOperation.PRINT, txids, tStatus)) {
+      txStatus.add(new TransactionStatus(tx.getTxid(), tx.getTstatus(), tx.getDebug(),
+          tx.getHlocks(), tx.getWlocks(), tx.getTop(), tx.getTimecreated(), tx.getStackInfo()));
+    }
+    return txStatus;
+  }
+
+  private List<FateTransaction> executeAdminOperation(AdminOperation op, List<String> txids,
+      List<String> filterStatuses) throws AccumuloException {
+    try {
+      return ThriftClientTypes.CLIENT.execute(context,
+          client -> client.executeAdminOperation(TraceUtil.traceInfo(), context.rpcCreds(), op,
+              txids, filterStatuses));
+    } catch (AccumuloSecurityException e) {
+      throw new RuntimeException("Unexpected exception thrown", e);

Review Comment:
   @ctubbsii, how far up do you think it should propagate? Should it be caught and handled where `executeAdminOperation` is called, or propagate up even further than that?



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