use of org.apache.ignite.internal.processors.query.h2.ConnectionManager in project ignite by apache.
the class ValidateIndexesClosure method mvccSession.
/**
* Get session with MVCC snapshot and QueryContext.
*
* @param cctx Cache context.
* @return Session with QueryContext and MVCC snapshot.
* @throws IgniteCheckedException If failed.
*/
private Session mvccSession(GridCacheContext<?, ?> cctx) throws IgniteCheckedException {
Session session = null;
boolean mvccEnabled = cctx.mvccEnabled();
if (mvccEnabled) {
ConnectionManager connMgr = ((IgniteH2Indexing) ignite.context().query().getIndexing()).connections();
JdbcConnection connection = (JdbcConnection) connMgr.connection().connection();
session = (Session) connection.getSession();
MvccQueryTracker tracker = MvccUtils.mvccTracker(cctx, true);
MvccSnapshot mvccSnapshot = tracker.snapshot();
final QueryContext qctx = new QueryContext(0, cacheName -> null, null, mvccSnapshot, null, true);
session.setVariable(H2Utils.QCTX_VARIABLE_NAME, new H2Utils.ValueRuntimeSimpleObject<>(qctx));
}
return session;
}
use of org.apache.ignite.internal.processors.query.h2.ConnectionManager in project ignite by apache.
the class JdbcThinTransactionsLeaksMvccTest method usedConnectionCount.
/**
* @param igx Node.
* @return Count of detached connections.
*/
private int usedConnectionCount(IgniteEx igx) {
ConnectionManager connMgr = ((IgniteH2Indexing) igx.context().query().getIndexing()).connections();
Set<H2Connection> usedConns = GridTestUtils.getFieldValue(connMgr, "usedConns");
return usedConns.size();
}
use of org.apache.ignite.internal.processors.query.h2.ConnectionManager in project ignite by apache.
the class IgniteH2Indexing method start.
/**
* {@inheritDoc}
*/
@SuppressWarnings({ "deprecation", "AssignmentToStaticFieldFromInstanceMethod" })
@Override
public void start(GridKernalContext ctx, GridSpinBusyLock busyLock) throws IgniteCheckedException {
if (log.isDebugEnabled())
log.debug("Starting cache query index...");
this.busyLock = busyLock;
if (SysProperties.serializeJavaObject) {
U.warn(log, "Serialization of Java objects in H2 was enabled.");
SysProperties.serializeJavaObject = false;
}
this.ctx = ctx;
partReservationMgr = new PartitionReservationManager(ctx);
connMgr = new ConnectionManager(ctx);
longRunningQryMgr = new LongRunningQueryManager(ctx);
parser = new QueryParser(this, connMgr);
schemaMgr = new SchemaManager(ctx, connMgr);
schemaMgr.start(ctx.config().getSqlConfiguration().getSqlSchemas());
statsMgr = new IgniteStatisticsManagerImpl(ctx, schemaMgr);
nodeId = ctx.localNodeId();
marshaller = ctx.config().getMarshaller();
mapQryExec = new GridMapQueryExecutor();
rdcQryExec = new GridReduceQueryExecutor();
mapQryExec.start(ctx, this);
rdcQryExec.start(ctx, this);
discoLsnr = evt -> {
mapQryExec.onNodeLeft((DiscoveryEvent) evt);
rdcQryExec.onNodeLeft((DiscoveryEvent) evt);
};
ctx.event().addLocalEventListener(discoLsnr, EventType.EVT_NODE_FAILED, EventType.EVT_NODE_LEFT);
qryLsnr = (nodeId, msg, plc) -> onMessage(nodeId, msg);
ctx.io().addMessageListener(GridTopic.TOPIC_QUERY, qryLsnr);
runningQryMgr = new RunningQueryManager(ctx);
partExtractor = new PartitionExtractor(new H2PartitionResolver(this), ctx);
cmdProc = new CommandProcessor(ctx, schemaMgr, this);
cmdProc.start();
if (JdbcUtils.serializer != null)
U.warn(log, "Custom H2 serialization is already configured, will override.");
JdbcUtils.serializer = h2Serializer();
distrCfg = new DistributedSqlConfiguration(ctx, log);
funcMgr = new FunctionsManager(distrCfg);
}
Aggregations