Skip to content

Commit 448f940

Browse files
authored
Merge branch 'apache:trunk' into YARN-11239
2 parents 562ccb5 + 25ebd0b commit 448f940

File tree

183 files changed

+4687
-2121
lines changed

Some content is hidden

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

183 files changed

+4687
-2121
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,14 @@ public Path getLocalPathForWrite(String pathStr, long size,
414414

415415
//build the "roulette wheel"
416416
for(int i =0; i < ctx.dirDF.length; ++i) {
417-
availableOnDisk[i] = ctx.dirDF[i].getAvailable();
417+
final DF target = ctx.dirDF[i];
418+
// attempt to recreate the dir so that getAvailable() is valid
419+
// if it fails, getAvailable() will return 0, so the dir will
420+
// be declared unavailable.
421+
// return value is logged at debug to keep spotbugs quiet.
422+
final boolean b = new File(target.getDirPath()).mkdirs();
423+
LOG.debug("mkdirs of {}={}", target, b);
424+
availableOnDisk[i] = target.getAvailable();
418425
totalAvailable += availableOnDisk[i];
419426
}
420427

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/WritableName.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public static synchronized Class<?> getClass(String name, Configuration conf
9292
) throws IOException {
9393
Class<?> writableClass = NAME_TO_CLASS.get(name);
9494
if (writableClass != null)
95-
return writableClass.asSubclass(Writable.class);
95+
return writableClass;
9696
try {
9797
return conf.getClassByName(name);
9898
} catch (ClassNotFoundException e) {

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/CallerContext.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public final class CallerContext {
4949
public static final String CLIENT_PORT_STR = "clientPort";
5050
public static final String CLIENT_ID_STR = "clientId";
5151
public static final String CLIENT_CALL_ID_STR = "clientCallId";
52+
public static final String REAL_USER_STR = "realUser";
5253

5354
/** The caller context.
5455
*

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
package org.apache.hadoop.security.token.delegation;
2020

2121
import java.io.ByteArrayInputStream;
22+
import java.io.DataInput;
2223
import java.io.DataInputStream;
24+
import java.io.DataOutput;
2325
import java.io.IOException;
2426
import java.security.MessageDigest;
2527
import java.util.ArrayList;
@@ -41,6 +43,8 @@
4143
import org.apache.hadoop.fs.statistics.impl.IOStatisticsBinding;
4244
import org.apache.hadoop.fs.statistics.impl.IOStatisticsStore;
4345
import org.apache.hadoop.io.Text;
46+
import org.apache.hadoop.io.Writable;
47+
import org.apache.hadoop.io.WritableUtils;
4448
import org.apache.hadoop.metrics2.annotation.Metric;
4549
import org.apache.hadoop.metrics2.annotation.Metrics;
4650
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
@@ -441,8 +445,9 @@ private void updateCurrentKey() throws IOException {
441445
/**
442446
* Update the current master key for generating delegation tokens
443447
* It should be called only by tokenRemoverThread.
448+
* @throws IOException raised on errors performing I/O.
444449
*/
445-
void rollMasterKey() throws IOException {
450+
protected void rollMasterKey() throws IOException {
446451
synchronized (this) {
447452
removeExpiredKeys();
448453
/* set final expiry date for retiring currentKey */
@@ -677,11 +682,15 @@ public static SecretKey createSecretKey(byte[] key) {
677682

678683
/** Class to encapsulate a token's renew date and password. */
679684
@InterfaceStability.Evolving
680-
public static class DelegationTokenInformation {
685+
public static class DelegationTokenInformation implements Writable {
681686
long renewDate;
682687
byte[] password;
683688
String trackingId;
684689

690+
public DelegationTokenInformation() {
691+
this(0, null);
692+
}
693+
685694
public DelegationTokenInformation(long renewDate, byte[] password) {
686695
this(renewDate, password, null);
687696
}
@@ -711,6 +720,29 @@ byte[] getPassword() {
711720
public String getTrackingId() {
712721
return trackingId;
713722
}
723+
724+
@Override
725+
public void write(DataOutput out) throws IOException {
726+
WritableUtils.writeVLong(out, renewDate);
727+
if (password == null) {
728+
WritableUtils.writeVInt(out, -1);
729+
} else {
730+
WritableUtils.writeVInt(out, password.length);
731+
out.write(password);
732+
}
733+
WritableUtils.writeString(out, trackingId);
734+
}
735+
736+
@Override
737+
public void readFields(DataInput in) throws IOException {
738+
renewDate = WritableUtils.readVLong(in);
739+
int len = WritableUtils.readVInt(in);
740+
if (len > -1) {
741+
password = new byte[len];
742+
in.readFully(password);
743+
}
744+
trackingId = WritableUtils.readString(in);
745+
}
714746
}
715747

716748
/** Remove expired delegation tokens from cache */

0 commit comments

Comments
 (0)