milleruntime commented on code in PR #2780: URL: https://github.com/apache/accumulo/pull/2780#discussion_r904076568
########## core/src/main/java/org/apache/accumulo/core/client/admin/FateOperations.java: ########## @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.accumulo.core.client.admin; + +import java.util.List; +import java.util.Set; + +import org.apache.accumulo.core.client.AccumuloException; + +public interface FateOperations { + + /** + * Fails a fate transaction based on the given txID. At least one txID must be provided. + * + * @param txids + * Transaction IDs to fail. + * @since 2.1.0 + */ + void fateFail(Set<String> txids) throws AccumuloException; + + /** + * Deletes a fate transaction based on the given txID. At least one txID must be provided. + * + * @param txids + * Transaction IDs to delete. + * @since 2.1.0 + */ + void fateDelete(Set<String> txids) throws AccumuloException; + + /** + * Gathers Transaction status information for either all fate transactions or requested txIDs. + * + * @param txids + * Transaction IDs to use as a filter. Optional. + * @param tStatus + * Parsed TStatus for print filter. Optional. + * @return A set of TransactionStatues for corresponding txids + * @since 2.1.0 + */ + List<FateTransactionStatus> fateStatus(Set<String> txids, List<String> tStatus) + throws AccumuloException; Review Comment: I think this will work. Here is a method in `FateCommand` that I got to compile: <pre> public void failTx(Shell shellState, List<String> txids) throws AccumuloException { shellState.getAccumuloClient().instanceOperations().fateTransactions().stream() .filter(fateTransaction -> txids.contains(fateTransaction.getId().canonical().toString())) .forEach(FateTransaction::fail); } </pre> Some things to note if we go with the `fail()` method hanging off of `FateTransactionImpl`. You will only be able to make calls to fail a single TX at a time. And we won't be able to have any checked exceptions thrown from `fail()`. So the `FateTransaction` interface method will just be: <pre> /** * Fails the fate transaction. * * @since 2.1.0 */ void fail(); </pre> I guess we could have another instance method that takes a `Set<FateTransaction>` if you want to fail a bunch at once. -- 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]
