Skip to content

Commit 4351d5c

Browse files
committed
Merge branch 'trunk' into HADOOP-17576
2 parents d994df0 + dac60b8 commit 4351d5c

File tree

141 files changed

+2009
-840
lines changed

Some content is hidden

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

141 files changed

+2009
-840
lines changed

hadoop-client-modules/hadoop-client-check-test-invariants/src/test/resources/ensure-jars-have-correct-contents.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,6 @@ allowed_expr+="|^org.apache.hadoop.application-classloader.properties$"
5858
allowed_expr+="|^java.policy$"
5959
# * Used by javax.annotation
6060
allowed_expr+="|^jndi.properties$"
61-
# * allowing native libraries from rocksdb. Leaving native libraries as it is.
62-
allowed_expr+="|^librocksdbjni-linux32.so"
63-
allowed_expr+="|^librocksdbjni-linux64.so"
64-
allowed_expr+="|^librocksdbjni-osx.jnilib"
65-
allowed_expr+="|^librocksdbjni-win64.dll"
66-
allowed_expr+="|^librocksdbjni-linux-ppc64le.so"
67-
6861

6962
allowed_expr+=")"
7063
declare -i bad_artifacts=0

hadoop-client-modules/hadoop-client-minicluster/pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -760,13 +760,6 @@
760760
<exclude>xml.xsd</exclude>
761761
</excludes>
762762
</filter>
763-
<!-- filtering HISTORY-JAVA.md from rocksdb jar -->
764-
<filter>
765-
<artifact>org.rocksdb:rocksdbjni</artifact>
766-
<excludes>
767-
<exclude>HISTORY-JAVA.md</exclude>
768-
</excludes>
769-
</filter>
770763
<filter>
771764
<!-- skip jetty license info already incorporated into LICENSE/NOTICE -->
772765
<artifact>org.eclipse.jetty:*</artifact>

hadoop-common-project/hadoop-auth/pom.xml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,7 @@
193193
<artifactId>guava</artifactId>
194194
<scope>test</scope>
195195
</dependency>
196-
<dependency>
197-
<groupId>org.eclipse.jetty</groupId>
198-
<artifactId>jetty-server</artifactId>
199-
</dependency>
200-
</dependencies>
196+
</dependencies>
201197

202198
<build>
203199
<plugins>

hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/AuthenticationFilter.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import org.apache.hadoop.security.authentication.client.AuthenticationException;
2020
import org.apache.hadoop.security.authentication.client.KerberosAuthenticator;
2121
import org.apache.hadoop.security.authentication.util.*;
22-
import org.eclipse.jetty.server.Response;
2322
import org.slf4j.Logger;
2423
import org.slf4j.LoggerFactory;
2524

@@ -621,18 +620,15 @@ && getMaxInactiveInterval() > 0) {
621620
errCode = HttpServletResponse.SC_FORBIDDEN;
622621
}
623622
// After Jetty 9.4.21, sendError() no longer allows a custom message.
624-
// use setStatusWithReason() to set a custom message.
623+
// use setStatus() to set a custom message.
625624
String reason;
626625
if (authenticationEx == null) {
627626
reason = "Authentication required";
628627
} else {
629628
reason = authenticationEx.getMessage();
630629
}
631630

632-
if (httpResponse instanceof Response) {
633-
((Response)httpResponse).setStatusWithReason(errCode, reason);
634-
}
635-
631+
httpResponse.setStatus(errCode, reason);
636632
httpResponse.sendError(errCode, reason);
637633
}
638634
}

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/CryptoInputStream.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ private void resetStreamOffset(long offset) throws IOException {
317317
}
318318

