/** * @return Database. */ private GridCacheDatabaseSharedManager database() { return (GridCacheDatabaseSharedManager)ctx.shared().database(); } }
grp.groupId(), pageMem, grp.dataRegion().config().isPersistenceEnabled() ? grp.shared().wal() : null, grp.offheap().globalRemoveId(), metaPageId, grp.sharedGroup() ? CacheIdAwarePendingEntryInnerIO.VERSIONS : PendingEntryInnerIO.VERSIONS, grp.sharedGroup() ? CacheIdAwarePendingEntryLeafIO.VERSIONS : PendingEntryLeafIO.VERSIONS, grp.shared().kernalContext().failure()); assert !grp.dataRegion().config().isPersistenceEnabled() || grp.shared().database().checkpointLockIsHeldByThread();
/** * @param grp Cache group. */ public GridCachePreloaderAdapter(CacheGroupContext grp) { assert grp != null; this.grp = grp; ctx = grp.shared(); log = ctx.logger(getClass()); finFut = new GridFinishedFuture(); }
/** {@inheritDoc} */ @Override public GridCursor<? extends CacheDataRow> cursor(int cacheId, KeyCacheObject lower, KeyCacheObject upper, Object x, MvccSnapshot snapshot) throws IgniteCheckedException { SearchRow lowerRow; SearchRow upperRow; if (grp.sharedGroup()) { assert cacheId != CU.UNDEFINED_CACHE_ID; lowerRow = lower != null ? new SearchRow(cacheId, lower) : new SearchRow(cacheId); upperRow = upper != null ? new SearchRow(cacheId, upper) : new SearchRow(cacheId); } else { lowerRow = lower != null ? new SearchRow(CU.UNDEFINED_CACHE_ID, lower) : null; upperRow = upper != null ? new SearchRow(CU.UNDEFINED_CACHE_ID, upper) : null; } GridCursor<? extends CacheDataRow> cursor; if (snapshot != null) { assert grp.mvccEnabled(); GridCacheContext cctx = grp.sharedGroup() ? grp.shared().cacheContext(cacheId) : grp.singleCacheContext(); cursor = dataTree.find(lowerRow, upperRow, new MvccFirstVisibleRowTreeClosure(cctx, snapshot), x); } else cursor = dataTree.find(lowerRow, upperRow, x); return cursor; }
/** * @param enabled Enabled flag.. */ private void persistGlobalWalState(boolean enabled) { shared().database().walEnabled(grpId, enabled, false); }
/** * @param enabled Enabled flag.. */ private void persistLocalWalState(boolean enabled) { shared().database().walEnabled(grpId, enabled, true); }
/** * @param grp Cache group context. * @param mvccCrd Mvcc coordinator version. * @param mvccCntr Mvcc counter. * @param mvccOpCntr Mvcc operation counter. * @return TxState * @see TxState */ public static byte state(CacheGroupContext grp, long mvccCrd, long mvccCntr, int mvccOpCntr) { return state(grp.shared().coordinators(), mvccCrd, mvccCntr, mvccOpCntr); }
/** * * @param grp Cache group context. * @param state State. * @param crd Mvcc coordinator counter. * @param cntr Mvcc counter. * @param opCntr Mvcc operation counter. * @return State exception. */ public static IgniteTxMvccVersionCheckedException unexpectedStateException( CacheGroupContext grp, byte state, long crd, long cntr, int opCntr) { return unexpectedStateException(grp.shared().kernalContext(), state, crd, cntr, opCntr, null); }
/** * @param grp Cache group. */ GridDhtPartitionSupplier(CacheGroupContext grp) { assert grp != null; this.grp = grp; log = grp.shared().logger(getClass()); top = grp.topology(); if (rebalanceThrottleOverride > 0) LT.info(log, "Using rebalance throttle override: " + rebalanceThrottleOverride); }
/** * Handle topology change and clear supply context map of outdated contexts. */ void onTopologyChanged() { synchronized (scMap) { Iterator<T3<UUID, Integer, AffinityTopologyVersion>> it = scMap.keySet().iterator(); Collection<UUID> aliveNodes = grp.shared().discovery().aliveServerNodes().stream() .map(ClusterNode::id) .collect(Collectors.toList()); while (it.hasNext()) { T3<UUID, Integer, AffinityTopologyVersion> t = it.next(); if (!aliveNodes.contains(t.get1())) { // Clear all obsolete contexts. clearContext(scMap.get(t), log); it.remove(); if (log.isDebugEnabled()) log.debug("Supply context removed [grp=" + grp.cacheOrGroupName() + ", demander=" + t.get1() + "]"); } } } }
/** {@inheritDoc} */ @Override protected long allocatePageNoReuse() throws IgniteCheckedException { assert grp.shared().database().checkpointLockIsHeldByThread(); return pageMem.allocatePage(grpId, partId, PageIdAllocator.FLAG_DATA); } };
/** {@inheritDoc} */ @Override protected long allocatePageNoReuse() throws IgniteCheckedException { assert grp.shared().database().checkpointLockIsHeldByThread(); return pageMem.allocatePage(grpId, partId, PageIdAllocator.FLAG_DATA); } };
/** * Read row from data pages. * * @param grp Cache group. * @param rowData Required row data. * @param skipVer Whether version read should be skipped. * @throws IgniteCheckedException If failed. */ public final void initFromLink(CacheGroupContext grp, RowData rowData, boolean skipVer) throws IgniteCheckedException { initFromLink(grp, grp.shared(), grp.dataRegion().pageMemory(), rowData, skipVer); }
/** {@inheritDoc} */ @Override protected long allocatePageNoReuse() throws IgniteCheckedException { assert grp.shared().database().checkpointLockIsHeldByThread(); return pageMem.allocatePage(grpId, partId, PageIdAllocator.FLAG_DATA); } };
/** * @param grp Ccahe group. */ public GridDhtPartitionDemander(CacheGroupContext grp) { assert grp != null; this.grp = grp; ctx = grp.shared(); log = ctx.logger(getClass()); boolean enabled = grp.rebalanceEnabled() && !ctx.kernalContext().clientNode(); rebalanceFut = new RebalanceFuture(); //Dummy. if (!enabled) { // Calling onDone() immediately since preloading is disabled. rebalanceFut.onDone(true); syncFut.onDone(); } Map<Integer, Object> tops = new HashMap<>(); for (int idx = 0; idx < grp.shared().kernalContext().config().getRebalanceThreadPoolSize(); idx++) tops.put(idx, GridCachePartitionExchangeManager.rebalanceTopic(idx)); rebalanceTopics = tops; }
/** * @param grp Cache group. * @param freeList Free list. */ public RowStore(CacheGroupContext grp, FreeList freeList) { assert grp != null; assert freeList != null; this.freeList = freeList; ctx = grp.shared(); coctx = grp.cacheObjectContext(); pageMem = grp.dataRegion().pageMemory(); persistenceEnabled = grp.dataRegion().config().isPersistenceEnabled(); }
/** * Return CacheEntry instance for lock purpose. * * @param grp Cache group * @param row Pending row. * @return CacheEntry if found or null otherwise. */ private GridCacheEntryEx getEntry(CacheGroupContext grp, PendingRow row) { try { CacheDataRowAdapter rowData = new CacheDataRowAdapter(row.link); rowData.initFromLink(grp, CacheDataRowAdapter.RowData.KEY_ONLY); GridCacheContext cctx = grp.shared().cacheContext(row.cacheId); assert cctx != null; return cctx.cache().entryEx(rowData.key()); } catch (Throwable ex) { if (Thread.currentThread().isInterrupted() || X.hasCause(ex, InterruptedException.class)) throw new IgniteException(new InterruptedException()); log.warning("Failed to move old-version pending entry " + "to per-partition PendingTree: key not found (skipping): " + "[grpId=" + grp.groupId() + ", grpName=" + grp.name() + ", pendingRow=" + row + "]"); return null; } }
/** * @param grp Cache group. * @param assignments Assignments. * @param log Logger. * @param rebalanceId Rebalance id. */ RebalanceFuture( CacheGroupContext grp, GridDhtPreloaderAssignments assignments, IgniteLogger log, long rebalanceId) { assert assignments != null; exchId = assignments.exchangeId(); topVer = assignments.topologyVersion(); assignments.forEach((k, v) -> { assert v.partitions() != null : "Partitions are null [grp=" + grp.cacheOrGroupName() + ", fromNode=" + k.id() + "]"; remaining.put(k.id(), v.partitions()); }); this.routines = remaining.size(); this.grp = grp; this.log = log; this.rebalanceId = rebalanceId; ctx = grp.shared(); }
/** {@inheritDoc} */ @Override @Nullable protected IgniteHistoricalIterator historicalIterator( CachePartitionPartialCountersMap partCntrs, Set<Integer> missing) throws IgniteCheckedException { if (partCntrs == null || partCntrs.isEmpty()) return null; if (grp.mvccEnabled()) // TODO IGNITE-7384 return super.historicalIterator(partCntrs, missing); GridCacheDatabaseSharedManager database = (GridCacheDatabaseSharedManager)grp.shared().database(); FileWALPointer minPtr = null; for (int i = 0; i < partCntrs.size(); i++) { int p = partCntrs.partitionAt(i); long initCntr = partCntrs.initialUpdateCounterAt(i); FileWALPointer startPtr = (FileWALPointer)database.checkpointHistory().searchPartitionCounter( grp.groupId(), p, initCntr); if (startPtr == null) throw new IgniteCheckedException("Could not find start pointer for partition [part=" + p + ", partCntrSince=" + initCntr + "]"); if (minPtr == null || startPtr.compareTo(minPtr) < 0) minPtr = startPtr; } WALIterator it = grp.shared().wal().replay(minPtr); WALHistoricalIterator iterator = new WALHistoricalIterator(grp, partCntrs, it); // Add historical partitions which are unabled to reserve to missing set. missing.addAll(iterator.missingParts); return iterator; }
return; IgnitePageStoreManager pageStoreMgr = grpCtx.shared().pageStore();