/** {@inheritDoc} */ @Override public boolean waitForPartitionExchange() { // Wait dht update futures in PRIMARY mode. return cctx.config().getAtomicWriteOrderMode() == GridCacheAtomicWriteOrderMode.PRIMARY; }
/** * Checks if future is ready to be completed. */ private synchronized void checkComplete() { if ((syncMode == FULL_ASYNC && cctx.config().getAtomicWriteOrderMode() == PRIMARY) || mappings.isEmpty()) { GridCachePartialUpdateException err0 = err; if (err0 != null) onDone(err0); else onDone(opRes); } }
/** * @return {@code True} if {@link GridCacheQueue} can be used with current cache configuration. */ private boolean supportsQueue() { return !(cctx.atomic() && !cctx.isLocal() && cctx.config().getAtomicWriteOrderMode() == CLOCK); }
/** * @throws GridException If {@link GridCacheQueue} can not be used with current cache configuration. */ private void checkSupportsQueue() throws GridException { if (cctx.atomic() && !cctx.isLocal() && cctx.config().getAtomicWriteOrderMode() == CLOCK) throw new GridException("GridCacheQueue can not be used with ATOMIC cache with CLOCK write order mode" + " (change write order mode to PRIMARY in configuration)"); }
if (ctx.config().getAtomicWriteOrderMode() == CLOCK) return Collections.singletonList(null); else if (ctx.config().getAtomicWriteOrderMode() == CLOCK) locked.add(null); else
/** * Checks if cache configurations are alike for warmup. * * @param ccfg0 First configuration. * @param ccfg1 Second configuration. * @return {@code True} if configurations match. */ private boolean matches(GridCacheConfiguration ccfg0, GridCacheConfiguration ccfg1) { return F.eq(ccfg0.getCacheMode(), ccfg1.getCacheMode()) && F.eq(ccfg0.getBackups(), ccfg1.getBackups()) && F.eq(ccfg0.getAtomicityMode(), ccfg1.getAtomicityMode()) && F.eq(ccfg0.getAtomicWriteOrderMode(), ccfg1.getAtomicWriteOrderMode()) && F.eq(ccfg0.getMemoryMode(), ccfg1.getMemoryMode()) && F.eq(ccfg0.getDistributionMode(), ccfg1.getDistributionMode()); }
cctx.config().getAtomicWriteOrderMode() == CLOCK && !(cctx.isStoreEnabled() && cctx.config().getInterceptor() != null);
/** * Resolve DR conflict. * * @param oldEntry Old entry. * @param newEntry New entry. * @param atomicVerComparator Whether to use atomic version comparator. * @return Conflict resolution result. * @throws GridException In case of exception. */ public GridDrReceiverConflictContextImpl<K, V> drResolveConflict(GridDrEntryEx<K, V> oldEntry, GridDrEntryEx<K, V> newEntry, boolean atomicVerComparator) throws GridException { assert rslvr != null : "Should not reach this place."; GridDrReceiverConflictContextImpl<K, V> ctx = rslvr.resolve(oldEntry, newEntry, atomicVerComparator, config().getAtomicWriteOrderMode() == GridCacheAtomicWriteOrderMode.CLOCK); if (ctx.isManualResolve()) cache.metrics0().onReceiveCacheConflictResolved(ctx.isUseNew(), ctx.isUseOld(), ctx.isMerge()); return ctx; }
GridCacheVersion updVer = ccfg.getAtomicWriteOrderMode() == CLOCK ? cctx.versions().next(topVer) : null;
@Override public void apply(GridNearAtomicUpdateRequest<K, V> req, GridNearAtomicUpdateResponse<K, V> res) { if (ctx.config().getAtomicWriteOrderMode() == CLOCK) { // Always send reply in CLOCK ordering mode. sendNearUpdateReply(res.nodeId(), res); return; } // Request should be for primary keys only in PRIMARY ordering mode. assert req.hasPrimary(); if (req.writeSynchronizationMode() != FULL_ASYNC) sendNearUpdateReply(res.nodeId(), res); else { if (!F.isEmpty(res.remapKeys())) // Remap keys on primary node in FULL_ASYNC mode. remapToNewPrimary(req); else if (res.error() != null) { U.error(log, "Failed to process write update request in FULL_ASYNC mode for keys: " + res.failedKeys(), res.error()); } } } };
if (syncMode == FULL_ASYNC && cctx.config().getAtomicWriteOrderMode() == PRIMARY) onDone(new GridCacheReturn<V>(null, true));
assert cctx.config().getAtomicWriteOrderMode() == PRIMARY;
if (!remap && (cctx.config().getAtomicWriteOrderMode() == CLOCK || syncMode != FULL_ASYNC)) cctx.mvcc().addAtomicFuture(version(), this);
ctx.config().getAtomicWriteOrderMode() == CLOCK) { GridNode node = ctx.discovery().node(nodeId); assert ctx.config().getAtomicWriteOrderMode() == PRIMARY;
if (cfg.getAtomicWriteOrderMode() == null) { cfg.setAtomicWriteOrderMode(cfg.getWriteSynchronizationMode() == FULL_SYNC ? GridCacheAtomicWriteOrderMode.CLOCK : cfg.getAtomicWriteOrderMode() == GridCacheAtomicWriteOrderMode.CLOCK) { cfg.setAtomicWriteOrderMode(GridCacheAtomicWriteOrderMode.PRIMARY);
boolean useGlobalTime = cctx.config().getAtomicWriteOrderMode() == GridCacheAtomicWriteOrderMode.CLOCK;
affMapper = cc.getAffinityMapper(); atomicityMode = cc.getAtomicityMode(); atomicWriteOrderMode = cc.getAtomicWriteOrderMode(); backups = cc.getBackups(); cacheMode = cc.getCacheMode();
cfg.atomicityMode(ccfg.getAtomicityMode()); cfg.atomicSequenceReserveSize(ccfg.getAtomicSequenceReserveSize()); cfg.atomicWriteOrderMode(ccfg.getAtomicWriteOrderMode()); cfg.atomicSequenceReserveSize(ccfg.getAtomicSequenceReserveSize()); cfg.eagerTtl(ccfg.isEagerTtl());