Search in sources :

Example 21 with Record

use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.

the class TxnDeleteOperation method run.

@Override
public void run() {
    recordStore.unlock(dataKey, ownerUuid, getThreadId(), getCallId());
    Record record = recordStore.getRecord(dataKey);
    if (record == null || version == record.getVersion()) {
        dataOldValue = getNodeEngine().toData(recordStore.remove(dataKey));
        successful = dataOldValue != null;
    }
}
Also used : Record(com.hazelcast.map.impl.record.Record)

Example 22 with Record

use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.

the class EntryOperator method onAddedOrUpdated.

private void onAddedOrUpdated() {
    Object newValue = inMemoryFormat == OBJECT ? entry.getValue() : entry.getByPrioritizingDataValue();
    if (backup) {
        recordStore.putBackup(dataKey, newValue, entry.getNewTtl(), UNSET, UNSET, NOT_WAN);
    } else {
        recordStore.setWithUncountedAccess(dataKey, newValue, entry.getNewTtl(), UNSET);
        if (mapOperation.isPostProcessing(recordStore)) {
            Record record = recordStore.getRecord(dataKey);
            newValue = record == null ? null : record.getValue();
            entry.setValueByInMemoryFormat(inMemoryFormat, newValue);
        }
        mapServiceContext.interceptAfterPut(mapContainer.getInterceptorRegistry(), newValue);
        stats.incrementPutLatencyNanos(Timer.nanosElapsed(startTimeNanos));
    }
}
Also used : Record(com.hazelcast.map.impl.record.Record)

Example 23 with Record

use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.

the class MapReplicationStateHolder method readRecordStoreData.

protected void readRecordStoreData(String mapName, ObjectDataInput in) throws IOException {
    int numOfRecords = in.readInt();
    List keyRecord = new ArrayList<>(numOfRecords * 3);
    for (int j = 0; j < numOfRecords; j++) {
        Data dataKey = IOUtil.readData(in);
        Record record = Records.readRecord(in);
        ExpiryMetadata expiryMetadata = Records.readExpiry(in);
        keyRecord.add(dataKey);
        keyRecord.add(record);
        keyRecord.add(expiryMetadata);
    }
    LocalRecordStoreStatsImpl stats = new LocalRecordStoreStatsImpl();
    stats.readData(in);
    recordStoreStatsPerMapName.put(mapName, stats);
    data.put(mapName, keyRecord);
}
Also used : LocalRecordStoreStatsImpl(com.hazelcast.internal.monitor.impl.LocalRecordStoreStatsImpl) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Data(com.hazelcast.internal.serialization.Data) Record(com.hazelcast.map.impl.record.Record) ExpiryMetadata(com.hazelcast.map.impl.recordstore.expiry.ExpiryMetadata)

Example 24 with Record

use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.

the class MapReplicationStateHolder method writeData.

@Override
public void writeData(ObjectDataOutput out) throws IOException {
    out.writeInt(storesByMapName.size());
    for (Map.Entry<String, RecordStore<Record>> entry : storesByMapName.entrySet()) {
        String mapName = entry.getKey();
        RecordStore<Record> recordStore = entry.getValue();
        out.writeString(mapName);
        writeRecordStore(mapName, recordStore, out);
        recordStore.getStats().writeData(out);
    }
    out.writeInt(loaded.size());
    for (Map.Entry<String, Boolean> loadedEntry : loaded.entrySet()) {
        out.writeString(loadedEntry.getKey());
        out.writeBoolean(loadedEntry.getValue());
    }
    out.writeInt(mapIndexInfos.size());
    for (MapIndexInfo mapIndexInfo : mapIndexInfos) {
        out.writeObject(mapIndexInfo);
    }
}
Also used : RecordStore(com.hazelcast.map.impl.recordstore.RecordStore) MapIndexInfo(com.hazelcast.query.impl.MapIndexInfo) Record(com.hazelcast.map.impl.record.Record) HashMap(java.util.HashMap) MapUtil.createHashMap(com.hazelcast.internal.util.MapUtil.createHashMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Example 25 with Record

use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.

the class MapChunk method writeChunk.

/**
 * This method writes a map's main data, which is key-value
 * pairs, to output stream.
 * <p>
 * If number of written bytes exceeds chunk limit, it stops writing.
 * Next key-values pairs are written in subsequent chunks later.
 */
protected final void writeChunk(ObjectDataOutput out, MapChunkContext context) throws IOException {
    SerializationService ss = context.getSerializationService();
    long recordCount = 0;
    out.writeString(context.getMapName());
    Iterator<Map.Entry<Data, Record>> entries = context.getIterator();
    while (entries.hasNext()) {
        Map.Entry<Data, Record> entry = entries.next();
        Data dataKey = entry.getKey();
        Record record = entry.getValue();
        Data dataValue = ss.toData(record.getValue());
        IOUtil.writeData(out, dataKey);
        Records.writeRecord(out, record, dataValue);
        Records.writeExpiry(out, context.getExpiryMetadata(dataKey));
        recordCount++;
        if (isEndOfChunk.getAsBoolean()) {
            break;
        }
    }
    incrementReplicationRecordCount(recordCount);
    if (!entries.hasNext()) {
        incrementReplicationCount();
    }
    // indicates end of chunk
    IOUtil.writeData(out, null);
}
Also used : DelayedEntry(com.hazelcast.map.impl.mapstore.writebehind.entry.DelayedEntry) DelayedEntries.newAddedDelayedEntry(com.hazelcast.map.impl.mapstore.writebehind.entry.DelayedEntries.newAddedDelayedEntry) SerializationService(com.hazelcast.internal.serialization.SerializationService) Data(com.hazelcast.internal.serialization.Data) Record(com.hazelcast.map.impl.record.Record) Map(java.util.Map) MapUtil.createHashMap(com.hazelcast.internal.util.MapUtil.createHashMap)

Aggregations

Record (com.hazelcast.map.impl.record.Record)109 Data (com.hazelcast.internal.serialization.Data)27 Data (com.hazelcast.nio.serialization.Data)22 Map (java.util.Map)13 EntryEventData (com.hazelcast.map.impl.event.EntryEventData)11 ExpiryMetadata (com.hazelcast.map.impl.recordstore.expiry.ExpiryMetadata)11 EntryView (com.hazelcast.core.EntryView)8 Indexes (com.hazelcast.query.impl.Indexes)8 ArrayList (java.util.ArrayList)7 MapUtil.createHashMap (com.hazelcast.internal.util.MapUtil.createHashMap)6 MapContainer (com.hazelcast.map.impl.MapContainer)6 DelayedEntry (com.hazelcast.map.impl.mapstore.writebehind.entry.DelayedEntry)6 RecordStore (com.hazelcast.map.impl.recordstore.RecordStore)6 QueryableEntry (com.hazelcast.query.impl.QueryableEntry)6 EntryViews.createSimpleEntryView (com.hazelcast.map.impl.EntryViews.createSimpleEntryView)5 MapService (com.hazelcast.map.impl.MapService)5 List (java.util.List)5 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)4 InternalSerializationService (com.hazelcast.internal.serialization.InternalSerializationService)3 MapEntries (com.hazelcast.map.impl.MapEntries)3