ctubbsii commented on code in PR #6423:
URL: https://github.com/apache/accumulo/pull/6423#discussion_r3423152623
##########
server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CompactionCoordinator.java:
##########
@@ -880,18 +876,20 @@ public TExternalCompactionList
getCompletedCompactions(TInfo tinfo, TCredentials
@Override
public void cancel(TInfo tinfo, TCredentials credentials, String
externalCompactionId)
- throws TException {
+ throws ThriftSecurityException {
var runningCompaction =
RUNNING_CACHE.get(ExternalCompactionId.of(externalCompactionId));
var extent = KeyExtent.fromThrift(runningCompaction.getJob().getExtent());
try {
NamespaceId nsId = getContext().getNamespaceId(extent.tableId());
if (!security.canCompact(credentials, extent.tableId(), nsId)) {
- throw new AccumuloSecurityException(credentials.getPrincipal(),
- SecurityErrorCode.PERMISSION_DENIED).asThriftException();
+ throw new ThriftSecurityException(credentials.getPrincipal(),
+ SecurityErrorCode.PERMISSION_DENIED);
}
} catch (TableNotFoundException e) {
- throw new ThriftTableOperationException(extent.tableId().canonical(),
null,
- TableOperation.COMPACT_CANCEL, TableOperationExceptionType.NOTFOUND,
e.getMessage());
+ // if the table is deleted, there is no way to check user permissions to
cancel
+ // the system should handle this automatically
+ throw new ThriftSecurityException(credentials.getPrincipal(),
+ SecurityErrorCode.PERMISSION_DENIED);
Review Comment:
Sorry, correction, we discussed a few options. The one I am going with is
throwing a RTE. That will log the error on the server side, and get returned to
the client as a TApplicationException. This preserves the current behavior,
since the previously thrown thrift exception was not declared in the IDL, and
would have also triggered a TApplicationException. This does the same thing,
but "the right way" with a RTE.
--
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]