use of com.hazelcast.map.impl.PartitionContainer 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.PartitionContainer in project hazelcast by hazelcast.
the class MapDestroyTest method assertAllPartitionContainersAreEmpty.
private void assertAllPartitionContainersAreEmpty(HazelcastInstance instance) {
MapServiceContext context = getMapServiceContext(instance);
int partitionCount = getPartitionCount(instance);
for (int i = 0; i < partitionCount; i++) {
PartitionContainer container = context.getPartitionContainer(i);
Map<String, ?> maps = container.getMaps().entrySet().stream().filter(e -> !e.getKey().startsWith(JobRepository.INTERNAL_JET_OBJECTS_PREFIX)).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
assertTrue(maps.isEmpty());
}
}
use of com.hazelcast.map.impl.PartitionContainer in project hazelcast by hazelcast.
the class Accessors method getAllIndexes.
/**
* Obtains a list of {@link Indexes} for the given map local to the node
* associated with it.
* <p>
* There may be more than one indexes instance associated with a map if its
* indexes are partitioned.
*
* @param map the map to obtain the indexes for.
* @return the obtained indexes list.
*/
public static List<Indexes> getAllIndexes(IMap map) {
MapProxyImpl mapProxy = (MapProxyImpl) map;
String mapName = mapProxy.getName();
NodeEngine nodeEngine = mapProxy.getNodeEngine();
IPartitionService partitionService = nodeEngine.getPartitionService();
MapService mapService = nodeEngine.getService(MapService.SERVICE_NAME);
MapServiceContext mapServiceContext = mapService.getMapServiceContext();
MapContainer mapContainer = mapServiceContext.getMapContainer(mapName);
Indexes maybeGlobalIndexes = mapContainer.getIndexes();
if (maybeGlobalIndexes != null) {
return Collections.singletonList(maybeGlobalIndexes);
}
PartitionContainer[] partitionContainers = mapServiceContext.getPartitionContainers();
List<Indexes> allIndexes = new ArrayList<>();
for (PartitionContainer partitionContainer : partitionContainers) {
IPartition partition = partitionService.getPartition(partitionContainer.getPartitionId());
if (!partition.isLocal()) {
continue;
}
Indexes partitionIndexes = partitionContainer.getIndexes().get(mapName);
if (partitionIndexes == null) {
continue;
}
assert !partitionIndexes.isGlobal();
allIndexes.add(partitionIndexes);
}
return allIndexes;
}
Aggregations