Search in sources :

Example 1 with GridQueryFailResponse

use of org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse in project ignite by apache.

the class GridMapQueryExecutor method sendError.

/**
 * @param node Node.
 * @param qryReqId Query request ID.
 * @param err Error.
 */
private void sendError(ClusterNode node, long qryReqId, Throwable err) {
    try {
        GridQueryFailResponse msg = new GridQueryFailResponse(qryReqId, err);
        if (node.isLocal()) {
            U.error(log, "Failed to run map query on local node.", err);
            h2.reduceQueryExecutor().onMessage(ctx.localNodeId(), msg);
        } else
            ctx.io().sendToGridTopic(node, GridTopic.TOPIC_QUERY, msg, QUERY_POOL);
    } catch (Exception e) {
        e.addSuppressed(err);
        U.error(log, "Failed to send error message.", e);
    }
}
Also used : GridQueryFailResponse(org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse) QueryCancelledException(org.apache.ignite.cache.query.QueryCancelledException) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) IgniteException(org.apache.ignite.IgniteException) GridH2RetryException(org.apache.ignite.internal.processors.query.h2.opt.GridH2RetryException) CacheException(javax.cache.CacheException)

Example 2 with GridQueryFailResponse

use of org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse in project ignite by apache.

the class GridReduceQueryExecutor method onMessage.

/**
 * @param nodeId Node ID.
 * @param msg Message.
 */
public void onMessage(UUID nodeId, Object msg) {
    try {
        assert msg != null;
        ClusterNode node = ctx.discovery().node(nodeId);
        if (node == null)
            // Node left, ignore.
            return;
        boolean processed = true;
        if (msg instanceof GridQueryNextPageResponse)
            onNextPage(node, (GridQueryNextPageResponse) msg);
        else if (msg instanceof GridQueryFailResponse)
            onFail(node, (GridQueryFailResponse) msg);
        else if (msg instanceof GridH2DmlResponse)
            onDmlResponse(node, (GridH2DmlResponse) msg);
        else
            processed = false;
        if (processed && log.isDebugEnabled())
            log.debug("Processed response: " + nodeId + "->" + ctx.localNodeId() + " " + msg);
    } catch (Throwable th) {
        U.error(log, "Failed to process message: " + msg, th);
    }
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) GridQueryFailResponse(org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse) GridQueryNextPageResponse(org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageResponse) GridH2DmlResponse(org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2DmlResponse)

Aggregations

GridQueryFailResponse (org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse)2 CacheException (javax.cache.CacheException)1 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 IgniteException (org.apache.ignite.IgniteException)1 QueryCancelledException (org.apache.ignite.cache.query.QueryCancelledException)1 ClusterNode (org.apache.ignite.cluster.ClusterNode)1 GridH2RetryException (org.apache.ignite.internal.processors.query.h2.opt.GridH2RetryException)1 GridQueryNextPageResponse (org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageResponse)1 GridH2DmlResponse (org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2DmlResponse)1