/** * @param ignite Ignite. */ private static WorkersRegistry getWorkersRegistry(Ignite ignite) { return ignite instanceof IgniteEx ? ((IgniteEx)ignite).context().workersRegistry() : null; }
/** {@inheritDoc} */ @Override protected Void run(@Nullable VisorQueryCancelTaskArg arg) throws IgniteException { ignite.context().query().cancelQueries(Collections.singleton(arg.getQueryId())); return null; } }
@Override public void apply(IgniteInternalFuture<?> t) { ((IgniteEx)ignite).context().closure().runLocalSafe(new Runnable() { @Override public void run() { jobCtx.callcc(); } }, false); } });
/** {@inheritDoc} */ @Override protected Collection<UUID> jobNodes(VisorTaskArgument<A> arg) { ClusterNode crd = ignite.context().discovery().discoCache().oldestAliveServerNode(); Collection<UUID> nids = new ArrayList<>(1); nids.add(crd == null ? ignite.localNode().id() : crd.id()); return nids; } }
/** * @param igniteEx IgniteEx. * @return Set of timeout objects that process on current IgniteEx. */ private Set<GridTimeoutObject> getTimeoutObjects(IgniteEx igniteEx) { GridTimeoutProcessor timeout = igniteEx.context().timeout(); return GridTestUtils.getFieldValue(timeout, timeout.getClass(), "timeoutObjs"); }
@Override public Object call() throws Exception { grid(0).context().authentication().addUser("test", "test"); return null; } }, IgniteException.class,
/** * @param node Node. * @return {@code True} if {@link MvccProcessor} is started. */ private boolean mvccEnabled(IgniteEx node) { return node.context().coordinators().mvccEnabled(); } }
/** * @return {@link DistributedMetaStorage} instance for i'th node. */ protected DistributedMetaStorage metastorage(int i) { return grid(i).context().distributedMetastorage(); }
/** {@inheritDoc} */ @Override protected VisorContentionJobResult run(@Nullable VisorContentionTaskArg arg) throws IgniteException { try { ContentionClosure clo = new ContentionClosure(arg.minQueueSize(), arg.maxPrint()); ignite.context().resource().injectGeneric(clo); ContentionInfo info = clo.call(); return new VisorContentionJobResult(info); } catch (Exception e) { throw new IgniteException(e); } }
/** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { super.beforeTestsStarted(); isEventDrivenServiceProcessorEnabled = grid(0).context().service() instanceof IgniteServiceProcessor; }
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { Collection<String> tblNames = new ArrayList<>(); for (String cacheName : grid(0).context().cache().publicCacheNames()) { for (GridQueryTypeDescriptor table : grid(0).context().query().types(cacheName)) tblNames.add(table.tableName()); } for (String tbl : tblNames) sql("DROP TABLE " + tbl); super.afterTest(); }
/** * Change read only mode on all nodes. * * @param readOnly Read only. */ protected void changeClusterReadOnlyMode(boolean readOnly) { for (int idx = 0; idx < SRVS; idx++) { IgniteEx ignite = grid(idx); ignite.context().cache().context().readOnlyMode(readOnly); } } }
@Override public boolean apply() { for (int i = 0; i < SRVS; i++) { if (grid(i).context().cache().context().mvcc().atomicFuturesCount() != 0) return false; } return true; } }, 5000);
/** * Verifies {@link AffinityTopologyVersion}s: one obtained from coordinator and all from each client node. */ private void verifyAffinityTopologyVersions() { IgniteEx srv = grid(0); AffinityTopologyVersion srvTopVer = srv.context().discovery().topologyVersionEx(); for (int i = SRV_CNT; i < SRV_CNT + CLIENTS_CNT; i++) { AffinityTopologyVersion clntTopVer = grid(i).context().discovery().topologyVersionEx(); assertTrue(clntTopVer.equals(srvTopVer)); } }
/** * @param ig Ignite instance. * @return Memory and store. * @throws Exception If failed to initialize the store. */ private PageMemory getMemory(IgniteEx ig) throws Exception { final GridCacheSharedContext<Object, Object> sharedCtx = ig.context().cache().context(); final IgniteCacheDatabaseSharedManager db = sharedCtx.database(); return db.dataRegion(null).pageMemory(); } }
/** * Test metrics for SQL cross cache queries. * * @throws Exception In case of error. */ @Test public void testSqlFieldsCrossCacheQueryMetrics() throws Exception { IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A"); SqlFieldsQuery qry = new SqlFieldsQuery("select * from \"B\".String"); checkQueryMetrics(cache, qry); }
/** * Test metrics for Scan queries. * * @throws Exception In case of error. */ @Test public void testScanQueryMetrics() throws Exception { IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A"); ScanQuery<Integer, String> qry = new ScanQuery<>(); checkQueryMetrics(cache, qry); }
/** * Test metrics for SQL fields queries. * * @throws Exception In case of error. */ @Test public void testSqlFieldsQueryNotFullyFetchedMetrics() throws Exception { IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A"); SqlFieldsQuery qry = new SqlFieldsQuery("select * from String"); qry.setPageSize(10); checkQueryNotFullyFetchedMetrics(cache, qry, false); }
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { super.beforeTest(); U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", true); startGrids(NODES_COUNT); grid(0).cluster().active(true); actxDflt = grid(0).context().authentication().authenticate(User.DFAULT_USER_NAME, "ignite"); assertNotNull(actxDflt); }