use of com.hazelcast.map.impl.recordstore.expiry.ExpiryMetadata 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);
}
use of com.hazelcast.map.impl.recordstore.expiry.ExpiryMetadata in project hazelcast by hazelcast.
the class MapOperation method publishWanUpdateInternal.
private void publishWanUpdateInternal(Data dataKey, Object value, boolean hasLoadProvenance) {
if (!canPublishWanEvent) {
return;
}
Record<Object> record = recordStore.getRecord(dataKey);
if (record == null) {
return;
}
Data dataValue = toHeapData(mapServiceContext.toData(value));
ExpiryMetadata expiryMetadata = recordStore.getExpirySystem().getExpiryMetadata(dataKey);
WanMapEntryView<Object, Object> entryView = createWanEntryView(toHeapData(dataKey), dataValue, record, expiryMetadata, getNodeEngine().getSerializationService());
mapEventPublisher.publishWanUpdate(name, entryView, hasLoadProvenance);
}
use of com.hazelcast.map.impl.recordstore.expiry.ExpiryMetadata in project hazelcast by hazelcast.
the class MapChunk method readChunk.
private void readChunk(ObjectDataInput in) throws IOException {
this.mapName = in.readString();
LinkedList keyRecordExpiry = new LinkedList<>();
do {
Data dataKey = IOUtil.readData(in);
// null indicates end of chunk
if (dataKey == null) {
break;
}
Record record = Records.readRecord(in);
ExpiryMetadata expiryMetadata = Records.readExpiry(in);
keyRecordExpiry.add(dataKey);
keyRecordExpiry.add(record);
keyRecordExpiry.add(expiryMetadata);
} while (true);
this.keyRecordExpiry = keyRecordExpiry;
}
use of com.hazelcast.map.impl.recordstore.expiry.ExpiryMetadata in project hazelcast by hazelcast.
the class MapChunk method putOrUpdateReplicatedData.
private void putOrUpdateReplicatedData(RecordStore recordStore) {
long nowInMillis = Clock.currentTimeMillis();
int count = 0;
do {
Data dataKey = (Data) keyRecordExpiry.poll();
Record record = (Record) keyRecordExpiry.poll();
ExpiryMetadata expiryMetadata = (ExpiryMetadata) keyRecordExpiry.poll();
Indexes indexes = recordStore.getMapContainer().getIndexes(recordStore.getPartitionId());
recordStore.putOrUpdateReplicatedRecord(dataKey, record, expiryMetadata, indexesMustBePopulated(indexes), nowInMillis);
if (recordStore.shouldEvict()) {
// No need to continue replicating records anymore.
// We are already over eviction threshold, each put record will cause another eviction.
recordStore.evictEntries(dataKey);
break;
}
if (++count % DISPOSE_AT_COUNT == 0) {
recordStore.disposeDeferredBlocks();
}
} while (!keyRecordExpiry.isEmpty());
recordStore.disposeDeferredBlocks();
}
use of com.hazelcast.map.impl.recordstore.expiry.ExpiryMetadata in project hazelcast by hazelcast.
the class PutAllBackupOperation method writeInternal.
@Override
@SuppressWarnings("checkstyle:magicnumber")
protected void writeInternal(ObjectDataOutput out) throws IOException {
super.writeInternal(out);
out.writeInt(keyValueRecordExpiry.size() / 4);
for (int i = 0; i < keyValueRecordExpiry.size(); i += 4) {
Data dataKey = (Data) keyValueRecordExpiry.get(i);
Data dataValue = (Data) keyValueRecordExpiry.get(i + 1);
Record record = (Record) keyValueRecordExpiry.get(i + 2);
ExpiryMetadata expiryMetadata = (ExpiryMetadata) keyValueRecordExpiry.get(i + 3);
IOUtil.writeData(out, dataKey);
Records.writeRecord(out, record, dataValue);
Records.writeExpiry(out, expiryMetadata);
}
out.writeBoolean(disableWanReplicationEvent);
}
Aggregations