sashapolo commented on code in PR #3352:
URL: https://github.com/apache/ignite-3/pull/3352#discussion_r1513007625
##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/hash/PageMemoryHashIndexStorage.java:
##########
@@ -150,15 +152,16 @@ public void remove(IndexRow row) throws StorageException {
* @param executor {@link GradualTaskExecutor} on which to destroy.
* @throws StorageException If something goes wrong.
*/
- public void startDestructionOn(GradualTaskExecutor executor) throws
StorageException {
+ public CompletableFuture<Void> startDestructionOn(GradualTaskExecutor
executor) throws StorageException {
Review Comment:
Fixed
##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/sorted/PageMemorySortedIndexStorage.java:
##########
@@ -226,15 +228,16 @@ public void updateDataStructures(IndexColumnsFreeList
freeList, SortedIndexTree
* @param executor {@link GradualTaskExecutor} on which to destroy.
* @throws StorageException If something goes wrong.
*/
- public void startDestructionOn(GradualTaskExecutor executor) throws
StorageException {
+ public CompletableFuture<Void> startDestructionOn(GradualTaskExecutor
executor) throws StorageException {
Review Comment:
Fixed
##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/AbstractPageMemoryMvPartitionStorage.java:
##########
@@ -969,4 +977,44 @@ IndexMeta createIndexMetaForNewIndex(int indexId) {
return sortedIndexes.get(indexId);
});
}
+
+ /**
+ * Destroys an index storage identified by the given index ID.
+ *
+ * @param indexId Index ID which storage will be destroyed.
+ * @return Future that will be completed as soon as the storage has been
destroyed.
+ */
+ public CompletableFuture<Void> destroyIndex(int indexId) {
+ return busy(() -> {
+ throwExceptionIfStorageNotInRunnableState();
+
+ CompletableFuture<Void> result = nullCompletedFuture();
+
+ PageMemoryHashIndexStorage hashIndexStorage =
hashIndexes.remove(indexId);
+
+ if (hashIndexStorage != null) {
+ assert !sortedIndexes.containsKey(indexId);
+
+ result =
hashIndexStorage.startDestructionOn(destructionExecutor)
+ .whenComplete((v, e) -> hashIndexStorage.close());
+ }
+
+ PageMemorySortedIndexStorage sortedIndexStorage =
sortedIndexes.remove(indexId);
+
+ if (sortedIndexStorage != null) {
+ result =
sortedIndexStorage.startDestructionOn(destructionExecutor)
+ .whenComplete((v, e) -> sortedIndexStorage.close());
+ }
+
+ return result.thenRun(() -> runConsistently(locker -> {
Review Comment:
Fixed
--
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]