319319
@Override
320-
public void close() throws IOException {
320+
public synchronized void close() throws IOException {
321321
if (closed) {
322322
return;
323323
}

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/DelegationTokenRenewer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public boolean equals(final Object that) {
107107
* Set a new time for the renewal.
108108
* It can only be called when the action is not in the queue or any
109109
* collection because the hashCode may change
110-
* @param newTime the new time
110+
* @param delay the renewal time
111111
*/
112112
private void updateRenewalTime(long delay) {
113113
renewalTime = Time.now() + delay - delay/10;

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java

Lines changed: 57 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,17 @@
2727
import java.net.MalformedURLException;
2828
import java.net.URI;
2929
import java.net.URL;
30-
import java.util.Arrays;
31-
import java.util.ArrayList;
32-
import java.util.Collections;
33-
import java.util.Enumeration;
34-
import java.util.HashMap;
30+
import java.nio.file.Paths;
3531
import java.util.List;
32+
import java.util.ArrayList;
3633
import java.util.Map;
34+
import java.util.HashMap;
35+
import java.util.Collections;
36+
import java.util.Optional;
3737
import java.util.Properties;
38+
import java.util.Enumeration;
39+
import java.util.Arrays;
40+
import java.util.Timer;
3841
import java.util.regex.Matcher;
3942
import java.util.regex.Pattern;
4043

@@ -75,6 +78,8 @@
7578
import org.apache.hadoop.security.authentication.server.PseudoAuthenticationHandler;
7679
import org.apache.hadoop.security.authentication.util.SignerSecretProvider;
7780
import org.apache.hadoop.security.authorize.AccessControlList;
81+
import org.apache.hadoop.security.ssl.FileBasedKeyStoresFactory;
82+
import org.apache.hadoop.security.ssl.FileMonitoringTimerTask;
7883
import org.apache.hadoop.security.ssl.SSLFactory;
7984
import org.apache.hadoop.util.ReflectionUtils;
8085
import org.apache.hadoop.util.Shell;
@@ -186,6 +191,7 @@ public final class HttpServer2 implements FilterContainer {
186191
static final String STATE_DESCRIPTION_ALIVE = " - alive";
187192
static final String STATE_DESCRIPTION_NOT_LIVE = " - not live";
188193
private final SignerSecretProvider secretProvider;
194+
private final Optional<java.util.Timer> configurationChangeMonitor;
189195
private XFrameOption xFrameOption;
190196
private boolean xFrameOptionIsEnabled;
191197
public static final String HTTP_HEADER_PREFIX = "hadoop.http.header.";
@@ -244,6 +250,8 @@ public static class Builder {
244250

245251
private boolean sniHostCheckEnabled;
246252

253+
private Optional<Timer> configurationChangeMonitor = Optional.empty();
254+
247255
public Builder setName(String name){
248256
this.name = name;
249257
return this;
@@ -574,12 +582,45 @@ private ServerConnector createHttpsChannelConnector(
574582
}
575583

576584
setEnabledProtocols(sslContextFactory);
585+
586+
long storesReloadInterval =
587+
conf.getLong(FileBasedKeyStoresFactory.SSL_STORES_RELOAD_INTERVAL_TPL_KEY,
588+
FileBasedKeyStoresFactory.DEFAULT_SSL_STORES_RELOAD_INTERVAL);
589+
590+
if (storesReloadInterval > 0) {
591+
this.configurationChangeMonitor = Optional.of(
592+
this.makeConfigurationChangeMonitor(storesReloadInterval, sslContextFactory));
593+
}
594+
577595
conn.addFirstConnectionFactory(new SslConnectionFactory(sslContextFactory,
578596
HttpVersion.HTTP_1_1.asString()));
579597

580598
return conn;
581599
}
582600

601+
private Timer makeConfigurationChangeMonitor(long reloadInterval,
602+
SslContextFactory.Server sslContextFactory) {
603+
java.util.Timer timer = new java.util.Timer(FileBasedKeyStoresFactory.SSL_MONITORING_THREAD_NAME, true);
604+
//
605+
// The Jetty SSLContextFactory provides a 'reload' method which will reload both
606+
// truststore and keystore certificates.
607+
//
608+
timer.schedule(new FileMonitoringTimerTask(
609+
Paths.get(keyStore),
610+
path -> {
611+
LOG.info("Reloading certificates from store keystore " + keyStore);
612+
try {
613+
sslContextFactory.reload(factory -> { });
614+
} catch (Exception ex) {
615+
LOG.error("Failed to reload SSL keystore certificates", ex);
616+
}
617+
},null),
618+
reloadInterval,
619+
reloadInterval
620+
);
621+
return timer;
622+
}
623+
583624
private void setEnabledProtocols(SslContextFactory sslContextFactory) {
584625
String enabledProtocols = conf.get(SSLFactory.SSL_ENABLED_PROTOCOLS_KEY,
585626
SSLFactory.SSL_ENABLED_PROTOCOLS_DEFAULT);
@@ -622,6 +663,7 @@ private HttpServer2(final Builder b) throws IOException {
622663
this.webAppContext = createWebAppContext(b, adminsAcl, appDir);
623664
this.xFrameOptionIsEnabled = b.xFrameEnabled;
624665
this.xFrameOption = b.xFrameOption;
666+
this.configurationChangeMonitor = b.configurationChangeMonitor;
625667

626668
try {
627669
this.secretProvider =
@@ -1420,6 +1462,16 @@ void openListeners() throws Exception {
14201462
*/
14211463
public void stop() throws Exception {
14221464
MultiException exception = null;
1465+
if (this.configurationChangeMonitor.isPresent()) {
1466+
try {
1467+
this.configurationChangeMonitor.get().cancel();
1468+
} catch (Exception e) {
1469+
LOG.error(
1470+
"Error while canceling configuration monitoring timer for webapp"
1471+
+ webAppContext.getDisplayName(), e);
1472+
exception = addMultiException(exception, e);
1473+
}
1474+
}
14231475
for (ServerConnector c : listeners) {
14241476
try {
14251477
c.close();

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,9 +1125,10 @@ static void loginUserFromKeytab(String user,
11251125

11261126
setLoginUser(u);
11271127

1128-
LOG.info("Login successful for user {} using keytab file {}. Keytab auto" +
1129-
" renewal enabled : {}",
1130-
user, path, isKerberosKeyTabLoginRenewalEnabled());
1128+
LOG.info(
1129+
"Login successful for user {} using keytab file {}. Keytab auto"
1130+
+ " renewal enabled : {}",
1131+
user, new File(path).getName(), isKerberosKeyTabLoginRenewalEnabled());
11311132
}
11321133

11331134
/**

0 commit comments

Comments
 (0)