@Override public RecordStore getRecordStore(int partitionId, String mapName) { return getPartitionContainer(partitionId).getRecordStore(mapName); }
@Override public RecordStore getRecordStore(int partitionId, String mapName, boolean skipLoadingOnCreate) { return getPartitionContainer(partitionId).getRecordStore(mapName, skipLoadingOnCreate); }
@Override public RecordStore getRecordStore(int partitionId, String mapName) { return getPartitionContainer(partitionId).getRecordStore(mapName); }
@Override public RecordStore getRecordStore(int partitionId, String mapName, boolean skipLoadingOnCreate) { return getPartitionContainer(partitionId).getRecordStore(mapName, skipLoadingOnCreate); }
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); } }
final List<QueryableEntry> resultList = new LinkedList<QueryableEntry>(); final PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(partitionId); final RecordStore recordStore = partitionContainer.getRecordStore(mapName); final Extractors extractors = mapServiceContext.getExtractors(mapName);
final List<QueryableEntry> resultList = new LinkedList<QueryableEntry>(); final PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(partitionId); final RecordStore recordStore = partitionContainer.getRecordStore(mapName); final Extractors extractors = mapServiceContext.getExtractors(mapName);
void prepare(PartitionContainer container, Collection<ServiceNamespace> namespaces, int replicaIndex) { int size = namespaces.size(); flushSequences = createHashMap(size); delayedEntries = createHashMap(size); for (ServiceNamespace namespace : namespaces) { ObjectNamespace mapNamespace = (ObjectNamespace) namespace; String mapName = mapNamespace.getObjectName(); RecordStore recordStore = container.getRecordStore(mapName); if (recordStore == null) { continue; } 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; } delayedEntries.put(mapName, entries); flushSequences.put(mapName, new ArrayDeque<WriteBehindStore.Sequence>(mapDataStore.getFlushSequences())); } }
void prepare(PartitionContainer container, Collection<ServiceNamespace> namespaces, int replicaIndex) { int size = namespaces.size(); flushSequences = createHashMap(size); delayedEntries = createHashMap(size); for (ServiceNamespace namespace : namespaces) { ObjectNamespace mapNamespace = (ObjectNamespace) namespace; String mapName = mapNamespace.getObjectName(); RecordStore recordStore = container.getRecordStore(mapName); if (recordStore == null) { continue; } 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; } delayedEntries.put(mapName, entries); flushSequences.put(mapName, new ArrayDeque<WriteBehindStore.Sequence>(mapDataStore.getFlushSequences())); } }
@SuppressWarnings("unchecked") public void run(String mapName, Predicate predicate, int partitionId, Result result) { PagingPredicate pagingPredicate = predicate instanceof PagingPredicate ? (PagingPredicate) predicate : null; PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(partitionId); MapContainer mapContainer = mapServiceContext.getMapContainer(mapName); Iterator<Record> iterator = partitionContainer.getRecordStore(mapName).loadAwareIterator(getNow(), false); Map.Entry<Integer, Map.Entry> nearestAnchorEntry = getNearestAnchorEntry(pagingPredicate); boolean useCachedValues = isUseCachedDeserializedValuesEnabled(mapContainer, partitionId); Extractors extractors = mapServiceContext.getExtractors(mapName); LazyMapEntry queryEntry = new LazyMapEntry(); while (iterator.hasNext()) { Record record = iterator.next(); Data key = (Data) toData(record.getKey()); Object value = toData( useCachedValues ? Records.getValueOrCachedValue(record, serializationService) : record.getValue()); if (value == null) { continue; } queryEntry.init(serializationService, key, value, extractors); if (predicate.apply(queryEntry) && compareAnchor(pagingPredicate, queryEntry, nearestAnchorEntry)) { result.add(queryEntry); // We can't reuse the existing entry after it was added to the // result. Allocate the new one. queryEntry = new LazyMapEntry(); } } result.orderAndLimit(pagingPredicate, nearestAnchorEntry); }
@SuppressWarnings("unchecked") public void run(String mapName, Predicate predicate, int partitionId, Result result) { PagingPredicate pagingPredicate = predicate instanceof PagingPredicate ? (PagingPredicate) predicate : null; PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(partitionId); MapContainer mapContainer = mapServiceContext.getMapContainer(mapName); Iterator<Record> iterator = partitionContainer.getRecordStore(mapName).loadAwareIterator(getNow(), false); Map.Entry<Integer, Map.Entry> nearestAnchorEntry = getNearestAnchorEntry(pagingPredicate); boolean useCachedValues = isUseCachedDeserializedValuesEnabled(mapContainer, partitionId); Extractors extractors = mapServiceContext.getExtractors(mapName); LazyMapEntry queryEntry = new LazyMapEntry(); while (iterator.hasNext()) { Record record = iterator.next(); Data key = (Data) toData(record.getKey()); Object value = toData( useCachedValues ? Records.getValueOrCachedValue(record, serializationService) : record.getValue()); if (value == null) { continue; } queryEntry.init(serializationService, key, value, extractors); if (predicate.apply(queryEntry) && compareAnchor(pagingPredicate, queryEntry, nearestAnchorEntry)) { result.add(queryEntry); // We can't reuse the existing entry after it was added to the // result. Allocate the new one. queryEntry = new LazyMapEntry(); } } result.orderAndLimit(pagingPredicate, nearestAnchorEntry); }