|
@@ -103,6 +103,7 @@ import org.apache.hadoop.hdfs.protocol.proto.AclProtos.AclEditLogProto;
|
|
import org.apache.hadoop.hdfs.protocol.proto.XAttrProtos.XAttrEditLogProto;
|
|
import org.apache.hadoop.hdfs.protocol.proto.XAttrProtos.XAttrEditLogProto;
|
|
import org.apache.hadoop.hdfs.protocolPB.PBHelper;
|
|
import org.apache.hadoop.hdfs.protocolPB.PBHelper;
|
|
import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier;
|
|
import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier;
|
|
|
|
+import org.apache.hadoop.hdfs.server.blockmanagement.BlockStoragePolicySuite;
|
|
import org.apache.hadoop.hdfs.util.XMLUtils;
|
|
import org.apache.hadoop.hdfs.util.XMLUtils;
|
|
import org.apache.hadoop.hdfs.util.XMLUtils.InvalidXmlException;
|
|
import org.apache.hadoop.hdfs.util.XMLUtils.InvalidXmlException;
|
|
import org.apache.hadoop.hdfs.util.XMLUtils.Stanza;
|
|
import org.apache.hadoop.hdfs.util.XMLUtils.Stanza;
|
|
@@ -411,6 +412,7 @@ public abstract class FSEditLogOp {
|
|
String clientName;
|
|
String clientName;
|
|
String clientMachine;
|
|
String clientMachine;
|
|
boolean overwrite;
|
|
boolean overwrite;
|
|
|
|
+ byte storagePolicyId;
|
|
|
|
|
|
private AddCloseOp(FSEditLogOpCodes opCode) {
|
|
private AddCloseOp(FSEditLogOpCodes opCode) {
|
|
super(opCode);
|
|
super(opCode);
|
|
@@ -501,6 +503,11 @@ public abstract class FSEditLogOp {
|
|
return (T)this;
|
|
return (T)this;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ <T extends AddCloseOp> T setStoragePolicyId(byte storagePolicyId) {
|
|
|
|
+ this.storagePolicyId = storagePolicyId;
|
|
|
|
+ return (T)this;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void writeFields(DataOutputStream out) throws IOException {
|
|
public void writeFields(DataOutputStream out) throws IOException {
|
|
FSImageSerialization.writeLong(inodeId, out);
|
|
FSImageSerialization.writeLong(inodeId, out);
|
|
@@ -521,6 +528,7 @@ public abstract class FSEditLogOp {
|
|
FSImageSerialization.writeString(clientName,out);
|
|
FSImageSerialization.writeString(clientName,out);
|
|
FSImageSerialization.writeString(clientMachine,out);
|
|
FSImageSerialization.writeString(clientMachine,out);
|
|
FSImageSerialization.writeBoolean(overwrite, out);
|
|
FSImageSerialization.writeBoolean(overwrite, out);
|
|
|
|
+ FSImageSerialization.writeByte(storagePolicyId, out);
|
|
// write clientId and callId
|
|
// write clientId and callId
|
|
writeRpcIds(rpcClientId, rpcCallId, out);
|
|
writeRpcIds(rpcClientId, rpcCallId, out);
|
|
}
|
|
}
|
|
@@ -599,6 +607,12 @@ public abstract class FSEditLogOp {
|
|
} else {
|
|
} else {
|
|
this.overwrite = false;
|
|
this.overwrite = false;
|
|
}
|
|
}
|
|
|
|
+ if (NameNodeLayoutVersion.supports(
|
|
|
|
+ NameNodeLayoutVersion.Feature.BLOCK_STORAGE_POLICY, logVersion)) {
|
|
|
|
+ this.storagePolicyId = FSImageSerialization.readByte(in);
|
|
|
|
+ } else {
|
|
|
|
+ this.storagePolicyId = BlockStoragePolicySuite.ID_UNSPECIFIED;
|
|
|
|
+ }
|
|
// read clientId and callId
|
|
// read clientId and callId
|
|
readRpcIds(in, logVersion);
|
|
readRpcIds(in, logVersion);
|
|
} else {
|
|
} else {
|
|
@@ -661,6 +675,8 @@ public abstract class FSEditLogOp {
|
|
if (this.opCode == OP_ADD) {
|
|
if (this.opCode == OP_ADD) {
|
|
appendRpcIdsToString(builder, rpcClientId, rpcCallId);
|
|
appendRpcIdsToString(builder, rpcClientId, rpcCallId);
|
|
}
|
|
}
|
|
|
|
+ builder.append(", storagePolicyId=");
|
|
|
|
+ builder.append(storagePolicyId);
|
|
builder.append(", opCode=");
|
|
builder.append(", opCode=");
|
|
builder.append(opCode);
|
|
builder.append(opCode);
|
|
builder.append(", txid=");
|
|
builder.append(", txid=");
|