tkalkirill commented on code in PR #1305:
URL: https://github.com/apache/ignite-3/pull/1305#discussion_r1012763915
##########
modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/impl/TestMvTableStorage.java:
##########
@@ -93,62 +67,59 @@ public TestMvTableStorage(TableConfiguration tableCfg,
TablesConfiguration table
}
@Override
- public MvPartitionStorage getOrCreateMvPartition(int partitionId) throws
StorageException {
- return partitions.computeIfAbsent(partitionId,
TestMvPartitionStorage::new);
+ public TestMvPartitionStorage getOrCreateMvPartition(int partitionId)
throws StorageException {
+ return storagesByPartitionId
+ .computeIfAbsent(partitionId, partId -> new Storages(new
TestMvPartitionStorage(partId)))
+ .mvPartitionStorage;
}
@Override
@Nullable
- public MvPartitionStorage getMvPartition(int partitionId) {
- return partitions.get(partitionId);
+ public TestMvPartitionStorage getMvPartition(int partitionId) {
+ Storages storages = storagesByPartitionId.get(partitionId);
+
+ return storages == null ? null : storages.mvPartitionStorage;
}
@Override
public void destroyPartition(int partitionId) throws StorageException {
- partitions.remove(partitionId);
-
- sortedIndicesById.values().forEach(indices ->
indices.storageByPartitionId.remove(partitionId));
- hashIndicesById.values().forEach(indices ->
indices.storageByPartitionId.remove(partitionId));
+ storagesByPartitionId.remove(partitionId);
}
@Override
- public SortedIndexStorage getOrCreateSortedIndex(int partitionId, UUID
indexId) {
- if (!partitions.containsKey(partitionId)) {
- throw new StorageException("Partition ID " + partitionId + " does
not exist");
- }
+ public TestSortedIndexStorage getOrCreateSortedIndex(int partitionId, UUID
indexId) throws StorageException {
+ Storages storages = storagesByPartitionId.get(partitionId);
- SortedIndices sortedIndices = sortedIndicesById.computeIfAbsent(
- indexId,
- id -> new SortedIndices(new SortedIndexDescriptor(id,
tablesCfg.value()))
- );
+ checkPartitionStoragesExists(storages, partitionId);
Review Comment:
Please see the documentation for the base method. =)
I did not change it and kept the logic.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]