Github user tillrohrmann commented on a diff in the pull request:
https://github.com/apache/flink/pull/339#discussion_r23680555
--- Diff:
flink-runtime/src/main/java/org/apache/flink/runtime/filecache/FileCache.java
---
@@ -179,27 +179,40 @@ public Path call() {
private String name;
private JobID jobID;
- private int oldCount;
+ private String filePath;
public DeleteProcess(String name, DistributedCacheEntry e,
JobID jobID, int c) {
this.name = name;
this.jobID = jobID;
- this.oldCount = c;
+ this.filePath = e.filePath;
}
+
@Override
public void run() {
- synchronized (count) {
- if (count.get(new ImmutablePair<JobID,
String>(jobID, name)) != oldCount) {
+ Pair<JobID, String> key = new ImmutablePair<JobID,
String>(jobID, name);
+ synchronized (lock) {
+ if (!count.containsKey(key)) {
return;
}
- }
- Path tmp = getTempDir(jobID, "");
- try {
- if (lfs.exists(tmp)) {
- lfs.delete(tmp, true);
+ count.put(key, count.get(key) - 1);
+ if (count.get(key) != 0) {
+ return;
+ }
+ Path tmp = getTempDir(jobID,
filePath.substring(filePath.lastIndexOf("/") + 1));
+ try {
+ if (lfs.exists(tmp)) {
+ lfs.delete(tmp, true);
+ }
+ count.remove(key);
+ if (count.isEmpty()) { //delete job
directory
--- End diff --
This won't probably work, because there might still be other jobs running
on the TaskManager which have not yet deleted all of their files. The problem
is the ```Pair<JobID, Filename>```. Either we change count to be something like
```HashMap[JobID, HashMap[String, Integer]]``` or have to iterate over all
entries to see if there still exists an entry with the respective jobID.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---