/** {@inheritDoc} */ @Override public <R> QueryCursor<R> query(Query<R> qry) { CacheOperationGate opGate = onEnter(); try { return delegate.query(qry); } finally { onLeave(opGate); } }
/** {@inheritDoc} */ @Override public FieldsQueryCursor<List<?>> query(SqlFieldsQuery qry) { CacheOperationGate opGate = onEnter(); try { return delegate.query(qry); } finally { onLeave(opGate); } }
/** {@inheritDoc} */ @Override public <T, R> QueryCursor<R> query(Query<T> qry, IgniteClosure<T, R> transformer) { CacheOperationGate opGate = onEnter(); try { return delegate.query(qry, transformer); } finally { onLeave(opGate); } }
/** * Runs specified query. * * @param qry Query. * @return Query cursor. * @throws IgniteCheckedException On error. */ private PlatformQueryCursor runQuery(Query qry) throws IgniteCheckedException { try { QueryCursorEx cursor = (QueryCursorEx) cache.query(qry); return new PlatformQueryCursor(platformCtx, cursor, qry.getPageSize() > 0 ? qry.getPageSize(): Query.DFLT_PAGE_SIZE); } catch (Exception err) { throw PlatformUtils.unwrapQueryException(err); } }
/** * Runs specified fields query. * * @param qry Query. * @return Query cursor. * @throws IgniteCheckedException On error. */ private PlatformFieldsQueryCursor runFieldsQuery(Query qry) throws IgniteCheckedException { try { QueryCursorEx cursor = (QueryCursorEx) cache.query(qry); return new PlatformFieldsQueryCursor(platformCtx, cursor, qry.getPageSize() > 0 ? qry.getPageSize() : Query.DFLT_PAGE_SIZE); } catch (Exception err) { throw PlatformUtils.unwrapQueryException(err); } }
qry.setInitialQuery(initialQry); cursor = cache.query(qry.setLocal(loc));
/** * Scan (with explicit {@code setLocal(true)}, no partition specified) should perform on the local node. * * @throws Exception If failed. */ @Test public void testScanLocalExplicitNoPart() throws Exception { cacheMode = CacheMode.PARTITIONED; backups = 0; commSpiFactory = new TestLocalCommunicationSpiFactory(); try { Ignite ignite = startGrids(GRID_CNT); IgniteCacheProxy<Integer, Integer> cache = fillCache(ignite); QueryCursor<Cache.Entry<Integer, Integer>> qry = cache.query(new ScanQuery<Integer, Integer>().setLocal(true)); assertFalse(qry.getAll().isEmpty()); } finally { stopAllGrids(); } }
/** * Scan should perform on the local node. * * @throws Exception If failed. */ @Test public void testScanLocal() throws Exception { cacheMode = CacheMode.PARTITIONED; backups = 0; commSpiFactory = new TestLocalCommunicationSpiFactory(); try { Ignite ignite = startGrids(GRID_CNT); IgniteCacheProxy<Integer, Integer> cache = fillCache(ignite); int part = anyLocalPartition(cache.context()); QueryCursor<Cache.Entry<Integer, Integer>> qry = cache.query(new ScanQuery<Integer, Integer>().setPartition(part)); doTestScanQuery(qry, part); } finally { stopAllGrids(); } }
/** * Scan (with explicit {@code setLocal(true)}) should perform on the local node. * * @throws Exception If failed. */ @Test public void testScanLocalExplicit() throws Exception { cacheMode = CacheMode.PARTITIONED; backups = 0; commSpiFactory = new TestLocalCommunicationSpiFactory(); try { Ignite ignite = startGrids(GRID_CNT); IgniteCacheProxy<Integer, Integer> cache = fillCache(ignite); int part = anyLocalPartition(cache.context()); QueryCursor<Cache.Entry<Integer, Integer>> qry = cache.query(new ScanQuery<Integer, Integer>().setPartition(part).setLocal(true)); doTestScanQuery(qry, part); GridTestUtils.assertThrows(log, (Callable<Void>)() -> { int remPart = remotePartition(cache.context()).getKey(); cache.query(new ScanQuery<Integer, Integer>().setPartition(remPart).setLocal(true)); return null; }, IgniteCheckedException.class, null); } finally { stopAllGrids(); } }
/** * Scan should perform on the remote node. * * @throws Exception If failed. */ @Test public void testScanRemote() throws Exception { cacheMode = CacheMode.PARTITIONED; backups = 0; commSpiFactory = new TestRemoteCommunicationSpiFactory(); try { Ignite ignite = startGrids(GRID_CNT); IgniteCacheProxy<Integer, Integer> cache = fillCache(ignite); IgniteBiTuple<Integer, UUID> tup = remotePartition(cache.context()); int part = tup.get1(); expNodeId = tup.get2(); QueryCursor<Cache.Entry<Integer, Integer>> qry = cache.query(new ScanQuery<Integer, Integer>().setPartition(part)); doTestScanQuery(qry, part); } finally { stopAllGrids(); } }
/** {@inheritDoc} */ @Override public FieldsQueryCursor<List<?>> query(SqlFieldsQuery qry) { CacheOperationGate opGate = onEnter(); try { return delegate.query(qry); } finally { onLeave(opGate); } }
/** {@inheritDoc} */ @Override public <T, R> QueryCursor<R> query(Query<T> qry, IgniteClosure<T, R> transformer) { CacheOperationGate opGate = onEnter(); try { return delegate.query(qry, transformer); } finally { onLeave(opGate); } }
/** {@inheritDoc} */ @Override public <R> QueryCursor<R> query(Query<R> qry) { CacheOperationGate opGate = onEnter(); try { return delegate.query(qry); } finally { onLeave(opGate); } }
/** * Runs specified query. * * @param qry Query. * @return Query cursor. * @throws IgniteCheckedException On error. */ private PlatformQueryCursor runQuery(Query qry) throws IgniteCheckedException { try { QueryCursorEx cursor = (QueryCursorEx) cache.query(qry); return new PlatformQueryCursor(platformCtx, cursor, qry.getPageSize() > 0 ? qry.getPageSize(): Query.DFLT_PAGE_SIZE); } catch (Exception err) { throw PlatformUtils.unwrapQueryException(err); } }
/** * Runs specified fields query. * * @param qry Query. * @return Query cursor. * @throws IgniteCheckedException On error. */ private PlatformFieldsQueryCursor runFieldsQuery(Query qry) throws IgniteCheckedException { try { QueryCursorEx cursor = (QueryCursorEx) cache.query(qry); return new PlatformFieldsQueryCursor(platformCtx, cursor, qry.getPageSize() > 0 ? qry.getPageSize() : Query.DFLT_PAGE_SIZE); } catch (Exception err) { throw PlatformUtils.unwrapQueryException(err); } }
qry.setInitialQuery(initialQry); cursor = cache.query(qry.setLocal(loc));