Skip to content

Commit 10bd42c

Browse files
committed
[SPARK-33104][BUILD] Exclude 'org.apache.hadoop:hadoop-yarn-server-resourcemanager:jar:tests'
### What changes were proposed in this pull request? This PR proposes to exclude `org.apache.hadoop:hadoop-yarn-server-resourcemanager:jar:tests` from `hadoop-yarn-server-tests` when we use Hadoop 2 profile. For some reasons, after SBT 1.3 upgrade at SPARK-21708, SBT starts to pull the dependencies of 'hadoop-yarn-server-tests' with 'tests' classifier: ``` org/apache/hadoop/hadoop-common/2.7.4/hadoop-common-2.7.4-tests.jar org/apache/hadoop/hadoop-yarn-common/2.7.4/hadoop-yarn-common-2.7.4-tests.jar org/apache/hadoop/hadoop-yarn-server-resourcemanager/2.7.4/hadoop-yarn-server-resourcemanager-2.7.4-tests.jar ``` these were not pulled before the upgrade. This specific `hadoop-yarn-server-resourcemanager-2.7.4-tests.jar` causes the problem (SPARK-33104) 1. When the test case creates the Hadoop configuration here, https://github.com/apache/spark/blob/cc06266ade5a4eb35089501a3b32736624208d4c/core/src/main/scala/org/apache/spark/deploy/SparkHadoopUtil.scala#L122 2. Such jars above have higher precedence in the class path, instead of the specified custom `core-site.xml` in the test: https://github.com/apache/spark/blob/e93b8f02cd706bedc47c9b55a73f632fe9e61ec3/resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala#L1375 3. Later, `core-site.xml` in the jar is picked instead in Hadoop's `Configuration`: Before this fix: ``` jar:file:/.../https/maven-central.storage-download.googleapis.com/maven2/org/apache/hadoop/ hadoop-yarn-server-resourcemanager/2.7.4/hadoop-yarn-server-resourcemanager-2.7.4-tests.jar!/core-site.xml ``` After this fix: ``` file:/.../spark/resource-managers/yarn/target/org.apache.spark.deploy.yarn.YarnClusterSuite/ org.apache.spark.deploy.yarn.YarnClusterSuite-localDir-nm-0_0/ usercache/.../filecache/10/__spark_conf__.zip/__hadoop_conf__/core-site.xml ``` 4. the `core-site.xml` in the jar of course does not contain: https://github.com/apache/spark/blob/2cfd215dc4fb1ff6865644fec8284ba93dcddd5c/resource-managers/yarn/src/test/scala/org/apache/spark/deploy/yarn/YarnClusterSuite.scala#L133-L141 and the specific test fails. This PR uses some kind of hacky approach. It was excluded from 'hadoop-yarn-server-tests' with 'tests' classifier, and then added back as a proper dependency (when Hadoop 2 profile is used). In this way, SBT does not pull `hadoop-yarn-server-resourcemanager` with `tests` classifier anymore. ### Why are the changes needed? To make the build pass. This is a blocker. ### Does this PR introduce _any_ user-facing change? No, test-only. ### How was this patch tested? Manually tested and debugged: ```bash build/sbt clean "yarn/testOnly *.YarnClusterSuite -- -z SparkHadoopUtil" -Pyarn -Phadoop-2.7 -Phive -Phive-2.3 ``` Closes #30133 from HyukjinKwon/SPARK-33104. Authored-by: HyukjinKwon <gurwls223@apache.org> Signed-off-by: HyukjinKwon <gurwls223@apache.org>
1 parent 5e5b48d commit 10bd42c

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

pom.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,8 +1399,24 @@
13991399
<groupId>com.sun.jersey.contribs</groupId>
14001400
<artifactId>*</artifactId>
14011401
</exclusion>
1402+
<exclusion>
1403+
<groupId>org.apache.hadoop</groupId>
1404+
<artifactId>hadoop-yarn-server-resourcemanager</artifactId>
1405+
</exclusion>
14021406
</exclusions>
14031407
</dependency>
1408+
<!--
1409+
Hack to exclude org.apache.hadoop:hadoop-yarn-server-resourcemanager:jar:tests.
1410+
For some reasons, SBT starts to pull the dependencies of 'hadoop-yarn-server-tests' above
1411+
with 'tests' classifier after upgrading SBT 1.3 (SPARK-21708). Otherwise, some tests might
1412+
fail, see also SPARK-33104.
1413+
-->
1414+
<dependency>
1415+
<groupId>org.apache.hadoop</groupId>
1416+
<artifactId>hadoop-yarn-server-resourcemanager</artifactId>
1417+
<version>${yarn.version}</version>
1418+
<scope>test</scope>
1419+
</dependency>
14041420
<dependency>
14051421
<groupId>org.apache.hadoop</groupId>
14061422
<artifactId>hadoop-yarn-server-web-proxy</artifactId>

resource-managers/yarn/pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@
6565
<classifier>tests</classifier>
6666
<scope>test</scope>
6767
</dependency>
68+
<!--
69+
Hack to exclude org.apache.hadoop:hadoop-yarn-server-resourcemanager:jar:tests.
70+
See the parent pom.xml for more details.
71+
-->
72+
<dependency>
73+
<groupId>org.apache.hadoop</groupId>
74+
<artifactId>hadoop-yarn-server-resourcemanager</artifactId>
75+
<scope>test</scope>
76+
</dependency>
6877
</dependencies>
6978
</profile>
7079
</profiles>

0 commit comments

Comments
 (0)