use of org.voltdb.AuthSystem.AuthUser in project voltdb by VoltDB.
the class Iv2TransactionCreator method dispatch.
@Override
public ClientResponseImpl dispatch(StoredProcedureInvocation invocation, Connection connection, boolean isAdmin, OverrideCheck bypass) {
final InvocationClientHandler handler = new InvocationClientHandler() {
final boolean adminFlag = isAdmin;
final long connectionId = connection.connectionId();
@Override
public boolean isAdmin() {
return adminFlag;
}
@Override
public long connectionId() {
return connectionId;
}
};
AuthUser admin = m_ci.getCatalogContext().authSystem.getInternalAdminUser();
return m_ci.getDispatcher().dispatch(invocation, handler, connection, admin, bypass, false);
}
use of org.voltdb.AuthSystem.AuthUser in project voltdb by VoltDB.
the class InternalConnectionHandler method callProcedure.
// Use null backPressurePredicate for no back pressure
public boolean callProcedure(InternalConnectionContext caller, Function<Integer, Boolean> backPressurePredicate, InternalConnectionStatsCollector statsCollector, ProcedureCallback procCallback, String proc, Object... fieldList) {
Procedure catProc = InvocationDispatcher.getProcedureFromName(proc, getCatalogContext());
if (catProc == null) {
String fmt = "Cannot invoke procedure %s from streaming interface %s. Procedure not found.";
m_logger.rateLimitedLog(SUPPRESS_INTERVAL, Level.ERROR, null, fmt, proc, caller);
m_failedCount.incrementAndGet();
return false;
}
StoredProcedureInvocation task = new StoredProcedureInvocation();
task.setProcName(proc);
task.setParams(fieldList);
try {
task = MiscUtils.roundTripForCL(task);
} catch (Exception e) {
String fmt = "Cannot invoke procedure %s from streaming interface %s. failed to create task.";
m_logger.rateLimitedLog(SUPPRESS_INTERVAL, Level.ERROR, null, fmt, proc, caller);
m_failedCount.incrementAndGet();
return false;
}
int partition = -1;
try {
partition = InvocationDispatcher.getPartitionForProcedure(catProc, task);
} catch (Exception e) {
String fmt = "Can not invoke procedure %s from streaming interface %s. Partition not found.";
m_logger.rateLimitedLog(SUPPRESS_INTERVAL, Level.ERROR, e, fmt, proc, caller);
m_failedCount.incrementAndGet();
return false;
}
final InternalClientResponseAdapter adapter = m_adapters.get(partition);
InternalAdapterTaskAttributes kattrs = new InternalAdapterTaskAttributes(caller, adapter.connectionId());
final AuthUser user = getCatalogContext().authSystem.getImporterUser();
if (!adapter.createTransaction(kattrs, proc, catProc, procCallback, statsCollector, task, user, partition, false, backPressurePredicate)) {
m_failedCount.incrementAndGet();
return false;
}
m_submitSuccessCount.incrementAndGet();
return true;
}
use of org.voltdb.AuthSystem.AuthUser in project voltdb by VoltDB.
the class ClientInterface method handleRead.
/**
*
* * return True if an error was generated and needs to be returned to the client
*/
final ClientResponseImpl handleRead(ByteBuffer buf, ClientInputHandler handler, Connection ccxn) {
StoredProcedureInvocation task = new StoredProcedureInvocation();
try {
task.initFromBuffer(buf);
} catch (Exception ex) {
return new ClientResponseImpl(ClientResponseImpl.UNEXPECTED_FAILURE, new VoltTable[0], ex.getMessage(), ccxn.connectionId());
}
AuthUser user = m_catalogContext.get().authSystem.getUser(handler.getUserName());
if (user == null) {
String errorMessage = "User " + handler.getUserName() + " has been removed from the system via a catalog update";
authLog.info(errorMessage);
return errorResponse(ccxn, task.clientHandle, ClientResponse.UNEXPECTED_FAILURE, errorMessage, null, false);
}
final ClientResponseImpl errResp = m_dispatcher.dispatch(task, handler, ccxn, user, null, false);
if (errResp != null) {
final VoltTrace.TraceEventBatch traceLog = VoltTrace.log(VoltTrace.Category.CI);
if (traceLog != null) {
traceLog.add(() -> VoltTrace.endAsync("recvtxn", task.getClientHandle(), "status", Byte.toString(errResp.getStatus()), "statusString", errResp.getStatusString()));
}
}
return errResp;
}
Aggregations