/** * Creates exchanges actions. Forms a list of caches and cache groups to be stopped * due to dynamic cache start failure. * * @param failMsg Dynamic change request fail message. * @param topVer Topology version. */ public void onCacheChangeRequested(DynamicCacheChangeFailureMessage failMsg, AffinityTopologyVersion topVer) { ExchangeActions exchangeActions = new ExchangeActions(); List<DynamicCacheChangeRequest> requests = new ArrayList<>(failMsg.cacheNames().size()); for (String cacheName : failMsg.cacheNames()) { DynamicCacheDescriptor cacheDescr = registeredCaches.get(cacheName); assert cacheDescr != null : "Dynamic cache descriptor is missing [cacheName=" + cacheName + "]"; requests.add(DynamicCacheChangeRequest.stopRequest(ctx, cacheName, cacheDescr.sql(), true)); } processCacheChangeRequests(exchangeActions, requests, topVer, false); failMsg.exchangeActions(exchangeActions); }
/** * Form a {@link StoredCacheData} with all data to correctly restore cache params when its configuration is read * from page store. Essentially, this method takes from {@link DynamicCacheDescriptor} all that's needed to start * cache correctly, leaving out everything else. */ public StoredCacheData toStoredData() { assert schema != null; StoredCacheData res = new StoredCacheData(cacheConfiguration()); res.queryEntities(schema().entities()); res.sql(sql()); return res; }
/** * Initialize query infrastructure for not started cache. * * @param cacheDesc Cache descriptor. * @throws IgniteCheckedException If failed. */ public void initQueryStructuresForNotStartedCache(DynamicCacheDescriptor cacheDesc) throws IgniteCheckedException { QuerySchema schema = cacheDesc.schema() != null ? cacheDesc.schema() : new QuerySchema(); CacheObjectContext coCtx = cacheDesc.cacheObjectContext(ctx.cacheObjects()); GridCacheContextInfo cacheInfo = new GridCacheContextInfo(cacheDesc); ctx.query().onCacheStart(cacheInfo, schema, cacheDesc.sql()); }
/** * @param startCfg Cache configuration to use. * @param desc Cache descriptor. * @param reqNearCfg Near configuration if specified for client cache start request. * @param exchTopVer Current exchange version. * @param disabledAfterStart If true, then we will discard restarting state from proxies. If false then we will * change state of proxies to restarting * @throws IgniteCheckedException If failed. */ public void prepareCacheStart( CacheConfiguration startCfg, DynamicCacheDescriptor desc, @Nullable NearCacheConfiguration reqNearCfg, AffinityTopologyVersion exchTopVer, boolean disabledAfterStart, boolean clientCache ) throws IgniteCheckedException { GridCacheContext cacheCtx = prepareCacheContext(startCfg, desc, reqNearCfg, exchTopVer, disabledAfterStart); if (cacheCtx.isRecoveryMode()) finishRecovery(exchTopVer, cacheCtx); else { ctx.query().onCacheStart( new GridCacheContextInfo(cacheCtx, clientCache), desc.schema() != null ? desc.schema() : new QuerySchema(), desc.sql() ); onCacheStarted(cacheCtx); } }
ctx.query().onCacheStart0(cacheInfo, desc.schema(), desc.sql());
desc.receivedFrom(), desc.staticallyConfigured(), desc.sql(), false, 0);
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { stmt.close(); conn.close(); // Destroy all SQL caches after test. for (String cacheName : grid(0).cacheNames()) { DynamicCacheDescriptor cacheDesc = grid(0).context().cache().cacheDescriptor(cacheName); if (cacheDesc != null && cacheDesc.sql()) grid(0).destroyCache0(cacheName, true); } super.afterTest(); }
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { conn.close(); // Destroy all SQL caches after test. for (String cacheName : grid(0).cacheNames()) { DynamicCacheDescriptor cacheDesc = grid(0).context().cache().cacheDescriptor(cacheName); if (cacheDesc != null && cacheDesc.sql()) grid(0).destroyCache0(cacheName, true); } super.afterTest(); }
desc.receivedFrom(), desc.staticallyConfigured(), desc.sql(), desc.deploymentId(), desc.schema().copy());
? cacheInfo.getCacheDescriptor().schema() : new QuerySchema(), cacheInfo.getCacheDescriptor().sql() );
if (req.sql() && !desc.sql()) { ctx.cache().completeCacheStartFuture(req, false, new IgniteCheckedException("Only cache created with CREATE TABLE may be removed with " +
assertTrue(cacheDesc.sql());
DynamicCacheChangeRequest req = DynamicCacheChangeRequest.stopRequest(ctx, desc.cacheName(), desc.sql(), false);
desc.schema() != null ? desc.schema() : new QuerySchema(), desc.sql());
/** * Creates exchanges actions. Forms a list of caches and cache groups to be stopped * due to dynamic cache start failure. * * @param failMsg Dynamic change request fail message. * @param topVer Topology version. */ public void onCacheChangeRequested(DynamicCacheChangeFailureMessage failMsg, AffinityTopologyVersion topVer) { ExchangeActions exchangeActions = new ExchangeActions(); List<DynamicCacheChangeRequest> requests = new ArrayList<>(failMsg.cacheNames().size()); for (String cacheName : failMsg.cacheNames()) { DynamicCacheDescriptor cacheDescr = registeredCaches.get(cacheName); assert cacheDescr != null : "Dynamic cache descriptor is missing [cacheName=" + cacheName + "]"; requests.add(DynamicCacheChangeRequest.stopRequest(ctx, cacheName, cacheDescr.sql(), true)); } processCacheChangeRequests(exchangeActions, requests, topVer,false); failMsg.exchangeActions(exchangeActions); }
/** * Form a {@link StoredCacheData} with all data to correctly restore cache params when its configuration is read * from page store. Essentially, this method takes from {@link DynamicCacheDescriptor} all that's needed to start * cache correctly, leaving out everything else. */ public StoredCacheData toStoredData() { assert schema != null; StoredCacheData res = new StoredCacheData(cacheConfiguration()); res.queryEntities(schema().entities()); res.sql(sql()); return res; }
.map(cacheDesc -> new StoredCacheData(cacheDesc.cacheConfiguration()).sql(cacheDesc.sql())) .collect(Collectors.toList());
desc.receivedFrom(), desc.staticallyConfigured(), desc.sql(), false, 0);
desc.receivedFrom(), desc.staticallyConfigured(), desc.sql(), desc.deploymentId(), desc.schema().copy());
DynamicCacheChangeRequest req = DynamicCacheChangeRequest.stopRequest(ctx, desc.cacheName(), desc.sql(), false);