use of com.hazelcast.map.impl.recordstore.RecordStore in project hazelcast by hazelcast.
the class EntryProcessorTest method assertTtlFromLocalRecordStore.
private void assertTtlFromLocalRecordStore(HazelcastInstance instance, Data key, long expectedTtl) {
@SuppressWarnings("unchecked") MapProxyImpl<Integer, Integer> map = (MapProxyImpl) instance.getMap(MAP_NAME);
MapService mapService = map.getNodeEngine().getService(MapService.SERVICE_NAME);
PartitionContainer[] partitionContainers = mapService.getMapServiceContext().getPartitionContainers();
for (PartitionContainer partitionContainer : partitionContainers) {
RecordStore rs = partitionContainer.getExistingRecordStore(MAP_NAME);
if (rs != null) {
Record record = rs.getRecordOrNull(key);
if (record != null) {
assertEquals(expectedTtl, rs.getExpirySystem().getExpiryMetadata(key).getTtl());
return;
}
}
}
fail("Backup not found.");
}
use of com.hazelcast.map.impl.recordstore.RecordStore in project hazelcast by hazelcast.
the class EvictionTest method testMaxIdle_backupEntryShouldNotBeReachableAfterMaxIdle.
@Test
public void testMaxIdle_backupEntryShouldNotBeReachableAfterMaxIdle() {
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
HazelcastInstance instanceA = factory.newHazelcastInstance(getConfig());
final HazelcastInstance instanceB = factory.newHazelcastInstance(getConfig());
final String keyOwnedByInstanceA = generateKeyOwnedBy(instanceA);
instanceA.getMap("Test").put(keyOwnedByInstanceA, "value0", 0, SECONDS, 3, SECONDS);
assertTrueEventually(() -> {
RecordStore owner = getRecordStore(instanceA, keyOwnedByInstanceA);
RecordStore backup = getRecordStore(instanceB, keyOwnedByInstanceA);
assertEquals(0, owner.size());
assertEquals(0, backup.size());
});
}
use of com.hazelcast.map.impl.recordstore.RecordStore in project hazelcast by hazelcast.
the class DynamicMapConfigTest method isRecordStoreExpirable.
private boolean isRecordStoreExpirable(IMap map) {
MapProxyImpl mapProxy = (MapProxyImpl) map;
MapService mapService = (MapService) mapProxy.getService();
MapServiceContext mapServiceContext = mapService.getMapServiceContext();
PartitionContainer container = mapServiceContext.getPartitionContainer(0);
RecordStore recordStore = container.getExistingRecordStore(map.getName());
return requireNonNull(recordStore).isExpirable();
}
use of com.hazelcast.map.impl.recordstore.RecordStore in project hazelcast by hazelcast.
the class RecordStoreTest method getRecordStore.
private DefaultRecordStore getRecordStore(IMap<Object, Object> map, int key) {
MapServiceContext mapServiceContext = getMapServiceContext((MapProxyImpl) map);
NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
IPartitionService partitionService = nodeEngine.getPartitionService();
int partitionId = partitionService.getPartitionId(key);
PartitionContainer container = mapServiceContext.getPartitionContainer(partitionId);
RecordStore recordStore = container.getRecordStore(map.getName());
return (DefaultRecordStore) recordStore;
}
use of com.hazelcast.map.impl.recordstore.RecordStore in project hazelcast by hazelcast.
the class MapLoaderFuturesTest method loadingFutureCount.
private static int loadingFutureCount(String mapName, HazelcastInstance node) {
int count = 0;
NodeEngineImpl nodeEngine = getNode(node).getNodeEngine();
MapService mapService = nodeEngine.getService(MapService.SERVICE_NAME);
MapServiceContext mapServiceContext = mapService.getMapServiceContext();
int partitionCount = nodeEngine.getPartitionService().getPartitionCount();
for (int i = 0; i < partitionCount; i++) {
RecordStore recordStore = mapServiceContext.getExistingRecordStore(i, mapName);
if (recordStore != null) {
count += ((DefaultRecordStore) recordStore).getLoadingFutures().size();
}
}
return count;
}
Aggregations