use of com.hazelcast.map.impl.recordstore.RecordStore in project hazelcast by hazelcast.
the class StoreWorker method notifyFlush.
private void notifyFlush() {
for (int partitionId = 0; partitionId < partitionCount; partitionId++) {
RecordStore recordStore = getRecordStoreOrNull(mapName, partitionId);
if (recordStore != null) {
WriteBehindStore mapDataStore = ((WriteBehindStore) recordStore.getMapDataStore());
mapDataStore.notifyFlush();
}
}
}
use of com.hazelcast.map.impl.recordstore.RecordStore in project hazelcast by hazelcast.
the class WriteBehindStateHolder method applyState.
void applyState() {
for (Map.Entry<String, List<DelayedEntry>> entry : delayedEntries.entrySet()) {
String mapName = entry.getKey();
RecordStore recordStore = mapReplicationOperation.getRecordStore(mapName);
WriteBehindStore mapDataStore = (WriteBehindStore) recordStore.getMapDataStore();
mapDataStore.reset();
mapDataStore.setFlushSequences(flushSequences.get(mapName));
Collection<DelayedEntry> replicatedEntries = entry.getValue();
for (DelayedEntry delayedEntry : replicatedEntries) {
mapDataStore.add(delayedEntry);
mapDataStore.setSequence(delayedEntry.getSequence());
}
}
}
use of com.hazelcast.map.impl.recordstore.RecordStore in project hazelcast by hazelcast.
the class WriteBehindStateHolder method prepare.
void prepare(PartitionContainer container, int replicaIndex) {
int size = container.getMaps().size();
flushSequences = new HashMap<String, Queue<WriteBehindStore.Sequence>>(size);
delayedEntries = new HashMap<String, List<DelayedEntry>>(size);
for (Map.Entry<String, RecordStore> entry : container.getMaps().entrySet()) {
RecordStore recordStore = entry.getValue();
MapContainer mapContainer = recordStore.getMapContainer();
MapConfig mapConfig = mapContainer.getMapConfig();
if (mapConfig.getTotalBackupCount() < replicaIndex || !mapContainer.getMapStoreContext().isWriteBehindMapStoreEnabled()) {
continue;
}
WriteBehindStore mapDataStore = (WriteBehindStore) recordStore.getMapDataStore();
WriteBehindQueue<DelayedEntry> writeBehindQueue = mapDataStore.getWriteBehindQueue();
List<DelayedEntry> entries = writeBehindQueue.asList();
if (entries == null || entries.isEmpty()) {
continue;
}
String mapName = entry.getKey();
delayedEntries.put(mapName, entries);
flushSequences.put(mapName, new ArrayDeque<WriteBehindStore.Sequence>(mapDataStore.getFlushSequences()));
}
}
use of com.hazelcast.map.impl.recordstore.RecordStore in project hazelcast by hazelcast.
the class MapKeyValueSource method open.
@Override
public boolean open(NodeEngine nodeEngine) {
NodeEngineImpl nei = (NodeEngineImpl) nodeEngine;
IPartitionService ps = nei.getPartitionService();
MapService mapService = nei.getService(MapService.SERVICE_NAME);
ss = nei.getSerializationService();
Address partitionOwner = ps.getPartitionOwner(partitionId);
if (partitionOwner == null) {
return false;
}
RecordStore recordStore = mapService.getMapServiceContext().getRecordStore(partitionId, mapName);
iterator = recordStore.iterator();
return true;
}
use of com.hazelcast.map.impl.recordstore.RecordStore in project hazelcast by hazelcast.
the class MapContainerCreationUponDestroyStressTest method assertRecordStoresSharesSameMapContainerInstance.
private void assertRecordStoresSharesSameMapContainerInstance(IMap<Long, Long> map) {
String mapName = map.getName();
MapContainer expectedMapContainer = getMapContainer(map);
for (int i = 0; i < PARTITION_COUNT; i++) {
PartitionContainer partitionContainer = getMapServiceContext(map).getPartitionContainer(i);
RecordStore recordStore = partitionContainer.getMaps().get(mapName);
if (recordStore == null) {
continue;
}
assertEquals(expectedMapContainer, recordStore.getMapContainer());
}
}
Aggregations