Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

igIgnite 2.5.1 p164 logqry #135

Open
wants to merge 4 commits into
base: ignite-2.5.1-p164
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public class SqlFieldsQuery extends Query<List<?>> {
private boolean lazy;

/** Partitions for query */
@GridToStringInclude
private int[] parts;

/** Schema. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.NoSuchElementException;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cluster.ClusterNode;
Expand All @@ -50,7 +51,6 @@
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteReducer;
import org.jetbrains.annotations.Nullable;
import java.util.concurrent.ConcurrentHashMap;

import static org.apache.ignite.cache.CacheMode.LOCAL;
import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
Expand Down Expand Up @@ -518,8 +518,8 @@ else if (!cancelled.contains(res.requestId()))
@Override public CacheQueryFuture<?> queryDistributed(GridCacheQueryBean qry, final Collection<ClusterNode> nodes) {
assert cctx.config().getCacheMode() != LOCAL;

if (log.isDebugEnabled())
log.debug("Executing distributed query: " + qry);
if (log.isInfoEnabled())
log.info("Executing distributed query: " + qry);

long reqId = cctx.io().nextIoId();

Expand Down Expand Up @@ -718,8 +718,8 @@ private Object convert(Object obj) {
Collection<ClusterNode> nodes) {
assert cctx.config().getCacheMode() != LOCAL;

if (log.isDebugEnabled())
log.debug("Executing distributed query: " + qry);
if (log.isInfoEnabled())
log.info("Executing distributed query: " + qry);

long reqId = cctx.io().nextIoId();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ public class GridCacheLocalQueryManager<K, V> extends GridCacheQueryManager<K, V
@Override public CacheQueryFuture<?> queryFieldsLocal(GridCacheQueryBean qry) {
assert cctx.config().getCacheMode() == LOCAL;

if (log.isDebugEnabled())
log.debug("Executing query on local node: " + qry);
if (log.isInfoEnabled())
log.info("Executing query on local node: " + qry);

GridCacheLocalFieldsQueryFuture fut = new GridCacheLocalFieldsQueryFuture(cctx, qry);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtUnreservedPartitionException;
import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor;
import org.apache.ignite.internal.processors.datastructures.GridSetQueryPredicate;
Expand Down Expand Up @@ -449,8 +449,8 @@ public void remove(KeyCacheObject key, @Nullable CacheDataRow prevRow) throws Ig
CacheQueryFuture<?> queryLocal(GridCacheQueryBean qry) {
assert qry.query().type() != GridCacheQueryType.SCAN : qry;

if (log.isDebugEnabled())
log.debug("Executing query on local node: " + qry);
if (log.isInfoEnabled())
log.info("Executing query on local node: " + qry);

GridCacheLocalQueryFuture fut = new GridCacheLocalQueryFuture<>(cctx, qry);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,39 +114,40 @@
import org.apache.ignite.internal.processors.query.h2.sql.GridSqlQuerySplitter;
import org.apache.ignite.internal.processors.query.h2.sql.GridSqlStatement;
import org.apache.ignite.internal.processors.query.h2.sys.SqlSystemTableEngine;
import org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemView;
import org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemViewBaselineNodes;
import org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemViewNodeAttributes;
import org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemViewNodeMetrics;
import org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemViewNodes;
import org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor;
import org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor;
import org.apache.ignite.internal.processors.query.h2.twostep.MapQueryLazyWorker;
import org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemView;
import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitor;
import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitorClosure;
import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitorImpl;
import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
import org.apache.ignite.internal.sql.SqlParseException;
import org.apache.ignite.internal.sql.SqlParser;
import org.apache.ignite.internal.sql.command.SqlAlterTableCommand;
import org.apache.ignite.internal.sql.command.SqlBulkLoadCommand;
import org.apache.ignite.internal.sql.command.SqlAlterUserCommand;
import org.apache.ignite.internal.sql.command.SqlBulkLoadCommand;
import org.apache.ignite.internal.sql.command.SqlCommand;
import org.apache.ignite.internal.sql.command.SqlCreateIndexCommand;
import org.apache.ignite.internal.sql.command.SqlCreateUserCommand;
import org.apache.ignite.internal.sql.command.SqlDropIndexCommand;
import org.apache.ignite.internal.sql.command.SqlSetStreamingCommand;
import org.apache.ignite.internal.sql.command.SqlDropUserCommand;
import org.apache.ignite.internal.sql.command.SqlSetStreamingCommand;
import org.apache.ignite.internal.util.GridBoundedConcurrentLinkedHashMap;
import org.apache.ignite.internal.util.GridEmptyCloseableIterator;
import org.apache.ignite.internal.util.GridSpinBusyLock;
import org.apache.ignite.internal.util.GridStringBuilder;
import org.apache.ignite.internal.util.lang.GridCloseableIterator;
import org.apache.ignite.internal.util.lang.GridPlainRunnable;
import org.apache.ignite.internal.util.lang.IgniteInClosure2X;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.LT;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiClosure;
Expand All @@ -166,6 +167,7 @@
import org.h2.engine.Session;
import org.h2.engine.SysProperties;
import org.h2.index.Index;
import org.h2.jdbc.JdbcResultSet;
import org.h2.jdbc.JdbcStatement;
import org.h2.server.web.WebServer;
import org.h2.table.IndexColumn;
Expand Down Expand Up @@ -1254,8 +1256,24 @@ private ResultSet executeSqlQueryWithTimer(PreparedStatement stmt, Connection co
long start = U.currentTimeMillis();

try {

if (log.isInfoEnabled()) {
String msg = "Executing query sql=" + sql + '\'' +
", parameters=" + (params == null ? "[]" : Arrays.deepToString(params.toArray())) + "]" +
", lazy=" + (MapQueryLazyWorker.currentWorker() != null) ;

log.info(msg);
}

ResultSet rs = executeSqlQuery(conn, stmt, timeoutMillis, cancel);

if (log.isInfoEnabled()) {
if (rs instanceof JdbcResultSet)
log.info(" ResultSet: " + S.toString(JdbcResultSet.class, (JdbcResultSet)rs));
else
log.info(" ResultSet class: " + rs.getClass());
}

long time = U.currentTimeMillis() - start;

long longQryExecTimeout = ctx.config().getLongQueryWarningTimeout();
Expand Down Expand Up @@ -1303,6 +1321,19 @@ public void bindParameters(PreparedStatement stmt,
/** {@inheritDoc} */
@Override public FieldsQueryCursor<List<?>> queryLocalSqlFields(String schemaName, SqlFieldsQuery qry,
final boolean keepBinary, IndexingQueryFilter filter, GridQueryCancel cancel) throws IgniteCheckedException {

if (log.isInfoEnabled()) {
GridStringBuilder sb = new GridStringBuilder("Local query stack trace:");

U.printStackTrace(
Thread.currentThread().getId(),
sb);

String msg = sb.toString();

log.info(msg);
}

String sql = qry.getSql();
Object[] args = qry.getArgs();

Expand Down Expand Up @@ -1804,13 +1835,16 @@ private List<? extends FieldsQueryCursor<List<?>>> doRunPrepared(String schemaNa
}

if (twoStepQry != null) {
if (log.isDebugEnabled())
log.debug("Parsed query: `" + sqlQry + "` into two step query: " + twoStepQry);
if (log.isInfoEnabled())
log.info("Executing query distributed: '" + qry + "' into two step query: " + twoStepQry);

checkQueryType(qry, true);

return Collections.singletonList(doRunDistributedQuery(schemaName, qry, twoStepQry, meta, keepBinary,
cancel));
} else {
if (log.isInfoEnabled())
log.info("Executing query local: '" + qry+ "'");
}

// We've encountered a local query, let's just run it.
Expand Down