use of org.neo4j.kernel.impl.query.QueryExecutionKernelException in project neo4j by neo4j.
the class Start method exec.
@Override
protected Continuation exec(AppCommandParser parser, Session session, Output out) throws ShellException, RemoteException {
String query = parser.getLine().trim();
if (isComplete(query)) {
final long startTime = System.currentTimeMillis();
try {
Result result = getResult(trimQuery(query), session);
handleResult(out, result, startTime);
} catch (QueryExecutionKernelException e) {
handleException(out, e, startTime);
return Continuation.EXCEPTION_CAUGHT;
}
return Continuation.INPUT_COMPLETE;
} else {
return Continuation.INPUT_INCOMPLETE;
}
}
use of org.neo4j.kernel.impl.query.QueryExecutionKernelException in project neo4j by neo4j.
the class TransactionStateMachineSPI method executeQuery.
@Override
public BoltResultHandle executeQuery(BoltQuerySource querySource, SecurityContext securityContext, String statement, Map<String, Object> params, ThrowingAction<KernelException> onFail) throws QueryExecutionKernelException {
InternalTransaction internalTransaction = queryService.beginTransaction(implicit, securityContext);
ClientConnectionInfo sourceDetails = new BoltConnectionInfo(querySource.principalName, querySource.clientName, querySource.connectionDescriptor.clientAddress, querySource.connectionDescriptor.serverAddress);
TransactionalContext transactionalContext = contextFactory.newContext(sourceDetails, internalTransaction, statement, params);
return new BoltResultHandle() {
@Override
public BoltResult start() throws KernelException {
try {
Result run = queryExecutionEngine.executeQuery(statement, params, transactionalContext);
return new CypherAdapterStream(run, clock);
} catch (KernelException e) {
onFail.apply();
throw new QueryExecutionKernelException(e);
} catch (Throwable e) {
onFail.apply();
throw e;
}
}
@Override
public void terminate() {
transactionalContext.terminate();
}
};
}
use of org.neo4j.kernel.impl.query.QueryExecutionKernelException in project neo4j by neo4j.
the class Invocation method executeStatement.
private void executeStatement(Statement statement) throws Exception {
boolean periodicCommit = transactionHandle.isPeriodicCommit(statement.getStatement());
if (periodicCommit) {
if (hasPrevious || readStatement() != null) {
throw new QueryExecutionKernelException(new InvalidSemanticsException("Cannot execute another statement with PERIODIC COMMIT statement in the same transaction", null));
}
transactionHandle.closeTransactionForPeriodicCommit();
}
hasPrevious = true;
Result result;
try {
result = transactionHandle.executeStatement(statement, periodicCommit);
} finally {
if (periodicCommit) {
transactionHandle.reopenAfterPeriodicCommit();
}
}
writeResult(result, statement);
}
use of org.neo4j.kernel.impl.query.QueryExecutionKernelException in project neo4j by neo4j.
the class TransactionImpl method execute.
private Result execute(InternalTransaction transaction, String query, MapValue parameters) throws QueryExecutionException {
checkInTransaction();
TransactionalContext context = contextFactory.newContext(transaction, query, parameters);
try {
availabilityGuard.assertDatabaseAvailable();
return executionEngine.executeQuery(query, parameters, context, false);
} catch (UnavailableException ue) {
throw new org.neo4j.graphdb.TransactionFailureException(ue.getMessage(), ue);
} catch (QueryExecutionKernelException e) {
throw e.asUserException();
}
}
use of org.neo4j.kernel.impl.query.QueryExecutionKernelException in project neo4j by neo4j.
the class SnapshotExecutionEngineTest method failQueryAfterMaxRetriesReached.
@Test
void failQueryAfterMaxRetriesReached() throws QueryExecutionKernelException {
when(versionContext.isDirty()).thenReturn(true);
QueryExecutionKernelException e = assertThrows(QueryExecutionKernelException.class, () -> executionEngine.executeWithRetries("query", transactionalContext, executor));
assertEquals("Unable to get clean data snapshot for query 'query' after 5 attempts.", e.getMessage());
verify(executor, times(5)).execute(any());
verify(versionContext, times(5)).initRead();
}
Aggregations