use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class AddIndexOperation method run.
@Override
public void run() throws Exception {
Indexes indexes = mapContainer.getIndexes();
Index index = indexes.addOrGetIndex(attributeName, ordered);
final long now = getNow();
final Iterator<Record> iterator = recordStore.iterator(now, false);
SerializationService serializationService = getNodeEngine().getSerializationService();
while (iterator.hasNext()) {
final Record record = iterator.next();
Data key = record.getKey();
Object value = Records.getValueOrCachedValue(record, serializationService);
QueryableEntry queryEntry = mapContainer.newQueryEntry(key, value);
index.saveEntryIndex(queryEntry, null);
}
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class EvictorImpl method evictEntry.
private void evictEntry(RecordStore recordStore, EntryView selectedEntry) {
Record record = getRecordFromEntryView(selectedEntry);
Data key = record.getKey();
if (recordStore.isLocked(record.getKey())) {
return;
}
boolean backup = isBackup(recordStore);
recordStore.evict(key, backup);
if (!backup) {
recordStore.doPostEvictionOperations(record, backup);
}
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class EntryOperation method afterRun.
@Override
public void afterRun() throws Exception {
super.afterRun();
if (eventType == null) {
return;
}
mapServiceContext.interceptAfterPut(name, dataValue);
if (isPostProcessing(recordStore)) {
Record record = recordStore.getRecord(dataKey);
dataValue = record == null ? null : record.getValue();
}
invalidateNearCache(dataKey);
publishEntryEvent();
publishWanReplicationEvent();
evict(dataKey);
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class MapMigrationAwareService method migrateIndex.
private void migrateIndex(PartitionMigrationEvent event) {
final long now = getNow();
final PartitionContainer container = mapServiceContext.getPartitionContainer(event.getPartitionId());
for (RecordStore recordStore : container.getMaps().values()) {
final MapContainer mapContainer = mapServiceContext.getMapContainer(recordStore.getName());
final Indexes indexes = mapContainer.getIndexes();
if (!indexes.hasIndex()) {
continue;
}
final Iterator<Record> iterator = recordStore.iterator(now, false);
while (iterator.hasNext()) {
Record record = iterator.next();
Data key = record.getKey();
if (event.getMigrationEndpoint() == SOURCE) {
assert event.getNewReplicaIndex() != 0 : "Invalid migration event: " + event;
Object value = Records.getValueOrCachedValue(record, serializationService);
indexes.removeEntryIndex(key, value);
} else if (event.getNewReplicaIndex() == 0) {
Object value = Records.getValueOrCachedValue(record, serializationService);
if (value != null) {
QueryableEntry queryEntry = mapContainer.newQueryEntry(record.getKey(), value);
indexes.saveEntryIndex(queryEntry, null);
}
}
}
}
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class DefaultRecordStore method replace.
// TODO why does not replace method load data from map store if currently not available in memory.
@Override
public Object replace(Data key, Object update) {
checkIfLoaded();
final long now = getNow();
final Record record = getRecordOrNull(key, now, false);
if (record == null || record.getValue() == null) {
return null;
}
Object oldValue = record.getValue();
update = mapServiceContext.interceptPut(name, oldValue, update);
update = mapDataStore.add(key, update, now);
onStore(record);
updateRecord(key, record, update, now);
saveIndex(record, oldValue);
return oldValue;
}
Aggregations