use of org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery in project ignite by apache.
the class IgniteCachelessQueriesSelfTest method assertLocalTwoStepQuery.
/**
* Check that local two-step query has happened.
*/
private void assertLocalTwoStepQuery() {
GridCacheTwoStepQuery q = cachedTwoStepQuery();
assertNotNull(q);
assertTrue(q.isLocal());
}
use of org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery in project ignite by apache.
the class IgniteCachelessQueriesSelfTest method assertDistributedQuery.
/**
* Check that truly distributed query has happened.
*/
private void assertDistributedQuery() {
GridCacheTwoStepQuery q = cachedTwoStepQuery();
assertNotNull(q);
assertFalse(q.isLocal());
}
use of org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery in project ignite by apache.
the class IgniteH2Indexing method unregisterCache.
/** {@inheritDoc} */
@Override
public void unregisterCache(String cacheName) {
String schemaName = schema(cacheName);
boolean dflt = isDefaultSchema(schemaName);
H2Schema schema = dflt ? schemas.get(schemaName) : schemas.remove(schemaName);
if (schema != null) {
mapQryExec.onCacheStop(cacheName);
dmlProc.onCacheStop(cacheName);
// Remove this mapping only after callback to DML proc - it needs that mapping internally
cacheName2schema.remove(cacheName);
// Drop tables.
Collection<H2TableDescriptor> rmvTbls = new HashSet<>();
for (H2TableDescriptor tbl : schema.tables()) {
if (F.eq(tbl.cache().name(), cacheName)) {
try {
dropTable(tbl);
} catch (IgniteCheckedException e) {
U.error(log, "Failed to drop table on cache stop (will ignore): " + tbl.fullTableName(), e);
}
schema.drop(tbl);
rmvTbls.add(tbl);
}
}
if (!dflt) {
try {
dropSchema(schemaName);
} catch (IgniteCheckedException e) {
U.error(log, "Failed to drop schema on cache stop (will ignore): " + cacheName, e);
}
}
for (H2TableDescriptor tbl : rmvTbls) {
for (Index idx : tbl.table().getIndexes()) idx.close(null);
}
int cacheId = CU.cacheId(cacheName);
for (Iterator<Map.Entry<H2TwoStepCachedQueryKey, H2TwoStepCachedQuery>> it = twoStepCache.entrySet().iterator(); it.hasNext(); ) {
Map.Entry<H2TwoStepCachedQueryKey, H2TwoStepCachedQuery> e = it.next();
GridCacheTwoStepQuery qry = e.getValue().query();
if (!F.isEmpty(qry.cacheIds()) && qry.cacheIds().contains(cacheId))
it.remove();
}
}
}
use of org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery in project ignite by apache.
the class IgniteCachelessQueriesSelfTest method assertLocalQuery.
/**
* Check that no distributed query has happened.
*/
private void assertLocalQuery() {
GridCacheTwoStepQuery q = cachedTwoStepQuery();
assertNull(q);
}
use of org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery in project ignite by apache.
the class IgniteH2Indexing method split.
/**
* Split query into two-step query.
* @param prepared JDBC prepared statement.
* @param qry Original fields query.
* @return Two-step query.
* @throws IgniteCheckedException in case of error inside {@link GridSqlQuerySplitter}.
* @throws SQLException in case of error inside {@link GridSqlQuerySplitter}.
*/
private GridCacheTwoStepQuery split(Prepared prepared, SqlFieldsQuery qry) throws IgniteCheckedException, SQLException {
GridCacheTwoStepQuery res = GridSqlQuerySplitter.split(connectionForThread(qry.getSchema()), prepared, qry.getArgs(), qry.isCollocated(), qry.isDistributedJoins(), qry.isEnforceJoinOrder(), this);
List<Integer> cacheIds = collectCacheIds(null, res);
if (F.isEmpty(cacheIds))
res.local(true);
else {
res.cacheIds(cacheIds);
res.local(qry.isLocal());
}
res.pageSize(qry.getPageSize());
return res;
}
Aggregations