use of org.apache.ignite.internal.processors.cache.CacheObjectContext in project ignite by apache.
the class GridNearTxEnlistRequest method finishUnmarshal.
/**
* {@inheritDoc}
*/
@Override
public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
super.finishUnmarshal(ctx, ldr);
if (keys != null) {
rows = new ArrayList<>(keys.length);
CacheObjectContext objCtx = ctx.cacheContext(cacheId).cacheObjectContext();
for (int i = 0; i < keys.length; i++) {
keys[i].finishUnmarshal(objCtx, ldr);
if (op.isDeleteOrLock())
rows.add(keys[i]);
else {
if (values[i] != null) {
if (op.isInvoke())
((GridInvokeValue) values[i]).finishUnmarshal(ctx, ldr);
else
((CacheObject) values[i]).finishUnmarshal(objCtx, ldr);
}
rows.add(new IgniteBiTuple<>(keys[i], values[i]));
}
}
keys = null;
values = null;
}
if (filter != null)
filter.finishUnmarshal(ctx.cacheContext(cacheId), ldr);
}
use of org.apache.ignite.internal.processors.cache.CacheObjectContext in project ignite by apache.
the class GridCacheQueryManager method store.
/**
* @param newRow New row.
* @param prevRow Previous row.
* @param prevRowAvailable Whether previous row is available.
* @throws IgniteCheckedException In case of error.
*/
public void store(CacheDataRow newRow, @Nullable CacheDataRow prevRow, boolean prevRowAvailable) throws IgniteCheckedException {
assert enabled();
assert newRow != null && newRow.value() != null && newRow.link() != 0 : newRow;
if (!enterBusy())
throw new NodeStoppingException("Operation has been cancelled (node is stopping).");
try {
if (isIndexingSpiEnabled()) {
CacheObjectContext coctx = cctx.cacheObjectContext();
Object key0 = unwrapIfNeeded(newRow.key(), coctx);
Object val0 = unwrapIfNeeded(newRow.value(), coctx);
cctx.kernalContext().indexing().store(cacheName, key0, val0, newRow.expireTime());
}
if (qryProcEnabled)
qryProc.store(cctx, newRow, prevRow, prevRowAvailable);
} finally {
invalidateResultCache();
leaveBusy();
}
}
use of org.apache.ignite.internal.processors.cache.CacheObjectContext in project ignite by apache.
the class StandaloneWalRecordsIterator method postProcessDataRecord.
/**
* Performs post processing of lazy data record, converts it to unwrap record.
*
* @param dataRec data record to post process records.
* @param kernalCtx kernal context.
* @param processor processor to convert binary form from WAL into CacheObject/BinaryObject.
* @return post-processed record.
* @throws IgniteCheckedException if failed.
*/
@NotNull
private WALRecord postProcessDataRecord(@NotNull DataRecord dataRec, GridKernalContext kernalCtx, IgniteCacheObjectProcessor processor) throws IgniteCheckedException {
final CacheObjectContext fakeCacheObjCtx = new CacheObjectContext(kernalCtx, null, null, false, false, false, false, false);
final int entryCnt = dataRec.entryCount();
final List<DataEntry> postProcessedEntries = new ArrayList<>(entryCnt);
for (int i = 0; i < entryCnt; i++) {
final DataEntry postProcessedEntry = postProcessDataEntry(processor, fakeCacheObjCtx, dataRec.get(i));
postProcessedEntries.add(postProcessedEntry);
}
DataRecord res = dataRec instanceof MvccDataRecord ? new MvccDataRecord(postProcessedEntries, dataRec.timestamp()) : new DataRecord(postProcessedEntries, dataRec.timestamp());
res.size(dataRec.size());
res.position(dataRec.position());
return res;
}
use of org.apache.ignite.internal.processors.cache.CacheObjectContext in project ignite by apache.
the class CacheObjectBinaryProcessorImpl method contextForCache.
/**
* {@inheritDoc}
*/
@SuppressWarnings("deprecation")
@Override
public CacheObjectContext contextForCache(CacheConfiguration ccfg) throws IgniteCheckedException {
assert ccfg != null;
boolean storeVal = !ccfg.isCopyOnRead() || (!isBinaryEnabled(ccfg) && (QueryUtils.isEnabled(ccfg) || ctx.config().isPeerClassLoadingEnabled()));
boolean binaryEnabled = marsh instanceof BinaryMarshaller && !GridCacheUtils.isSystemCache(ccfg.getName());
AffinityKeyMapper cacheAffMapper = ccfg.getAffinityMapper();
AffinityKeyMapper dfltAffMapper = binaryEnabled ? new CacheDefaultBinaryAffinityKeyMapper(ccfg.getKeyConfiguration()) : new GridCacheDefaultAffinityKeyMapper();
ctx.resource().injectGeneric(dfltAffMapper);
return new CacheObjectContext(ctx, ccfg.getName(), dfltAffMapper, QueryUtils.isCustomAffinityMapper(ccfg.getAffinityMapper()), ccfg.isCopyOnRead(), storeVal, ctx.config().isPeerClassLoadingEnabled() && !isBinaryEnabled(ccfg), binaryEnabled);
}
use of org.apache.ignite.internal.processors.cache.CacheObjectContext in project ignite by apache.
the class CacheDataRowAdapter method initFromLink.
/**
* 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);
}
Aggregations