/** * @param cacheNames Collection of cache names to destroy. * @param checkThreadTx If {@code true} checks that current thread does not have active transactions. * @param destroy Cache data destroy flag. Setting to <code>true</code> will cause removing all cache data * @return Future that will be completed when cache is destroyed. */ public IgniteInternalFuture<?> dynamicDestroyCaches( Collection<String> cacheNames, boolean checkThreadTx, boolean destroy ) { if (checkThreadTx) checkEmptyTransactions(); List<DynamicCacheChangeRequest> reqs = new ArrayList<>(cacheNames.size()); for (String cacheName : cacheNames) { reqs.add(createStopRequest(cacheName, false, null, destroy)); } return dynamicChangeCaches(reqs); }
/** * Resets cache state after the cache has been moved to recovery state. * * @param cacheNames Cache names. * @return Future that will be completed when state is changed for all caches. */ public IgniteInternalFuture<?> resetCacheState(Collection<String> cacheNames) { checkEmptyTransactions(); if (F.isEmpty(cacheNames)) cacheNames = cachesInfo.registeredCaches().keySet(); Collection<DynamicCacheChangeRequest> reqs = new ArrayList<>(cacheNames.size()); for (String cacheName : cacheNames) { DynamicCacheDescriptor desc = cacheDescriptor(cacheName); if (desc == null) { U.warn(log, "Failed to find cache for reset lost partition request, cache does not exist: " + cacheName); continue; } DynamicCacheChangeRequest req = DynamicCacheChangeRequest.resetLostPartitions(ctx, cacheName); reqs.add(req); } GridCompoundFuture fut = new GridCompoundFuture(); for (DynamicCacheStartFuture f : initiateCacheChanges(reqs)) fut.add(f); fut.markInitialized(); return fut; }
/** * @param cacheName Cache name to close. * @return Future that will be completed when cache is closed. */ IgniteInternalFuture<?> dynamicCloseCache(String cacheName) { assert cacheName != null; IgniteCacheProxy<?, ?> proxy = jcacheProxy(cacheName, false); if (proxy == null || proxy.isProxyClosed()) return new GridFinishedFuture<>(); // No-op. checkEmptyTransactions(); if (proxy.context().isLocal()) return dynamicDestroyCache(cacheName, false, true, false, null); return startClientCacheChange(null, Collections.singleton(cacheName)); }
/** * @param cacheName Cache name to destroy. * @param sql If the cache needs to be destroyed only if it was created as the result of SQL {@code CREATE TABLE} * command. * @param checkThreadTx If {@code true} checks that current thread does not have active transactions. * @param restart Restart flag. * @param restartId Restart requester id (it'll allow to start this cache only him). * @return Future that will be completed when cache is destroyed. */ public IgniteInternalFuture<Boolean> dynamicDestroyCache( String cacheName, boolean sql, boolean checkThreadTx, boolean restart, IgniteUuid restartId ) { assert cacheName != null; if (checkThreadTx) checkEmptyTransactions(); DynamicCacheChangeRequest req = DynamicCacheChangeRequest.stopRequest(ctx, cacheName, sql, true); req.stop(true); req.destroy(true); req.restart(restart); req.restartId(restartId); return F.first(initiateCacheChanges(F.asList(req))); }
) { if (checkThreadTx) checkEmptyTransactions();
/** * @param cacheNames Collection of cache names to destroy. * @param checkThreadTx If {@code true} checks that current thread does not have active transactions. * @param restart Restart flag. * @param destroy Cache data destroy flag. Setting to <code>true</code> will cause removing all cache data * @return Future that will be completed when cache is destroyed. */ public IgniteInternalFuture<?> dynamicDestroyCaches(Collection<String> cacheNames, boolean checkThreadTx, boolean restart, boolean destroy) { if (checkThreadTx) checkEmptyTransactions(); List<DynamicCacheChangeRequest> reqs = new ArrayList<>(cacheNames.size()); for (String cacheName : cacheNames) { reqs.add(createStopRequest(cacheName, restart, destroy)); } return dynamicChangeCaches(reqs); }
/** * @param cacheName Cache name to close. * @return Future that will be completed when cache is closed. */ IgniteInternalFuture<?> dynamicCloseCache(String cacheName) { assert cacheName != null; IgniteCacheProxy<?, ?> proxy = jcacheProxy(cacheName, false); if (proxy == null || proxy.isProxyClosed()) return new GridFinishedFuture<>(); // No-op. checkEmptyTransactions(); if (proxy.context().isLocal()) return dynamicDestroyCache(cacheName, false, true, false); return startClientCacheChange(null, Collections.singleton(cacheName)); }
/** * Resets cache state after the cache has been moved to recovery state. * * @param cacheNames Cache names. * @return Future that will be completed when state is changed for all caches. */ public IgniteInternalFuture<?> resetCacheState(Collection<String> cacheNames) { checkEmptyTransactions(); if (F.isEmpty(cacheNames)) cacheNames = cachesInfo.registeredCaches().keySet(); Collection<DynamicCacheChangeRequest> reqs = new ArrayList<>(cacheNames.size()); for (String cacheName : cacheNames) { DynamicCacheDescriptor desc = cacheDescriptor(cacheName); if (desc == null) { U.warn(log, "Failed to find cache for reset lost partition request, cache does not exist: " + cacheName); continue; } DynamicCacheChangeRequest req = DynamicCacheChangeRequest.resetLostPartitions(ctx, cacheName); reqs.add(req); } GridCompoundFuture fut = new GridCompoundFuture(); for (DynamicCacheStartFuture f : initiateCacheChanges(reqs)) fut.add(f); fut.markInitialized(); return fut; }
/** * @param cacheName Cache name to destroy. * @param sql If the cache needs to be destroyed only if it was created as the result of SQL {@code CREATE TABLE} * command. * @param checkThreadTx If {@code true} checks that current thread does not have active transactions. * @param restart Restart flag. * @return Future that will be completed when cache is destroyed. */ public IgniteInternalFuture<Boolean> dynamicDestroyCache(String cacheName, boolean sql, boolean checkThreadTx, boolean restart) { assert cacheName != null; if (checkThreadTx) checkEmptyTransactions(); DynamicCacheChangeRequest req = DynamicCacheChangeRequest.stopRequest(ctx, cacheName, sql, true); req.stop(true); req.destroy(true); req.restart(restart); return F.first(initiateCacheChanges(F.asList(req))); }
boolean disabledAfterStart) { if (checkThreadTx) checkEmptyTransactions();