protected void removeIndex(Collection<Record> records) { Indexes indexes = mapContainer.getIndexes(partitionId); if (!indexes.hasIndex()) { return; } for (Record record : records) { removeIndex(record); } }
protected void removeIndex(Collection<Record> records) { Indexes indexes = mapContainer.getIndexes(partitionId); if (!indexes.haveAtLeastOneIndex()) { return; } for (Record record : records) { removeIndex(record); } }
private void clearGlobalIndexes() { Indexes indexes = mapContainer.getIndexes(partitionId); if (indexes.isGlobal()) { if (indexes.hasIndex()) { // clears indexed data of this partition // from shared global index. fullScanLocalDataToClear(indexes); } } }
private void clearPartitionedIndexes(boolean onStorageDestroy) { Indexes indexes = mapContainer.getIndexes(partitionId); if (indexes.isGlobal()) { return; } if (onStorageDestroy) { indexes.destroyIndexes(); } else { indexes.clearAll(); } }
private void clearGlobalIndexes() { Indexes indexes = mapContainer.getIndexes(partitionId); if (indexes.isGlobal()) { if (indexes.haveAtLeastOneIndex()) { // clears indexed data of this partition // from shared global index. fullScanLocalDataToClear(indexes); } } }
protected boolean isUseCachedDeserializedValuesEnabled(MapContainer mapContainer, int partitionId) { CacheDeserializedValues cacheDeserializedValues = mapContainer.getMapConfig().getCacheDeserializedValues(); switch (cacheDeserializedValues) { case NEVER: return false; case ALWAYS: return true; default: //if index exists then cached value is already set -> let's use it return mapContainer.getIndexes(partitionId).haveAtLeastOneIndex(); } }
protected boolean isUseCachedDeserializedValuesEnabled(MapContainer mapContainer, int partitionId) { CacheDeserializedValues cacheDeserializedValues = mapContainer.getMapConfig().getCacheDeserializedValues(); switch (cacheDeserializedValues) { case NEVER: return false; case ALWAYS: return true; default: //if index exists then cached value is already set -> let's use it return mapContainer.getIndexes(partitionId).hasIndex(); } }
private void clearPartitionedIndexes(boolean onStorageDestroy) { Indexes indexes = mapContainer.getIndexes(partitionId); if (indexes.isGlobal()) { return; } if (onStorageDestroy) { indexes.destroyIndexes(); } else { indexes.clearAll(); } }
public boolean shouldCloneOnEntryProcessing(int partitionId) { return getIndexes(partitionId).haveAtLeastOneIndex() && OBJECT.equals(mapConfig.getInMemoryFormat()); }
protected void removeIndex(Record record) { Indexes indexes = mapContainer.getIndexes(partitionId); if (indexes.haveAtLeastOneIndex()) { Data key = record.getKey(); Object value = Records.getValueOrCachedValue(record, serializationService); indexes.removeEntry(key, value, Index.OperationSource.USER); } }
protected void removeIndex(Record record) { Indexes indexes = mapContainer.getIndexes(partitionId); if (indexes.hasIndex()) { Data key = record.getKey(); Object value = Records.getValueOrCachedValue(record, serializationService); indexes.removeEntryIndex(key, value, Index.OperationSource.USER); } }
protected void saveIndex(Record record, Object oldValue) { Data dataKey = record.getKey(); Indexes indexes = mapContainer.getIndexes(partitionId); if (indexes.haveAtLeastOneIndex()) { Object value = Records.getValueOrCachedValue(record, serializationService); QueryableEntry queryableEntry = mapContainer.newQueryEntry(dataKey, value); indexes.putEntry(queryableEntry, oldValue, Index.OperationSource.USER); } }
protected void saveIndex(Record record, Object oldValue) { Data dataKey = record.getKey(); Indexes indexes = mapContainer.getIndexes(partitionId); if (indexes.hasIndex()) { Object value = Records.getValueOrCachedValue(record, serializationService); QueryableEntry queryableEntry = mapContainer.newQueryEntry(dataKey, value); indexes.saveEntryIndex(queryableEntry, oldValue, Index.OperationSource.USER); } }
private void addPartitionIndexes(RecordStore recordStore, int partitionId, Collection<IndexInfo> indexInfos) { if (indexInfos == null) { return; } MapContainer mapContainer = recordStore.getMapContainer(); if (!mapContainer.isGlobalIndexEnabled()) { Indexes indexes = mapContainer.getIndexes(partitionId); for (IndexInfo indexInfo : indexInfos) { indexes.addOrGetIndex(indexInfo.getAttributeName(), indexInfo.isOrdered()); } } }
Result runPartitionScanQueryOnGivenOwnedPartition(Query query, int partitionId) { MapContainer mapContainer = mapServiceContext.getMapContainer(query.getMapName()); Predicate predicate = queryOptimizer.optimize(query.getPredicate(), mapContainer.getIndexes(partitionId)); Collection<Integer> partitions = singletonList(partitionId); Result result = createResult(query, partitions); partitionScanExecutor.execute(query.getMapName(), predicate, partitions, result); result.completeConstruction(partitions); return result; }
Result runPartitionScanQueryOnGivenOwnedPartition(Query query, int partitionId) { MapContainer mapContainer = mapServiceContext.getMapContainer(query.getMapName()); Predicate predicate = queryOptimizer.optimize(query.getPredicate(), mapContainer.getIndexes(partitionId)); Collection<Integer> partitions = Collections.singletonList(partitionId); Result result = createResult(query, partitions); partitionScanExecutor.execute(query.getMapName(), predicate, partitions, result); result.completeConstruction(partitions); return result; }
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 { QueryRunner queryRunner = mapServiceContext.getMapQueryRunner(getName()); // partition scan only, since we can't run partition queries on global indexes result = queryRunner.runPartitionScanQueryOnGivenOwnedPartition(query, getPartitionId()); // we have to increment query count here manually since we are not even // trying to use indexes Indexes indexes = mapServiceContext.getMapContainer(getName()).getIndexes(); indexes.getIndexesStats().incrementQueryCount(); }
@Override public void run() throws Exception { QueryRunner queryRunner = mapServiceContext.getMapQueryRunner(getName()); // partition scan only, since we can't run partition queries on global indexes result = queryRunner.runPartitionScanQueryOnGivenOwnedPartition(query, getPartitionId()); // we have to increment query count here manually since we are not even // trying to use indexes Indexes indexes = mapServiceContext.getMapContainer(getName()).getIndexes(); indexes.getIndexesStats().incrementQueryCount(); }