-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-9724] [WEB UI] Avoid unnecessary redirects in the Spark Web UI. #8014
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
|
Jenkins, this is ok to test. |
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.
I know you're copying & pasting the code from above, but I wonder how is this any different than just always returning basePath + relativePath.
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.
In fact, the conditional makes sense in the original method, because of the stripSuffix call, but does not make sense here - nor does the copied scaladoc about "avoid returning an empty path".
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.
Agreed on both counts. Updated.
|
Makes sense after looking at how |
|
Test build #40129 has finished for PR 8014 at commit
|
|
Test build #40143 has finished for PR 8014 at commit
|
|
Can this be merged now @vanzin? |
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.
Both of these methods seems superfluous. They're trivial and each called once. I don't see why basePath == "" is treated separately, like, why the trailing slash wouldn't be stripped. In fact, there's only one way a call sets basePath to anything but "" and it's the /jobs servlet below - not clear why only that is special cased?
Anyway I'd suggest removing the methods and removing the special-casing -- it's just the combination of two strings, with a trailing / stripped in one case.
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.
basePath == "" is treated separately because there is a case when basePath = "" and relativePath = "/". In that case, we would return an empty string if we don't treat basePath == "" separately.
Here are the various cases:
+ /
+ /json
/history/application_1438648766072_0009 + /jobs
/history/application_1438648766072_0009 + /jobs/json
/history/application_1438648766072_0009 + /jobs/job
/history/application_1438648766072_0009 + /jobs/job/json
/history/application_1438648766072_0009 + /stages
/history/application_1438648766072_0009 + /stages/json
/history/application_1438648766072_0009 + /stages/stage
/history/application_1438648766072_0009 + /stages/stage/json
/history/application_1438648766072_0009 + /stages/pool
/history/application_1438648766072_0009 + /stages/pool/json
/history/application_1438648766072_0009 + /storage
/history/application_1438648766072_0009 + /storage/json
/history/application_1438648766072_0009 + /storage/rdd
/history/application_1438648766072_0009 + /storage/rdd/json
/history/application_1438648766072_0009 + /environment
/history/application_1438648766072_0009 + /environment/json
/history/application_1438648766072_0009 + /executors
/history/application_1438648766072_0009 + /executors/json
* /history/application_1438648766072_0009 + /jobs/
/history/application_1438648766072_0009 + /
* + /stages/
+ /stages/stage/kill
The ones with asterisk are for attachPrefixForRedirect, the other ones are for attachPrefix.
Earlier attachPrefix was called from two places, but now from one of these places attachPrefixForRedirect is being called. Let me know if you want me to inline these.
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.
Yes but I'm curious why basePath == "" plus relativePath == "foo/" should retain its trailing slash but not when basePath is non-empty. Is it really basePath =="" && relativePath =="/" that should be handled specially?
I do think it would be better to inline them. I am not sure why the suffix-stripping logic exists in the first place but that may be too far afield.
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.
I am not sure why the suffix-stripping logic exists in the first place but that may be too far afield.
That's because contextHandler.setContextPath() which uses the result of attachPrefix, throws an IllegalArgumentException when the path ends with /.
Yes but I'm curious why basePath == "" plus relativePath == "foo/" should retain its trailing slash but not when basePath is non-empty. Is it really basePath =="" && relativePath =="/" that should be handled specially?
Yes, it seems like only basePath =="" && relativePath =="/" should be handled specially. In fact, basePath == "" plus relativePath == "foo/" would result in the IllegalArgumentException mentioned above. I guess we just never encountered that case.
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.
@srowen I have inlined the methods and fixed the if condition for calculating prefixedPath.
…. Fix logic of attachPrefix
|
Test build #40364 timed out for PR 8014 at commit |
|
Test build #1445 has finished for PR 8014 at commit
|
|
Can we retest this? The test failures seem unrelated to my changes. |
|
retest this please. |
|
Test build #40629 has finished for PR 8014 at commit
|
|
LGTM. |
|
Merged to master. Thanks! |
Author: Rohit Agarwal <rohita@qubole.com> Closes apache#8014 from mindprince/SPARK-9724 and squashes the following commits: a7af5ff [Rohit Agarwal] [SPARK-9724] [WEB UI] Inline attachPrefix and attachPrefixForRedirect. Fix logic of attachPrefix 8a977cd [Rohit Agarwal] [SPARK-9724] [WEB UI] Address review comments: Remove unneeded code, update scaladoc. b257844 [Rohit Agarwal] [SPARK-9724] [WEB UI] Avoid unnecessary redirects in the Spark Web UI.
No description provided.