use of org.apache.ignite.internal.processors.tracing.MTC.TraceSurroundings in project ignite by apache.
the class RegisteredQueryCursor method cancel.
/**
* Cancels query.
*/
public void cancel() {
try (TraceSurroundings ignored = MTC.support(tracing.create(SQL_CURSOR_CANCEL, qrySpan))) {
if (failReason == null)
failReason = new QueryCancelledException();
qrySpan.addTag(ERROR, failReason::getMessage);
close();
}
}
use of org.apache.ignite.internal.processors.tracing.MTC.TraceSurroundings in project ignite by apache.
the class QueryParser method parse.
/**
* Parse the query.
*
* @param schemaName schema name.
* @param qry query to parse.
* @param remainingAllowed Whether multiple statements are allowed.
* @return Parsing result that contains Parsed leading query and remaining sql script.
*/
public QueryParserResult parse(String schemaName, SqlFieldsQuery qry, boolean remainingAllowed) {
try (TraceSurroundings ignored = MTC.support(idx.kernalContext().tracing().create(SQL_QRY_PARSE, MTC.span()))) {
QueryParserResult res = parse0(schemaName, qry, remainingAllowed);
checkQueryType(qry, res.isSelect());
return res;
}
}
use of org.apache.ignite.internal.processors.tracing.MTC.TraceSurroundings in project ignite by apache.
the class GridReduceQueryExecutor method onNextPage.
/**
* @param node Node.
* @param msg Message.
*/
public void onNextPage(final ClusterNode node, final GridQueryNextPageResponse msg) {
try (TraceSurroundings ignored = MTC.support(ctx.tracing().create(SQL_PAGE_RESP, MTC.span()))) {
final long qryReqId = msg.queryRequestId();
final int qry = msg.query();
final int seg = msg.segmentId();
final ReduceQueryRun r = runs.get(qryReqId);
if (// Already finished with error or canceled.
r == null)
return;
final int pageSize = r.pageSize();
Reducer idx = r.reducers().get(msg.query());
ReduceResultPage page;
try {
page = new ReduceResultPage(ctx, node.id(), msg) {
@Override
public void fetchNextPage() {
if (r.hasErrorOrRetry()) {
if (r.exception() != null)
throw r.exception();
assert r.retryCause() != null;
throw new CacheException(r.retryCause());
}
try {
GridQueryNextPageRequest msg0 = new GridQueryNextPageRequest(qryReqId, qry, seg, pageSize, (byte) GridH2QueryRequest.setDataPageScanEnabled(0, r.isDataPageScanEnabled()));
if (node.isLocal())
h2.mapQueryExecutor().onNextPageRequest(node, msg0);
else
ctx.io().sendToGridTopic(node, GridTopic.TOPIC_QUERY, msg0, GridIoPolicy.QUERY_POOL);
} catch (IgniteCheckedException e) {
throw new CacheException("Failed to fetch data from node: " + node.id(), e);
}
}
};
} catch (Exception e) {
U.error(log, "Error in message.", e);
MTC.span().addTag(ERROR, e::getMessage);
fail(r, node.id(), "Error in message.", GridQueryFailResponse.GENERAL_ERROR);
return;
}
idx.addPage(page);
if (msg.retry() != null)
r.setStateOnRetry(node.id(), msg.retry(), msg.retryCause());
else if (// Count down only on each first page received.
msg.page() == 0)
r.onFirstPage();
}
}
use of org.apache.ignite.internal.processors.tracing.MTC.TraceSurroundings in project ignite by apache.
the class GridReduceQueryExecutor method onFail.
/**
* @param node Node.
* @param msg Message.
*/
public void onFail(ClusterNode node, GridQueryFailResponse msg) {
try (TraceSurroundings ignored = MTC.support(ctx.tracing().create(SQL_FAIL_RESP, MTC.span()))) {
ReduceQueryRun r = runs.get(msg.queryRequestId());
fail(r, node.id(), msg.error(), msg.failCode());
}
}
use of org.apache.ignite.internal.processors.tracing.MTC.TraceSurroundings in project ignite by apache.
the class GridReduceQueryExecutor method onDmlResponse.
/**
* Process response for DML request.
*
* @param node Node.
* @param msg Message.
*/
public void onDmlResponse(final ClusterNode node, GridH2DmlResponse msg) {
try (TraceSurroundings ignored = MTC.support(ctx.tracing().create(SQL_DML_QRY_RESP, MTC.span()))) {
long reqId = msg.requestId();
DmlDistributedUpdateRun r = updRuns.get(reqId);
if (r == null) {
U.warn(log, "Unexpected dml response (will ignore). [localNodeId=" + ctx.localNodeId() + ", nodeId=" + node.id() + ", msg=" + msg.toString() + ']');
return;
}
r.handleResponse(node.id(), msg);
} catch (Exception e) {
U.error(log, "Error in dml response processing. [localNodeId=" + ctx.localNodeId() + ", nodeId=" + node.id() + ", msg=" + msg.toString() + ']', e);
}
}
Aggregations