/** * @param partitionId partitionId */ public Indexes getIndexes(int partitionId) { if (globalIndexes != null) { return globalIndexes; } return mapServiceContext.getPartitionContainer(partitionId).getIndexes(name); }
@Override protected Iterator<RecordStore> storeIterator(int partitionId) { PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(partitionId); Collection<RecordStore> recordStores = partitionContainer.getAllRecordStores(); return recordStores.iterator(); }
@Override protected Iterator<RecordStore> storeIterator(int partitionId) { PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(partitionId); Collection<RecordStore> recordStores = partitionContainer.getAllRecordStores(); return recordStores.iterator(); }
private RecordStore getRecordStoreOrNull(String mapName, int partitionId) { PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(partitionId); return partitionContainer.getExistingRecordStore(mapName); }
/** * @param partitionId partitionId */ public Indexes getIndexes(int partitionId) { if (globalIndexes != null) { return globalIndexes; } return mapServiceContext.getPartitionContainer(partitionId).getIndexes(name); }
private RecordStore getRecordStoreOrNull(String mapName, int partitionId) { PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(partitionId); return partitionContainer.getExistingRecordStore(mapName); }
protected boolean checkPerPartitionEviction(String mapName, MaxSizeConfig maxSizeConfig, int partitionId) { final double maxSize = maxSizeConfig.getSize(); final PartitionContainer container = mapServiceContext.getPartitionContainer(partitionId); if (container == null) { return false; } final int size = getRecordStoreSize(mapName, container); return size > maxSize; }
private RecordStore getRecordStoreOrNull() { int partitionId = getPartitionId(); if (partitionId == -1) { return null; } PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(partitionId); if (createRecordStoreOnDemand) { return partitionContainer.getRecordStore(name); } else { return partitionContainer.getExistingRecordStore(name); } }
private RecordStore getRecordStoreOrNull() { int partitionId = getPartitionId(); if (partitionId == -1) { return null; } PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(partitionId); if (createRecordStoreOnDemand) { return partitionContainer.getRecordStore(name); } else { return partitionContainer.getExistingRecordStore(name); } }
private WriteBehindStore getWriteBehindStoreOrNull(int partitionId) { MapStoreContext mapStoreContext = this.mapStoreContext; MapServiceContext mapServiceContext = mapStoreContext.getMapServiceContext(); PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(partitionId); RecordStore recordStore = partitionContainer.getExistingRecordStore(mapStoreContext.getMapName()); if (recordStore == null) { return null; } return (WriteBehindStore) recordStore.getMapDataStore(); }
private WriteBehindStore getWriteBehindStoreOrNull(int partitionId) { MapStoreContext mapStoreContext = this.mapStoreContext; MapServiceContext mapServiceContext = mapStoreContext.getMapServiceContext(); PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(partitionId); RecordStore recordStore = partitionContainer.getExistingRecordStore(mapStoreContext.getMapName()); if (recordStore == null) { return null; } return (WriteBehindStore) recordStore.getMapDataStore(); }
private Data readBackupDataOrNull(Data key) { int partitionId = partitionService.getPartitionId(key); IPartition partition = partitionService.getPartition(partitionId, false); if (!partition.isOwnerOrBackup(thisAddress)) { return null; } PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(partitionId); RecordStore recordStore = partitionContainer.getExistingRecordStore(name); if (recordStore == null) { return null; } return recordStore.readBackupData(key); }
private Data readBackupDataOrNull(Data key) { int partitionId = partitionService.getPartitionId(key); IPartition partition = partitionService.getPartition(partitionId, false); if (!partition.isOwnerOrBackup(thisAddress)) { return null; } PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(partitionId); RecordStore recordStore = partitionContainer.getExistingRecordStore(name); if (recordStore == null) { return null; } return recordStore.readBackupData(key); }
protected void prepareForNextCleanup() { MapService mapService = getService(); MapServiceContext mapServiceContext = mapService.getMapServiceContext(); PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(getPartitionId()); partitionContainer.setHasRunningCleanup(false); partitionContainer.setLastCleanupTime(Clock.currentTimeMillis()); }
protected void prepareForNextCleanup() { MapService mapService = getService(); MapServiceContext mapServiceContext = mapService.getMapServiceContext(); PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(getPartitionId()); partitionContainer.setHasRunningCleanup(false); partitionContainer.setLastCleanupTime(Clock.currentTimeMillis()); }
private void clearNonGlobalIndexes(PartitionMigrationEvent event) { 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(event.getPartitionId()); if (!indexes.haveAtLeastOneIndex() || indexes.isGlobal()) { // no indexes to work with continue; } indexes.clearAll(); } }
private void clearNonGlobalIndexes(PartitionMigrationEvent event) { 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(event.getPartitionId()); if (!indexes.hasIndex() || indexes.isGlobal()) { // no indexes to work with continue; } indexes.clearAll(); } }
@Override public void run() throws Exception { if (getNodeEngine().getLocalMember().isLiteMember()) { // this operation shouldn't run on lite members. This situation can potentially be seen // when converting a data-member to lite-member during merge operations. return; } MapService mapService = getService(); MapServiceContext mapServiceContext = mapService.getMapServiceContext(); PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(getPartitionId()); ConcurrentMap<String, RecordStore> recordStores = partitionContainer.getMaps(); boolean backup = !isOwner(); for (final RecordStore recordStore : recordStores.values()) { if (recordStore.size() > 0 && recordStore.isExpirable()) { recordStore.evictExpiredEntries(expirationPercentage, backup); recordStore.disposeDeferredBlocks(); } } }
@Override public void commitMigration(PartitionMigrationEvent event) { if (event.getMigrationEndpoint() == DESTINATION) { populateIndexes(event, TargetIndexes.GLOBAL); } else { depopulateIndexes(event); } if (SOURCE == event.getMigrationEndpoint()) { removeRecordStoresHavingLesserBackupCountThan(event.getPartitionId(), event.getNewReplicaIndex()); } PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(event.getPartitionId()); for (RecordStore recordStore : partitionContainer.getAllRecordStores()) { // in case the record store has been created without loading during migration trigger again // if loading has been already started this call will do nothing recordStore.startLoading(); } mapServiceContext.reloadOwnedPartitions(); removeOrRegenerateNearCacheUuid(event); }
@Override public void commitMigration(PartitionMigrationEvent event) { if (event.getMigrationEndpoint() == DESTINATION) { populateIndexes(event, TargetIndexes.GLOBAL); } else { depopulateIndexes(event); } if (SOURCE == event.getMigrationEndpoint()) { removeRecordStoresHavingLesserBackupCountThan(event.getPartitionId(), event.getNewReplicaIndex()); } PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(event.getPartitionId()); for (RecordStore recordStore : partitionContainer.getAllRecordStores()) { // in case the record store has been created without loading during migration trigger again // if loading has been already started this call will do nothing recordStore.startLoading(); } mapServiceContext.reloadOwnedPartitions(); removeOrRegenerateNearCacheUuid(event); }