Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ protected String getCfgUrl() {

/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
((IgniteEx)ignite(0)).context().cache().dynamicDestroyCache(DEFAULT_CACHE_NAME, true, true, false, null);
((IgniteEx)ignite(0)).context().cache().dynamicDestroyCache(DEFAULT_CACHE_NAME, true, true);

if (conn != null) {
conn.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ public void testIndexRebuildUnderLoad() throws Exception {
}

IgniteInternalFuture<Boolean> destroyCacheFut = n.context().cache()
.dynamicDestroyCache(cacheName2, false, true, false, null);
.dynamicDestroyCache(cacheName2, false, true);

SchemaIndexCacheFuture intlRebIdxFut = schemaIndexCacheFuture(n, CU.cacheId(cacheName2));
assertNotNull(intlRebIdxFut);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2068,8 +2068,7 @@ public <K, V> IgniteInternalCache<K, V> getCache(String name) {

ctx.cache().dynamicStartCaches(cacheCfgs,
true,
true,
false).get();
true).get();

List<IgniteCache> createdCaches = new ArrayList<>(cacheCfgs.size());

Expand Down Expand Up @@ -2164,8 +2163,7 @@ public <K, V> IgniteInternalCache<K, V> getCache(String name) {

ctx.cache().dynamicStartCaches(cacheCfgs,
false,
true,
false).get();
true).get();

List<IgniteCache> createdCaches = new ArrayList<>(cacheCfgs.size());

Expand Down Expand Up @@ -2390,7 +2388,7 @@ public IgniteInternalFuture<Boolean> destroyCacheAsync(String cacheName, boolean
try {
checkClusterState();

return ctx.cache().dynamicDestroyCache(cacheName, sql, checkThreadTx, false, null);
return ctx.cache().dynamicDestroyCache(cacheName, sql, checkThreadTx);
}
finally {
unguard();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,6 @@ void onCacheGroupCreated(CacheGroupContext grp) {
desc,
changeReq.nearCacheConfiguration(),
topVer,
changeReq.disabledAfterStart(),
true
);
}).collect(Collectors.toList());
Expand Down Expand Up @@ -945,20 +944,8 @@ private void processCacheStartRequests(
assert cctx.cacheContext(cacheDesc.cacheId()) == null
: "Starting cache has not null context: " + cacheDesc.cacheName();

IgniteCacheProxyImpl cacheProxy = cctx.cache().jcacheProxy(req.cacheName(), false);

// If it has proxy then try to start it
if (cacheProxy != null) {
// Cache should be in restarting mode
assert cacheProxy.isRestarting()
: "Cache has non restarting proxy " + cacheProxy;

startCache = true;
}
else {
startCache = CU.affinityNode(cctx.localNode(),
cacheDesc.groupDescriptor().config().getNodeFilter());
}
startCache = CU.affinityNode(cctx.localNode(),
cacheDesc.groupDescriptor().config().getNodeFilter());
}

if (startCache) {
Expand All @@ -967,8 +954,7 @@ private void processCacheStartRequests(
req.startCacheConfiguration(),
cacheDesc,
nearCfg,
evts.topologyVersion(),
req.disabledAfterStart()
evts.topologyVersion()
),
req
);
Expand Down Expand Up @@ -1061,7 +1047,7 @@ private Set<Integer> processCacheStopRequests(
assert exchActions != null && !exchActions.empty() : exchActions;

for (ExchangeActions.CacheActionData action : exchActions.cacheStopRequests())
cctx.cache().blockGateway(action.request().cacheName(), true, action.request().restart());
cctx.cache().blockGateway(action.request().cacheName(), true);

for (ExchangeActions.CacheGroupActionData action : exchActions.cacheGroupsToStop())
cctx.exchange().clearClientTopology(action.descriptor().groupId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ public class ClusterCachesInfo {
/** */
public static final String CACHE_GRPS_VIEW_DESC = "Cache groups";

/** Representation of null for restarting caches map */
private static final IgniteUuid NULL_OBJECT = new IgniteUuid();

/** */
private final GridKernalContext ctx;

Expand Down Expand Up @@ -145,9 +142,6 @@ public class ClusterCachesInfo {
/** Cache templates. */
private final ConcurrentMap<String, DynamicCacheDescriptor> registeredTemplates = new ConcurrentHashMap<>();

/** Caches currently being restarted (with restarter id). */
private final ConcurrentHashMap<String, IgniteUuid> restartingCaches = new ConcurrentHashMap<>();

/** */
private final IgniteLogger log;

Expand Down Expand Up @@ -624,12 +618,12 @@ public boolean onCacheChangeRequested(DynamicCacheChangeBatch batch, AffinityTop
DiscoveryDataClusterState state = ctx.state().clusterState();

if (state.state().active() && !state.transition()) {
Set<IgniteUuid> restartIds = new HashSet<>(F.viewReadOnly(
batch.requests(), DynamicCacheChangeRequest::restartId, req -> req.start() && req.restartId() != null));
Set<IgniteUuid> snpRestoreIds = new HashSet<>(F.viewReadOnly(
batch.requests(), DynamicCacheChangeRequest::snpRestoreId, req -> req.start() && req.snpRestoreId() != null));

assert restartIds.size() <= 1 : batch.requests();
assert snpRestoreIds.size() <= 1 : batch.requests();

Collection<UUID> nodes = ctx.cache().context().snapshotMgr().cacheStartRequiredAliveNodes(F.first(restartIds));
Collection<UUID> nodes = ctx.cache().context().snapshotMgr().cacheStartRequiredAliveNodes(F.first(snpRestoreIds));

for (UUID nodeId : nodes) {
ClusterNode node = ctx.discovery().node(nodeId);
Expand Down Expand Up @@ -776,45 +770,29 @@ private void processCacheChangeRequest0(
AffinityTopologyVersion waitTopVer = null;

if (req.start()) {
boolean proceedFuther = true;

if (restartingCaches.containsKey(cacheName) &&
((req.restartId() == null && restartingCaches.get(cacheName) != NULL_OBJECT)
|| (req.restartId() != null && !req.restartId().equals(restartingCaches.get(cacheName))))) {

if (req.failIfExists()) {
ctx.cache().completeCacheStartFuture(req, false,
new CacheExistsException("Failed to start cache (a cache is restarting): " + cacheName));
}
if (desc == null) { /* Starting a new cache.*/
if (!processStartNewCacheRequest(exchangeActions, topVer, persistedCfgs, res, req, cacheName))
return;

proceedFuther = false;
needExchange = true;
}
else {
clientCacheStart = processStartAlreadyStartedCacheRequest(topVer, persistedCfgs, req, cacheName, desc);

if (proceedFuther) {
if (desc == null) { /* Starting a new cache.*/
if (!processStartNewCacheRequest(exchangeActions, topVer, persistedCfgs, res, req, cacheName))
return;

needExchange = true;
}
else {
clientCacheStart = processStartAlreadyStartedCacheRequest(topVer, persistedCfgs, req, cacheName, desc);

if (!clientCacheStart) {
if (desc.clientCacheStartVersion() != null)
waitTopVer = desc.clientCacheStartVersion();
else {
AffinityTopologyVersion nodeStartVer =
new AffinityTopologyVersion(ctx.discovery().localNode().order(), 0);
if (!clientCacheStart) {
if (desc.clientCacheStartVersion() != null)
waitTopVer = desc.clientCacheStartVersion();
else {
AffinityTopologyVersion nodeStartVer =
new AffinityTopologyVersion(ctx.discovery().localNode().order(), 0);

if (desc.startTopologyVersion() != null)
waitTopVer = desc.startTopologyVersion();
else
waitTopVer = desc.receivedFromStartVersion();
if (desc.startTopologyVersion() != null)
waitTopVer = desc.startTopologyVersion();
else
waitTopVer = desc.receivedFromStartVersion();

if (waitTopVer == null || nodeStartVer.compareTo(waitTopVer) > 0)
waitTopVer = nodeStartVer;
}
if (waitTopVer == null || nodeStartVer.compareTo(waitTopVer) > 0)
waitTopVer = nodeStartVer;
}
}
}
Expand Down Expand Up @@ -924,12 +902,6 @@ private boolean processStopCacheRequest(

registeredCachesById.remove(old.cacheId());

if (req.restart()) {
IgniteUuid restartId = req.restartId();

restartingCaches.put(cacheName, restartId == null ? NULL_OBJECT : restartId);
}

exchangeActions.addCacheToStop(req, desc);

boolean alreadyRemovedGrp = false;
Expand Down Expand Up @@ -1125,7 +1097,7 @@ else if (encMgr.masterKeyDigest() != null &&
}
}

if (err == null && req.restartId() == null) {
if (err == null && req.snpRestoreId() == null) {
IgniteSnapshotManager snapshotMgr = ctx.cache().context().snapshotMgr();

if (snapshotMgr.isRestoring(ccfg)) {
Expand Down Expand Up @@ -1183,8 +1155,6 @@ else if (encMgr.masterKeyDigest() != null &&

registeredCachesById.put(startDesc.cacheId(), startDesc);

restartingCaches.remove(ccfg.getName());

assert old == null;

ctx.discovery().setCacheFilter(
Expand Down Expand Up @@ -1233,20 +1203,6 @@ void collectJoiningNodeData(DiscoveryDataBag dataBag) {
dataBag.addJoiningNodeData(CACHE_PROC.ordinal(), joinDiscoveryData());
}

/**
* @return {@code True} if there are currently restarting caches.
*/
boolean hasRestartingCaches() {
return !F.isEmpty(restartingCaches);
}

/**
* @return Collection of currently restarting caches.
*/
Collection<String> restartingCaches() {
return restartingCaches.keySet();
}

/**
* @return Discovery date sent on local node join.
*/
Expand Down Expand Up @@ -2752,14 +2708,6 @@ private boolean surviveReconnect(String cacheName) {
return CU.isUtilityCache(cacheName);
}

/**
* @param cacheName Cache name.
* @return {@code True} if cache is restarting.
*/
public boolean isRestarting(String cacheName) {
return restartingCaches.containsKey(cacheName);
}

/** */
@Nullable public ClusterCacheGroupRecoveryData clusterCacheGroupRecoveryData() {
return clusterCacheGrpRecoveryData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,19 @@ public class DynamicCacheChangeRequest extends AbstractMessage implements Serial
boolean stop;

/** Restart flag. */
@Order(9)
@Order(value = 9, deprecatedBy = "CACHE_RESTART_FLAG_DEPRECATED_FEATURE")
boolean restart;

/** Finalize update counters flag. */
@Order(10)
boolean finalizePartitionCounters;

/** Restart operation id. */
/** Request ID of the snapshot restore operation. */
@Order(11)
IgniteUuid restartId;
IgniteUuid snpRestoreId;

/** Cache active on start or not*/
@Order(12)
@Order(value = 12, deprecatedBy = "CACHE_DISABLED_AFTER_START_DEPRECATED_FEATURE")
boolean disabledAfterStart;

/** Cache data destroy flag. Setting to <code>true</code> will cause removing all cache data.*/
Expand Down Expand Up @@ -323,20 +323,6 @@ public void stop(boolean stop) {
this.stop = stop;
}

/**
* @return {@code True} if this is a restart request.
*/
public boolean restart() {
return restart;
}

/**
* @param restart New restart flag.
*/
public void restart(boolean restart) {
this.restart = restart;
}

/**
* Set finalize partition update counters flag.
*/
Expand All @@ -352,17 +338,17 @@ public boolean finalizePartitionCounters() {
}

/**
* @return Id of restart to allow only initiator start the restarting cache.
* @return Request ID of the snapshot restore operation.
*/
public IgniteUuid restartId() {
return restartId;
public IgniteUuid snpRestoreId() {
return snpRestoreId;
}

/**
* @param restartId Id of cache restart requester.
* @param snpRestoreId Request ID of the snapshot restore operation.
*/
public void restartId(IgniteUuid restartId) {
this.restartId = restartId;
public void snpRestoreId(IgniteUuid snpRestoreId) {
this.snpRestoreId = snpRestoreId;
}

/**
Expand Down Expand Up @@ -496,20 +482,6 @@ public void locallyConfigured(boolean locallyConfigured) {
this.locallyConfigured = locallyConfigured;
}

/**
* @return state of cache after start
*/
public boolean disabledAfterStart() {
return disabledAfterStart;
}

/**
* @param disabledAfterStart state of cache after start
*/
public void disabledAfterStart(boolean disabledAfterStart) {
this.disabledAfterStart = disabledAfterStart;
}

/**
* @param encKey Encryption key.
*/
Expand Down Expand Up @@ -572,7 +544,6 @@ public void cacheConfigurationEnrichment(CacheConfigurationEnrichment cacheCfgEn
", clientStartOnly=" + clientStartOnly +
", stop=" + stop +
", destroy=" + destroy +
", disabledAfterStart=" + disabledAfterStart +
']';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/** {@code True} if attempted to use partition preloading on not mapped node. */
private volatile boolean partPreloadNotMappedWarned;

/** Active. */
private volatile boolean active;

/** {@inheritDoc} */
@Override public String name() {
return cacheCfg.getName();
Expand Down Expand Up @@ -433,20 +430,6 @@ public boolean isDht() {
return false;
}

/**
*
*/
public boolean active() {
return active;
}

/**
* @param active Active.
*/
public void active(boolean active) {
this.active = active;
}

/**
* @return Preloader.
*/
Expand Down
Loading
Loading