tkalkirill commented on code in PR #3446:
URL: https://github.com/apache/ignite-3/pull/3446#discussion_r1533291015
##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/store/FilePageStoreManager.java:
##########
@@ -482,4 +484,25 @@ public void addStore(GroupPartitionId groupPartitionId,
FilePageStore filePageSt
return filePageStore;
});
}
+
+ /**
+ * Destroys the group directory with all sub-directories and files if it
exists.
+ *
+ * @throws IOException If there was an I/O error when deleting a directory.
+ */
+ public void destroyGroupIfExists(int groupId) throws IOException {
+ Path groupDir = groupDir(groupId);
+
+ try {
+ if (exists(groupDir)) {
+ deleteIfExistsThrowable(groupDir);
+ }
+ } catch (IOException e) {
+ throw new IOException("Failed to delete group directory: " +
groupDir, e);
Review Comment:
I agree, but I thought that such an exception was more understandable, in
the example below we see the reason that we could not delete a certain file,
but the top-level exception suggested that we could not delete the directory we
were interested in due to an error with a specific file, this is more clear to
me and understandable. I want to leave it as it is.
`java.io.IOException: Failed to delete group directory:
build\work\FilePageStoreManagerTest\tdgie_15898\db\table-1
at
org.apache.ignite.internal.pagememory.persistence.store.FilePageStoreManager.destroyGroupIfExists(FilePageStoreManager.java:501)
at
org.apache.ignite.internal.pagememory.persistence.store.FilePageStoreManagerTest.testDestroyGroupIfExists(FilePageStoreManagerTest.java:569)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
Caused by: java.nio.file.AccessDeniedException:
build\work\FilePageStoreManagerTest\tdgie_15898\db\table-1\part-0.bin
at
java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89)
at
java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
at
java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
at
java.base/sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:274)
at
java.base/sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:105)
at java.base/java.nio.file.Files.delete(Files.java:1142)
at
org.apache.ignite.internal.util.IgniteUtils$1.visitFile(IgniteUtils.java:455)
at
org.apache.ignite.internal.util.IgniteUtils$1.visitFile(IgniteUtils.java:441)
at java.base/java.nio.file.Files.walkFileTree(Files.java:2725)
at java.base/java.nio.file.Files.walkFileTree(Files.java:2797)
at
org.apache.ignite.internal.util.IgniteUtils.deleteIfExistsThrowable(IgniteUtils.java:441)
at
org.apache.ignite.internal.pagememory.persistence.store.FilePageStoreManager.destroyGroupIfExists(FilePageStoreManager.java:498)
... 4 more
`
--
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]