Skip to content

Commit 52e9fc8

Browse files
authored
Upgrade Hadoop and Hive to version 3 (#1636)
This PR upgrades our dependencies on Hadoop and Hive to version 3.x.
1 parent cd47e5e commit 52e9fc8

File tree

149 files changed

+1815
-877
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+1815
-877
lines changed

NOTICE.txt

+195-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@ developed by the Apache Lucene Project (http://lucene.apache.org)
1414
License: The Apache License, Version 2.0
1515
(http://www.apache.org/licenses/LICENSE-2.0.txt)
1616

17-
This product includes code derived from the Jackson project
18-
(https://github.com/FasterXML/jackson) for backwards compatibility
19-
purposes.
17+
This product includes code derived and repackaged from the Jackson project
18+
(https://github.com/FasterXML/jackson) for interoperability purposes.
19+
License: The Apache License, Version 2.0
20+
(http://www.apache.org/licenses/LICENSE-2.0.txt)
21+
22+
This product includes repackaged from the Apache Commons HTTP Client project
23+
(https://hc.apache.org/httpclient-legacy/) for interoperability purposes.
2024
License: The Apache License, Version 2.0
2125
(http://www.apache.org/licenses/LICENSE-2.0.txt)
2226

@@ -1146,3 +1150,191 @@ jackson LICENSE
11461150
See the License for the specific language governing permissions and
11471151
limitations under the License.
11481152

1153+
================================================================================
1154+
apache commons http client NOTICE
1155+
================================================================================
1156+
Apache HttpComponents Commons HttpClient
1157+
Copyright 1999-2008 The Apache Software Foundation
1158+
1159+
This product includes software developed by
1160+
The Apache Software Foundation (http://www.apache.org/).
1161+
1162+
================================================================================
1163+
apache commons http client LICENSE
1164+
================================================================================
1165+
Apache License
1166+
Version 2.0, January 2004
1167+
http://www.apache.org/licenses/
1168+
1169+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1170+
1171+
1. Definitions.
1172+
1173+
"License" shall mean the terms and conditions for use, reproduction,
1174+
and distribution as defined by Sections 1 through 9 of this document.
1175+
1176+
"Licensor" shall mean the copyright owner or entity authorized by
1177+
the copyright owner that is granting the License.
1178+
1179+
"Legal Entity" shall mean the union of the acting entity and all
1180+
other entities that control, are controlled by, or are under common
1181+
control with that entity. For the purposes of this definition,
1182+
"control" means (i) the power, direct or indirect, to cause the
1183+
direction or management of such entity, whether by contract or
1184+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
1185+
outstanding shares, or (iii) beneficial ownership of such entity.
1186+
1187+
"You" (or "Your") shall mean an individual or Legal Entity
1188+
exercising permissions granted by this License.
1189+
1190+
"Source" form shall mean the preferred form for making modifications,
1191+
including but not limited to software source code, documentation
1192+
source, and configuration files.
1193+
1194+
"Object" form shall mean any form resulting from mechanical
1195+
transformation or translation of a Source form, including but
1196+
not limited to compiled object code, generated documentation,
1197+
and conversions to other media types.
1198+
1199+
"Work" shall mean the work of authorship, whether in Source or
1200+
Object form, made available under the License, as indicated by a
1201+
copyright notice that is included in or attached to the work
1202+
(an example is provided in the Appendix below).
1203+
1204+
"Derivative Works" shall mean any work, whether in Source or Object
1205+
form, that is based on (or derived from) the Work and for which the
1206+
editorial revisions, annotations, elaborations, or other modifications
1207+
represent, as a whole, an original work of authorship. For the purposes
1208+
of this License, Derivative Works shall not include works that remain
1209+
separable from, or merely link (or bind by name) to the interfaces of,
1210+
the Work and Derivative Works thereof.
1211+
1212+
"Contribution" shall mean any work of authorship, including
1213+
the original version of the Work and any modifications or additions
1214+
to that Work or Derivative Works thereof, that is intentionally
1215+
submitted to Licensor for inclusion in the Work by the copyright owner
1216+
or by an individual or Legal Entity authorized to submit on behalf of
1217+
the copyright owner. For the purposes of this definition, "submitted"
1218+
means any form of electronic, verbal, or written communication sent
1219+
to the Licensor or its representatives, including but not limited to
1220+
communication on electronic mailing lists, source code control systems,
1221+
and issue tracking systems that are managed by, or on behalf of, the
1222+
Licensor for the purpose of discussing and improving the Work, but
1223+
excluding communication that is conspicuously marked or otherwise
1224+
designated in writing by the copyright owner as "Not a Contribution."
1225+
1226+
"Contributor" shall mean Licensor and any individual or Legal Entity
1227+
on behalf of whom a Contribution has been received by Licensor and
1228+
subsequently incorporated within the Work.
1229+
1230+
2. Grant of Copyright License. Subject to the terms and conditions of
1231+
this License, each Contributor hereby grants to You a perpetual,
1232+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1233+
copyright license to reproduce, prepare Derivative Works of,
1234+
publicly display, publicly perform, sublicense, and distribute the
1235+
Work and such Derivative Works in Source or Object form.
1236+
1237+
3. Grant of Patent License. Subject to the terms and conditions of
1238+
this License, each Contributor hereby grants to You a perpetual,
1239+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1240+
(except as stated in this section) patent license to make, have made,
1241+
use, offer to sell, sell, import, and otherwise transfer the Work,
1242+
where such license applies only to those patent claims licensable
1243+
by such Contributor that are necessarily infringed by their
1244+
Contribution(s) alone or by combination of their Contribution(s)
1245+
with the Work to which such Contribution(s) was submitted. If You
1246+
institute patent litigation against any entity (including a
1247+
cross-claim or counterclaim in a lawsuit) alleging that the Work
1248+
or a Contribution incorporated within the Work constitutes direct
1249+
or contributory patent infringement, then any patent licenses
1250+
granted to You under this License for that Work shall terminate
1251+
as of the date such litigation is filed.
1252+
1253+
4. Redistribution. You may reproduce and distribute copies of the
1254+
Work or Derivative Works thereof in any medium, with or without
1255+
modifications, and in Source or Object form, provided that You
1256+
meet the following conditions:
1257+
1258+
(a) You must give any other recipients of the Work or
1259+
Derivative Works a copy of this License; and
1260+
1261+
(b) You must cause any modified files to carry prominent notices
1262+
stating that You changed the files; and
1263+
1264+
(c) You must retain, in the Source form of any Derivative Works
1265+
that You distribute, all copyright, patent, trademark, and
1266+
attribution notices from the Source form of the Work,
1267+
excluding those notices that do not pertain to any part of
1268+
the Derivative Works; and
1269+
1270+
(d) If the Work includes a "NOTICE" text file as part of its
1271+
distribution, then any Derivative Works that You distribute must
1272+
include a readable copy of the attribution notices contained
1273+
within such NOTICE file, excluding those notices that do not
1274+
pertain to any part of the Derivative Works, in at least one
1275+
of the following places: within a NOTICE text file distributed
1276+
as part of the Derivative Works; within the Source form or
1277+
documentation, if provided along with the Derivative Works; or,
1278+
within a display generated by the Derivative Works, if and
1279+
wherever such third-party notices normally appear. The contents
1280+
of the NOTICE file are for informational purposes only and
1281+
do not modify the License. You may add Your own attribution
1282+
notices within Derivative Works that You distribute, alongside
1283+
or as an addendum to the NOTICE text from the Work, provided
1284+
that such additional attribution notices cannot be construed
1285+
as modifying the License.
1286+
1287+
You may add Your own copyright statement to Your modifications and
1288+
may provide additional or different license terms and conditions
1289+
for use, reproduction, or distribution of Your modifications, or
1290+
for any such Derivative Works as a whole, provided Your use,
1291+
reproduction, and distribution of the Work otherwise complies with
1292+
the conditions stated in this License.
1293+
1294+
5. Submission of Contributions. Unless You explicitly state otherwise,
1295+
any Contribution intentionally submitted for inclusion in the Work
1296+
by You to the Licensor shall be under the terms and conditions of
1297+
this License, without any additional terms or conditions.
1298+
Notwithstanding the above, nothing herein shall supersede or modify
1299+
the terms of any separate license agreement you may have executed
1300+
with Licensor regarding such Contributions.
1301+
1302+
6. Trademarks. This License does not grant permission to use the trade
1303+
names, trademarks, service marks, or product names of the Licensor,
1304+
except as required for reasonable and customary use in describing the
1305+
origin of the Work and reproducing the content of the NOTICE file.
1306+
1307+
7. Disclaimer of Warranty. Unless required by applicable law or
1308+
agreed to in writing, Licensor provides the Work (and each
1309+
Contributor provides its Contributions) on an "AS IS" BASIS,
1310+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1311+
implied, including, without limitation, any warranties or conditions
1312+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
1313+
PARTICULAR PURPOSE. You are solely responsible for determining the
1314+
appropriateness of using or redistributing the Work and assume any
1315+
risks associated with Your exercise of permissions under this License.
1316+
1317+
8. Limitation of Liability. In no event and under no legal theory,
1318+
whether in tort (including negligence), contract, or otherwise,
1319+
unless required by applicable law (such as deliberate and grossly
1320+
negligent acts) or agreed to in writing, shall any Contributor be
1321+
liable to You for damages, including any direct, indirect, special,
1322+
incidental, or consequential damages of any character arising as a
1323+
result of this License or out of the use or inability to use the
1324+
Work (including but not limited to damages for loss of goodwill,
1325+
work stoppage, computer failure or malfunction, or any and all
1326+
other commercial damages or losses), even if such Contributor
1327+
has been advised of the possibility of such damages.
1328+
1329+
9. Accepting Warranty or Additional Liability. While redistributing
1330+
the Work or Derivative Works thereof, You may choose to offer,
1331+
and charge a fee for, acceptance of support, warranty, indemnity,
1332+
or other liability obligations and/or rights consistent with this
1333+
License. However, in accepting such obligations, You may act only
1334+
on Your own behalf and on Your sole responsibility, not on behalf
1335+
of any other Contributor, and only if You agree to indemnify,
1336+
defend, and hold each Contributor harmless for any liability
1337+
incurred by, or claims asserted against, such Contributor by reason
1338+
of your accepting any such warranty or additional liability.
1339+
1340+
END OF TERMS AND CONDITIONS

buildSrc/src/main/groovy/org/elasticsearch/hadoop/gradle/BaseBuildPlugin.groovy

+5-1
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,13 @@ class BaseBuildPlugin implements Plugin<Project> {
113113
println "Using Gradle [${project.gradle.gradleVersion}]"
114114

115115
// Hadoop versions
116-
project.rootProject.ext.hadoopDistro = project.hasProperty("distro") ? project.getProperty("distro") : "hadoopYarn"
116+
project.rootProject.ext.hadoopDistro = project.hasProperty("distro") ? project.getProperty("distro") : "hadoop3"
117117
switch (project.rootProject.ext.hadoopDistro) {
118118
// Hadoop YARN/2.0.x
119+
case "hadoop3":
120+
project.rootProject.ext.hadoopVersion = project.hadoop3Version
121+
println "Using Apache Hadoop on YARN [$project.hadoop3Version]"
122+
break
119123
case "hadoopYarn":
120124
project.rootProject.ext.hadoopVersion = project.hadoop2Version
121125
println "Using Apache Hadoop on YARN [$project.hadoop2Version]"

buildSrc/src/main/groovy/org/elasticsearch/hadoop/gradle/BuildPlugin.groovy

-7
Original file line numberDiff line numberDiff line change
@@ -283,13 +283,6 @@ class BuildPlugin implements Plugin<Project> {
283283
// Locking on to joda 2.8
284284
resolve.force('joda-time:joda-time:2.8')
285285

286-
// Ensure our jackson version is respected in the transient deps
287-
resolve.force("org.codehaus.jackson:jackson-mapper-asl:${project.ext.jacksonVersion}")
288-
resolve.force("org.codehaus.jackson:jackson-core-asl:${project.ext.jacksonVersion}")
289-
290-
// force the use of commons-http from Hadoop
291-
resolve.force('commons-httpclient:commons-httpclient:3.0.1')
292-
293286
// used when using Elastic non-shaded version
294287
resolve.force("commons-cli:commons-cli:1.2")
295288

buildSrc/src/main/groovy/org/elasticsearch/hadoop/gradle/fixture/hadoop/HadoopClusterFormationTasks.groovy

+6
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,11 @@ class HadoopClusterFormationTasks {
237237
setup = configureWriteConfigTask(taskName(prefix, node, 'configure'), project, setup, node)
238238
setup = configureExtraConfigFilesTask(taskName(prefix, node, 'extraConfig'), project, setup, node)
239239

240+
// Give the service descriptor a chance to provide service-specific setup tasks
241+
SetupTaskFactory setupTaskFactory = new SetupTaskFactory(project, { String name -> taskName(prefix, node, name) }, setup)
242+
node.config.getServiceDescriptor().configureSetupTasks(node.config, setupTaskFactory)
243+
setup = setupTaskFactory.getLastSetupTask()
244+
240245
// If the role for this instance is not a process, we skip creating start and stop tasks for it.
241246
if (!node.getConfig().getRoleDescriptor().isExecutableProcess()) {
242247
// Go through the given dependencies for the instance and if any of them are Fixtures, pick the stop tasks off
@@ -313,6 +318,7 @@ class HadoopClusterFormationTasks {
313318
from {
314319
project.tarTree(project.resources.gzip(distributionConfiguration.files.first()))
315320
}
321+
exclude(node.config.serviceDescriptor.excludeFromArchiveExtraction(node.config))
316322
into node.baseDir
317323
}
318324
}

buildSrc/src/main/groovy/org/elasticsearch/hadoop/gradle/fixture/hadoop/ServiceDescriptor.groovy

+17-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ package org.elasticsearch.hadoop.gradle.fixture.hadoop
2222
import org.elasticsearch.gradle.Version
2323
import org.elasticsearch.hadoop.gradle.fixture.hadoop.conf.InstanceConfiguration
2424
import org.elasticsearch.hadoop.gradle.fixture.hadoop.conf.ServiceConfiguration
25+
import org.gradle.api.Task
2526

2627
import static org.elasticsearch.hadoop.gradle.fixture.hadoop.conf.SettingsContainer.FileSettings
2728

@@ -74,6 +75,12 @@ interface ServiceDescriptor {
7475
*/
7576
String artifactName(ServiceConfiguration configuration)
7677

78+
/**
79+
* Returns a collection of directories/files that can be excluded when extracting an archive. Some distributions
80+
* include entire directories full of things we do not need in the fixture like documentation and example code.
81+
*/
82+
Collection<String> excludeFromArchiveExtraction(InstanceConfiguration configuration)
83+
7784
/**
7885
* The name of the directory under the base dir that contains the package contents.
7986
*/
@@ -130,8 +137,16 @@ interface ServiceDescriptor {
130137
void finalizeEnv(Map<String, String> env, InstanceConfiguration configuration)
131138

132139
/**
133-
* A map of default setup commands to run for an instance. The name of the command
134-
* is mapped to the command line contents.
140+
* Configure a list of Gradle tasks that are specific to setting up this service. If a setup step needs
141+
* to run scripts that are provided by the service installation's bin directory, use defaultSetupCommands
142+
* instead.
143+
*/
144+
void configureSetupTasks(InstanceConfiguration configuration, SetupTaskFactory taskFactory)
145+
146+
/**
147+
* A map of default setup commands to run for an instance. Each entry's key is the taskName to use for the
148+
* exec command, and value is the command line to execute. Every command is resolved against the instance's
149+
* home directory. If you need to perform set up operations with Gradle tasks, use configureSetupTasks.
135150
*/
136151
Map<String, Object[]> defaultSetupCommands(InstanceConfiguration configuration)
137152
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Licensed to Elasticsearch under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.elasticsearch.hadoop.gradle.fixture.hadoop
21+
22+
import org.gradle.api.Project
23+
import org.gradle.api.Task
24+
25+
import java.util.function.Function
26+
27+
class SetupTaskFactory {
28+
29+
private final Project project
30+
private final Function<String, String> taskNameGenerator
31+
private Task setup
32+
33+
SetupTaskFactory(Project project, Function<String, String> taskNameGenerator, Task setup) {
34+
this.project = project
35+
this.taskNameGenerator = taskNameGenerator
36+
this.setup = setup
37+
}
38+
39+
Task createServiceSetupTask(String name, Class<?> task, Closure configure) {
40+
setup = project.tasks.create(name: taskNameGenerator.apply(name), type: task, dependsOn: setup).configure(configure)
41+
return setup
42+
}
43+
44+
Task getLastSetupTask() {
45+
return setup
46+
}
47+
}

0 commit comments

Comments
 (0)