@Override public void apply(CacheSearchRow row) { try { rowStore.removeRow(row.link(), grp.statisticsHolderData()); } catch (IgniteCheckedException e) { U.error(log, "Failed to remove row [link=" + row.link() + "]"); IgniteCheckedException ex = exception.get(); if (ex == null) exception.set(e); else ex.addSuppressed(e); } } });
/** * Read row from data pages. * Can be called with cctx == null, if cache instance is unknown, but its ID is stored in the data row. * * @param grp Cache group. * @param sharedCtx Shared context. * @param pageMem Page memory. * @param rowData Row data. * @param skipVer Whether version read should be skipped. * @throws IgniteCheckedException If failed. */ public final void initFromLink( @Nullable CacheGroupContext grp, GridCacheSharedContext<?, ?> sharedCtx, PageMemory pageMem, RowData rowData, boolean skipVer ) throws IgniteCheckedException { // Group is null if try evict page, with persistence evictions should be disabled. assert grp != null || pageMem instanceof PageMemoryNoStoreImpl; CacheObjectContext coctx = grp != null ? grp.cacheObjectContext() : null; boolean readCacheId = grp == null || grp.storeCacheIdInDataPage(); int grpId = grp != null ? grp.groupId() : 0; IoStatisticsHolder statHolder = grp != null ? grp.statisticsHolderData() : IoStatisticsHolderNoOp.INSTANCE; doInitFromLink(link, sharedCtx, coctx, pageMem, grpId, statHolder, readCacheId, rowData, null, skipVer); }
/** {@inheritDoc} */ @Override public void call(@Nullable CacheDataRow old) throws IgniteCheckedException { if (old == null) { op = PUT; int cacheId = cacheId(); if (!grp.storeCacheIdInDataPage() && cacheId != CU.UNDEFINED_CACHE_ID) cacheId(CU.UNDEFINED_CACHE_ID); rowStore().addRow(this, grp.statisticsHolderData()); cacheId(cacheId); } else op = NOOP; }
/** {@inheritDoc} */ @Override public void updateTxState(GridCacheContext cctx, CacheSearchRow row) throws IgniteCheckedException { assert grp.mvccEnabled(); assert mvccVersionIsValid(row.mvccCoordinatorVersion(), row.mvccCounter(), row.mvccOperationCounter()) : row; // Need an extra lookup because the row may be already cleaned by another thread. CacheDataRow row0 = dataTree.findOne(row, CacheDataRowAdapter.RowData.LINK_ONLY); if (row0 != null) rowStore.updateDataRow(row0.link(), mvccUpdateTxStateHint, null, grp.statisticsHolderData()); }
boolean readCacheId = grp == null || grp.storeCacheIdInDataPage(); int grpId = grp != null ? grp.groupId() : 0; IoStatisticsHolder statHolder = grp != null ? grp.statisticsHolderData() : IoStatisticsHolderNoOp.INSTANCE;
/** {@inheritDoc} */ @Override public int cleanup(GridCacheContext cctx, @Nullable List<MvccLinkAwareSearchRow> cleanupRows) throws IgniteCheckedException { int res = 0; if (cleanupRows != null) { GridCacheQueryManager qryMgr = cctx.queries(); for (int i = 0; i < cleanupRows.size(); i++) { MvccLinkAwareSearchRow cleanupRow = cleanupRows.get(i); assert cleanupRow.link() != 0 : cleanupRow; assert cctx.shared().database().checkpointLockIsHeldByThread(); CacheDataRow oldRow = dataTree.remove(cleanupRow); if (oldRow != null) { // oldRow == null means it was cleaned by another cleanup process. assert oldRow.mvccCounter() == cleanupRow.mvccCounter(); if (qryMgr.enabled()) qryMgr.remove(oldRow.key(), oldRow); clearPendingEntries(cctx, oldRow); rowStore.removeRow(cleanupRow.link(), grp.statisticsHolderData()); res++; } } } return res; }
/** * @param cctx Cache context. * @param key Key. * @param oldRow Removed row. * @throws IgniteCheckedException If failed. */ private void finishRemove(GridCacheContext cctx, KeyCacheObject key, @Nullable CacheDataRow oldRow) throws IgniteCheckedException { if (oldRow != null) { clearPendingEntries(cctx, oldRow); decrementSize(cctx.cacheId()); } GridCacheQueryManager qryMgr = cctx.queries(); if (qryMgr.enabled()) qryMgr.remove(key, oldRow); if (oldRow != null) rowStore.removeRow(oldRow.link(), grp.statisticsHolderData()); updateIgfsMetrics(cctx, key, (oldRow != null ? oldRow.value() : null), null); }
/** {@inheritDoc} */ @Override public CacheDataRow createRow( GridCacheContext cctx, KeyCacheObject key, CacheObject val, GridCacheVersion ver, long expireTime, @Nullable CacheDataRow oldRow) throws IgniteCheckedException { int cacheId = grp.storeCacheIdInDataPage() ? cctx.cacheId() : CU.UNDEFINED_CACHE_ID; DataRow dataRow = makeDataRow(key, val, ver, expireTime, cacheId); if (canUpdateOldRow(cctx, oldRow, dataRow) && rowStore.updateRow(oldRow.link(), dataRow, grp.statisticsHolderData())) dataRow.link(oldRow.link()); else { CacheObjectContext coCtx = cctx.cacheObjectContext(); key.valueBytes(coCtx); val.valueBytes(coCtx); rowStore.addRow(dataRow, grp.statisticsHolderData()); } assert dataRow.link() != 0 : dataRow; if (grp.sharedGroup() && dataRow.cacheId() == CU.UNDEFINED_CACHE_ID) dataRow.cacheId(cctx.cacheId()); return dataRow; }
/** {@inheritDoc} */ @Override public void call(@Nullable CacheDataRow oldRow) throws IgniteCheckedException { this.oldRow = oldRow; if (oldRow == null) { op = PUT; int cacheId = cacheId(); if (!grp.storeCacheIdInDataPage() && cacheId != CU.UNDEFINED_CACHE_ID) cacheId(CU.UNDEFINED_CACHE_ID); rowStore().addRow(this, grp.statisticsHolderData()); cacheId(cacheId); } else { op = NOOP; if (oldRow.mvccTxState() != mvccTxState() || oldRow.newMvccCoordinatorVersion() != newMvccCoordinatorVersion() || oldRow.newMvccCounter() != newMvccCounter() || oldRow.newMvccOperationCounter() != newMvccOperationCounter() || oldRow.newMvccTxState() != newMvccTxState()) { rowStore().updateDataRow(oldRow.link(), mvccApplyChanges, this, grp.statisticsHolderData()); } } }
/** {@inheritDoc} */ @Override public void clear(int cacheId) throws IgniteCheckedException { assert cacheId != CU.UNDEFINED_CACHE_ID; if (cacheSize(cacheId) == 0) return; Exception ex = null; GridCursor<? extends CacheDataRow> cur = cursor(cacheId, null, null, CacheDataRowAdapter.RowData.KEY_ONLY); while (cur.next()) { CacheDataRow row = cur.get(); assert row.link() != 0 : row; try { boolean res = dataTree.removex(row); assert res : row; rowStore.removeRow(row.link(), grp.statisticsHolderData()); decrementSize(cacheId); } catch (IgniteCheckedException e) { U.error(log, "Fail remove row [link=" + row.link() + "]"); if (ex == null) ex = e; else ex.addSuppressed(e); } } if (ex != null) throw new IgniteCheckedException("Fail destroy store", ex); }
/** * @param cctx Cache context. * @param newRow New row. * @param oldRow Old row if available. * @throws IgniteCheckedException If failed. */ private void finishUpdate(GridCacheContext cctx, CacheDataRow newRow, @Nullable CacheDataRow oldRow) throws IgniteCheckedException { if (oldRow == null) incrementSize(cctx.cacheId()); KeyCacheObject key = newRow.key(); GridCacheQueryManager qryMgr = cctx.queries(); if (qryMgr.enabled()) qryMgr.store(newRow, oldRow, true); updatePendingEntries(cctx, newRow, oldRow); if (oldRow != null) { assert oldRow.link() != 0 : oldRow; if (newRow.link() != oldRow.link()) rowStore.removeRow(oldRow.link(), grp.statisticsHolderData()); } updateIgfsMetrics(cctx, key, (oldRow != null ? oldRow.value() : null), newRow.value()); }
updateRow.cacheId(CU.UNDEFINED_CACHE_ID); rowStore.addRow(updateRow, grp.statisticsHolderData()); rowStore.addRow(updateRow, grp.statisticsHolderData());
if (canUpdateOldRow(cctx, oldRow, dataRow) && rowStore.updateRow(oldRow.link(), dataRow, grp.statisticsHolderData())) { old = oldRow; rowStore.addRow(dataRow, grp.statisticsHolderData());
rowStore.updateDataRow(oldRow.link(), mvccUpdateMarker, mvccSnapshot, grp.statisticsHolderData()); updateRow.cacheId(CU.UNDEFINED_CACHE_ID); rowStore.addRow(updateRow, grp.statisticsHolderData()); rowStore.addRow(updateRow, grp.statisticsHolderData());
rowStore.updateDataRow(oldRow.link(), mvccUpdateMarker, mvccSnapshot, grp.statisticsHolderData()); rowStore.updateDataRow(oldRow.link(), mvccUpdateMarker, mvccSnapshot, grp.statisticsHolderData()); rowStore.addRow(updateRow, grp.statisticsHolderData()); rowStore.addRow(updateRow, grp.statisticsHolderData());
rowStore.updateDataRow(oldRow.link(), mvccUpdateMarker, mvccSnapshot, grp.statisticsHolderData());
rowStore.removeRow(row.link(), grp.statisticsHolderData());