-
Notifications
You must be signed in to change notification settings - Fork 28.9k
SPARK-1623. Broadcast cleaner should use getCanonicalPath when deleting files by name #546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Details: rootDirs in DiskBlockManagerSuite doesn't get full path from rootDir0, rootDir1
Its same issue as Jira 1527 - fixed it to use absolute path instead of relative
|
Can one of the admins verify this patch? |
|
Jenkins, test this please. |
|
Merged build triggered. |
|
Merged build started. |
|
Merged build finished. |
|
Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/14472/ |
|
Mind changing the name? I created a new JIRA for this: Also - the fix as-is doesn't seem to compile. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be new File(file.toString).getCanonicalPath ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Removed my earlier incorrect comment) @techaddict is correct since the value file is a String. Niraj your two new versions are either create a String argument where a File is needed or call File methods on a String. I think the correct invocation is simply deleteBroadcastFile(new File(file)). Everything else would be superfluous. (And this too would simplify if the set of values contained Files not Strings of paths.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure Sean, I think I agree with you cause hashSet entries are string:
private val files = new TimeStampedHashSet[String]
and I am making it to deleteBroadcastFile(new File(file)) as per your
suggestion.
Niraj
On Thu, Apr 24, 2014 at 10:52 PM, Sean Owen [email protected]:
In core/src/main/scala/org/apache/spark/broadcast/HttpBroadcast.scala:
@@ -229,7 +229,7 @@ private[spark] object HttpBroadcast extends Logging {
val (file, time) = (entry.getKey, entry.getValue)
if (time < cleanupTime) {
iterator.remove()
deleteBroadcastFile(new File(file.toString))deleteBroadcastFile(new File(file.getCanonicalPath))(Removed my earlier incorrect comment) @techaddicthttps://github.com/techaddictis correct since the value
file is a String. Niraj your two new versions are either create a Stringargument where a
File is needed or call File methods on a String. I think the correct
invocation is simply deleteBroadcastFile(new File(file)). Everything else
would be superfluous. (And this too would simplify if the set of values
contained Files not Strings of paths.)—
Reply to this email directly or view it on GitHubhttps://github.com//pull/546/files#r11983954
.
|
Hi Patrick, By changing the name..I suppose you meant.."Assignee Name". I have assigned Please correct me if i am wrong. On Thu, Apr 24, 2014 at 8:13 PM, Patrick Wendell
|
|
@nsuthar ah I wasn't clear - I meant change the title of this pull request to have SPARK-1623 at the front of the title. |
|
@nsuthar pretty sure he meant the name of the PR, to something like |
|
OK, Sorry I misunderstood it. did it. On Thu, Apr 24, 2014 at 10:44 PM, Sean Owen [email protected]:
|
SPARK-1623. Broadcast cleaner should use getCanonicalPath when deleting files by name
|
fixed it to get abs path....jira 1623 |
|
could someone pls verify this patch. Thanks. Niraj |
|
Jenkins, test this please. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not required to wrap it in another File.
|
Are you actually seeing problems or is this a cleanup exercise to use appropriate api ? If we are not seeing any actual issues, I would rather not go down the path of fixing this. |
|
getAbsolutePath() would also resolve both issues as far as I can tell, For HttpBroadcast, see how the file names are retrieved with (Is the I/O going to matter though? These are executed once.) On Sun, Apr 27, 2014 at 3:06 PM, Mridul Muralidharan
|
|
It goes back to the problem we are trying to solve. If it is in context of a specific usecase - then it becomes function of that : do we need canonical names or are the path always constructed using common patterns which are consistent (always relative to cwd or specified w.r.t some root (which can be symlink). In any case, getAbsolutePath/File does not buy us anything much. |
|
Agree and that leads to the changes. For example |
|
Just fly-by-commenting here, but the performance cost of doing a few directory traversals is not relevant in this code path. It gets called only once in the lifetime of a broadcast variable. It think the bigger issues are around correctness and consistency... |
|
It is not about a few uses here or there - either spark codebase as a whole moves to a) canonical path always; or always sticks to b) paths relative to cwd and/or what is returned by File.createTempFile - there is no middle ground IMO. Btw, regarding cost - we do quite a lot of path manipulations elsewhere (block management, shuffle, etc) - which adds to the cost. Trying to carefully cordon off different sections of the code to different idioms is just asking for bugs as the codebase evolves. As we are apparently already hitting ! |
|
Just my 2 bits, but using getCanonicalPath() is usually a code smell; unless it's explicitly necessary (i.e. you know you have a symlink and you want to remove the actual file it references), it's generally better to use getAbsolutePath(). (Not that I think this applies here, but just commenting on the choice of API.) |
|
First, note SPARK-1527 (https://issues.apache.org/jira/browse/SPARK-1527) and its PR (#436). @advancedxy says that was a real issue, and I think it is fixed by the PR, which uses I think that is slightly preferable to the change in this PR. There is a separate issue addressed in this PR / SPARK-1623. That is that the set Whether it happens to all work out because the arguments happen to always be absolute, I think it's probably nicer to resolve this by a) calling So I suggest:
|
|
Sorry for being late for this conversation. I am busy with my own project. First, I agree with @srowen. SPARK-1527 was discovered when there were untracked files in my spark git dir after running tests. In DiskBlockManagerSuite, files were created using file.getName as parent folds, which was a relative path to cwd. The cleanup code deletes the original temp dir. This is a problem or a bug I prefer because it doesn't do it tends to do. In SPARK-1527, srowen suggested that Back in this pr, as @srowen said,
There is a problem. @mridulm I think you are right, we are at case b)paths relative to cwd and/or what is returned by Files.createTempFile, and I think we should stick to this case. But, we need to review the codebase to make sure path manipulation are correct. So I suggest(like @srowen said):
what do you think? |
Add a walk-around for missing ``started`` time in case k8s cluster failed to setup. Also copy full cluster setup logs to logdir for better debuging. Related-Bug: theopenlab/openlab#257
Getting absloute path instead of relative path. : Its a same bug as Jira 1527