Uh oh!
There was an error while loading. Please reload this page.
[SPARK-26936][SQL] Fix bug of insert overwrite local dir can not create temporary path in local staging directory - #23841
[SPARK-26936][SQL] Fix bug of insert overwrite local dir can not create temporary path in local staging directory#23841beliefer wants to merge 2 commits into
Conversation
maropu
commented
Feb 20, 2019
Can you add tests before runing tests in Jenkins? |
|
maropu
commented
Feb 22, 2019
ok to test |
SparkQA
commented
Feb 22, 2019
Test build #102610 has finished for PR 23841 at commit
|
SparkQA
commented
Feb 22, 2019
Test build #102612 has finished for PR 23841 at commit
|
Uh oh!
There was an error while loading. Please reload this page.
SparkQA
commented
Feb 22, 2019
Test build #102614 has finished for PR 23841 at commit
|
SparkQA
commented
Feb 22, 2019
Test build #102642 has finished for PR 23841 at commit
|
@maropu Please review this pr again,thanks! |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
In case of inserts from non-hive tables, we still need to use a non-local path?
There was a problem hiding this comment.
If target path is local, we still need to use a non-local path.
There was a problem hiding this comment.
nit: ${notExistsPath} -> $notExistsPath
There was a problem hiding this comment.
You should set literals in the expected answer.
There was a problem hiding this comment.
These code refers to the writing of other UT.
There was a problem hiding this comment.
What's the difference from the "insert overwrite to not exist local dir" test?
There was a problem hiding this comment.
One is used for test result correct or not, another is used for test the not exist path created or not.
There was a problem hiding this comment.
Yes,I can remove "insert overwrite to not exist local dir" test and retain another.
maropu
commented
Feb 26, 2019
cc: @dongjoon-hyun |
SparkQA
commented
Feb 26, 2019
Test build #102786 has finished for PR 23841 at commit
|
SparkQA
commented
Feb 26, 2019
Test build #102788 has finished for PR 23841 at commit
|
I realized that the test you added passed in the master without your fix... Can you check again? |
There parent path |
SparkQA
commented
Feb 27, 2019
Test build #102810 has finished for PR 23841 at commit
|
My test case was that
./bin/spark-master --master=local[*] If you have any precondition for the failuare, can you update the PR description? |
beliefer
commented
Feb 27, 2019
OK,I have supplement the deploy mode for the PR description. |
I have run these SQL you provided on local[*] deploy mode and still appear inconsistent behavior too. '/tmp/noexistdir/t' is not a directory but a file. |
Then I pull the master branch and compile it and deploy it on my hadoop cluster.I get the inconsistent behavior again. The |
beliefer
commented
Feb 27, 2019
The origin code of |
beliefer
commented
Feb 27, 2019
I have update the PR and associated JIRA. |
beliefer
commented
Feb 28, 2019
@maropu Could you review the PR again?Thanks. |
I have check the source of Hadoop If target path is a directory, |
maropu
commented
Mar 1, 2019
Does this issue only happen in yarn-client mode? |
This SQL will occur |
maropu
commented
Mar 1, 2019
You need to first check the test you added in this pr... it still passes without your fix. |
Maybe UT run on local and depend on operating system or other difference of environment. |
SparkQA
commented
Mar 1, 2019
Test build #102907 has finished for PR 23841 at commit
|
SparkQA
commented
Mar 1, 2019
Test build #102911 has finished for PR 23841 at commit
|
beliefer
commented
Mar 26, 2019
I paste the full stack as follows: |
@srowen |
cloud-fan
commented
Mar 26, 2019
Will we hit this bug when we deploy spark in cluster? Seems to me it's not specific to yarn. |
Yes, If spark runs in |
srowen
commented
Mar 26, 2019
That makes more sense if this isn't YARN-specific, but isn't this still using a local path as if it's remote, or am I misreading? |
beliefer
commented
Mar 27, 2019
The SQL start with |
srowen
commented
Mar 27, 2019
OK it's probably that I don't know this code well. Maybe my question is this: when |
meteorchenwu
commented
Mar 28, 2019
It is great.I have merged it into my production environment. |
Yes, when |
srowen
commented
Mar 28, 2019
Yes I get all that, but here: |
beliefer
commented
Mar 28, 2019
I add some code to guarantee the Robustness. |
In The variables on our production environment as follows: |
SparkQA
commented
Mar 28, 2019
Test build #104033 has finished for PR 23841 at commit
|
srowen
commented
Mar 28, 2019
After the change, |
The key issue is not the Before the change of this PR, the variables on our production environment in After the change of this PR , the variables on our production environment in |
beliefer
commented
Mar 29, 2019
If |
srowen
commented
Mar 29, 2019
Yeah, I think that's a potential problem. We don't know whether that same path is valid on a distributed store. I agree there's a problem to fix here. Is there any standard tmp dir you can instead write to in this case rather than reusing that local path as a distributed path? |
The purpose of executing this command is to write the data to a local path. So the |
srowen
commented
Mar 29, 2019
OK, if you're saying this change doesn't cause the temp path to be some function of the (local) write path, then I get it. If it just comes up with a standard tmp location that is now on distributed storage, I get it. |
beliefer
commented
Mar 30, 2019
Yes,it is. |
srowen
commented
Apr 1, 2019
@maropu@cloud-fan does this sound reasonable to you? given the extended discussion above and the last couple comments here |
beliefer
commented
Apr 3, 2019
@maropu@cloud-fan srowen and I have a lot discussion above,can you pay attention to last couple comments? |
beliefer
commented
Apr 4, 2019
@cloud-fan Please look this PR, thanks! |
This PR has been going on for more than 40 days. Please help me advance this PR. Thanks. |
srowen
commented
Apr 5, 2019
Given the discussion, my understanding, passed tests, and reports that this fixes the problem in a prod env, I'm merging this to master. |
beliefer
commented
Apr 6, 2019
Thank you very mush.Your rigor and attitude towards the discussion is very helpful to the contributors. |
Uh oh!
There was an error while loading. Please reload this page.
What changes were proposed in this pull request?
Th environment of my cluster as follows:
My spark run on deploy mode yarn-client.
If I execute the SQL
insert overwrite local directory '/home/test/call_center/' select * from call_center, a HiveException will appear as follows:Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: java.io.IOException: Mkdirs failed to create file:/home/xitong/hive/stagingdir_hive_2019-02-19_17-31-00_678_1816816774691551856-1/-ext-10000/_temporary/0/_temporary/attempt_20190219173233_0002_m_000000_3 (exists=false, cwd=file:/data10/yarn/nm-local-dir/usercache/xitong/appcache/application_1543893582405_6126857/container_e124_1543893582405_6126857_01_000011) at org.apache.hadoop.hive.ql.io.HiveFileFormatUtils.getHiveRecordWriter(HiveFileFormatUtils.java:249)Current spark sql generate a local temporary path in local staging directory.The schema of local temporary path start with
file, so the HiveException appears.This PR change the local temporary path to HDFS temporary path, and use DistributedFileSystem instance copy the data from HDFS temporary path to local directory.
If Spark run on local deploy mode, 'insert overwrite local directory' works fine.
How was this patch tested?
UT cannot support yarn-client mode.The test is in my product environment.