Search in sources :

Example 1 with LazyMvccDataEntry

use of org.apache.ignite.internal.pagemem.wal.record.LazyMvccDataEntry in project ignite by apache.

the class RecordDataV2Serializer method readMvccDataEntry.

/**
 * @param in Input to read from.
 * @return Read entry.
 */
private MvccDataEntry readMvccDataEntry(ByteBufferBackedDataInput in) throws IOException, IgniteCheckedException {
    int cacheId = in.readInt();
    int keySize = in.readInt();
    byte keyType = in.readByte();
    byte[] keyBytes = new byte[keySize];
    in.readFully(keyBytes);
    int valSize = in.readInt();
    byte valType = 0;
    byte[] valBytes = null;
    if (valSize >= 0) {
        valType = in.readByte();
        valBytes = new byte[valSize];
        in.readFully(valBytes);
    }
    byte ord = in.readByte();
    GridCacheOperation op = GridCacheOperation.fromOrdinal(ord & 0xFF);
    GridCacheVersion nearXidVer = readVersion(in, true);
    GridCacheVersion writeVer = readVersion(in, false);
    int partId = in.readInt();
    long partCntr = in.readLong();
    long expireTime = in.readLong();
    MvccVersion mvccVer = txRecordSerializer.readMvccVersion(in);
    GridCacheContext cacheCtx = cctx.cacheContext(cacheId);
    if (cacheCtx != null) {
        CacheObjectContext coCtx = cacheCtx.cacheObjectContext();
        KeyCacheObject key = co.toKeyCacheObject(coCtx, keyType, keyBytes);
        if (key.partition() == -1)
            key.partition(partId);
        CacheObject val = valBytes != null ? co.toCacheObject(coCtx, valType, valBytes) : null;
        return new MvccDataEntry(cacheId, key, val, op, nearXidVer, writeVer, expireTime, partId, partCntr, mvccVer);
    } else
        return new LazyMvccDataEntry(cctx, cacheId, keyType, keyBytes, valType, valBytes, op, nearXidVer, writeVer, expireTime, partId, partCntr, mvccVer);
}
Also used : GridCacheContext(org.apache.ignite.internal.processors.cache.GridCacheContext) MvccDataEntry(org.apache.ignite.internal.pagemem.wal.record.MvccDataEntry) LazyMvccDataEntry(org.apache.ignite.internal.pagemem.wal.record.LazyMvccDataEntry) CacheObjectContext(org.apache.ignite.internal.processors.cache.CacheObjectContext) GridCacheVersion(org.apache.ignite.internal.processors.cache.version.GridCacheVersion) MvccVersion(org.apache.ignite.internal.processors.cache.mvcc.MvccVersion) LazyMvccDataEntry(org.apache.ignite.internal.pagemem.wal.record.LazyMvccDataEntry) CacheObject(org.apache.ignite.internal.processors.cache.CacheObject) KeyCacheObject(org.apache.ignite.internal.processors.cache.KeyCacheObject) GridCacheOperation(org.apache.ignite.internal.processors.cache.GridCacheOperation) KeyCacheObject(org.apache.ignite.internal.processors.cache.KeyCacheObject)

Aggregations

LazyMvccDataEntry (org.apache.ignite.internal.pagemem.wal.record.LazyMvccDataEntry)1 MvccDataEntry (org.apache.ignite.internal.pagemem.wal.record.MvccDataEntry)1 CacheObject (org.apache.ignite.internal.processors.cache.CacheObject)1 CacheObjectContext (org.apache.ignite.internal.processors.cache.CacheObjectContext)1 GridCacheContext (org.apache.ignite.internal.processors.cache.GridCacheContext)1 GridCacheOperation (org.apache.ignite.internal.processors.cache.GridCacheOperation)1 KeyCacheObject (org.apache.ignite.internal.processors.cache.KeyCacheObject)1 MvccVersion (org.apache.ignite.internal.processors.cache.mvcc.MvccVersion)1 GridCacheVersion (org.apache.ignite.internal.processors.cache.version.GridCacheVersion)1