Thesharing commented on a change in pull request #16538:
URL: https://github.com/apache/flink/pull/16538#discussion_r675459858
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/blob/BlobServer.java
##########
@@ -778,6 +778,50 @@ boolean deleteInternal(@Nullable JobID jobId,
TransientBlobKey key) {
}
}
+ /**
+ * Deletes the file associated with the blob key in the local storage of
the blob server.
+ *
+ * @param jobId ID of the job this blob belongs to (or <tt>null</tt> if
job-unrelated)
+ * @param key blob key associated with the file to be deleted
+ * @return <tt>true</tt> if the given blob is successfully deleted or
non-existing;
+ * <tt>false</tt> otherwise
+ */
+ private boolean deleteInternal(JobID jobId, PermanentBlobKey key) {
+ final File localFile =
+ new File(
+
BlobUtils.getStorageLocationPath(storageDir.getAbsolutePath(), jobId, key));
+
+ readWriteLock.writeLock().lock();
+
+ try {
+ boolean deleteLocally = true;
+ if (!localFile.delete() && localFile.exists()) {
Review comment:
No exceptions will be thrown if the delete failed.
`java.io.File#delete` won't thrown any thing if the file cannot be deleted.
On the contrary, `java.nio.file.Files#delete` will throw `IOException` if the
file cannot be deleted. In fact `deleteInternal(JobID jobId, PermanentBlobKey
key)` is somehow the same as `deleteInternal(@Nullable JobID jobId,
TransientBlobKey key)`.
--
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]