HDFS-8217. During block recovery for truncate Log new Block Id in case of copy-on-truncate is true. (Contributed by Vinayakumar B)
This commit is contained in:
parent
a8898445dc
commit
262c1bc339
|
@ -545,6 +545,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
|
|
||||||
HDFS-7993. Provide each Replica details in fsck (J.Andreina via vinayakumarb)
|
HDFS-7993. Provide each Replica details in fsck (J.Andreina via vinayakumarb)
|
||||||
|
|
||||||
|
HDFS-8217. During block recovery for truncate Log new Block Id in case of
|
||||||
|
copy-on-truncate is true. (vinayakumarb)
|
||||||
|
|
||||||
Release 2.7.1 - UNRELEASED
|
Release 2.7.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -2840,7 +2840,9 @@ public class DataNode extends ReconfigurableBase
|
||||||
|
|
||||||
LOG.info(who + " calls recoverBlock(" + block
|
LOG.info(who + " calls recoverBlock(" + block
|
||||||
+ ", targets=[" + Joiner.on(", ").join(targets) + "]"
|
+ ", targets=[" + Joiner.on(", ").join(targets) + "]"
|
||||||
+ ", newGenerationStamp=" + rb.getNewGenerationStamp() + ")");
|
+ ((rb.getNewBlock() == null) ? ", newGenerationStamp="
|
||||||
|
+ rb.getNewGenerationStamp() : ", newBlock=" + rb.getNewBlock())
|
||||||
|
+ ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // ClientDataNodeProtocol
|
@Override // ClientDataNodeProtocol
|
||||||
|
|
|
@ -4229,6 +4229,8 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
String src = "";
|
String src = "";
|
||||||
waitForLoadingFSImage();
|
waitForLoadingFSImage();
|
||||||
writeLock();
|
writeLock();
|
||||||
|
boolean copyTruncate = false;
|
||||||
|
BlockInfoContiguousUnderConstruction truncatedBlock = null;
|
||||||
try {
|
try {
|
||||||
checkOperation(OperationCategory.WRITE);
|
checkOperation(OperationCategory.WRITE);
|
||||||
// If a DN tries to commit to the standby, the recovery will
|
// If a DN tries to commit to the standby, the recovery will
|
||||||
|
@ -4285,11 +4287,10 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockInfoContiguousUnderConstruction truncatedBlock =
|
truncatedBlock = (BlockInfoContiguousUnderConstruction) iFile
|
||||||
(BlockInfoContiguousUnderConstruction) iFile.getLastBlock();
|
.getLastBlock();
|
||||||
long recoveryId = truncatedBlock.getBlockRecoveryId();
|
long recoveryId = truncatedBlock.getBlockRecoveryId();
|
||||||
boolean copyTruncate =
|
copyTruncate = truncatedBlock.getBlockId() != storedBlock.getBlockId();
|
||||||
truncatedBlock.getBlockId() != storedBlock.getBlockId();
|
|
||||||
if(recoveryId != newgenerationstamp) {
|
if(recoveryId != newgenerationstamp) {
|
||||||
throw new IOException("The recovery id " + newgenerationstamp
|
throw new IOException("The recovery id " + newgenerationstamp
|
||||||
+ " does not match current recovery id "
|
+ " does not match current recovery id "
|
||||||
|
@ -4382,7 +4383,8 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
if (closeFile) {
|
if (closeFile) {
|
||||||
LOG.info("commitBlockSynchronization(oldBlock=" + oldBlock
|
LOG.info("commitBlockSynchronization(oldBlock=" + oldBlock
|
||||||
+ ", file=" + src
|
+ ", file=" + src
|
||||||
+ ", newgenerationstamp=" + newgenerationstamp
|
+ (copyTruncate ? ", newBlock=" + truncatedBlock
|
||||||
|
: ", newgenerationstamp=" + newgenerationstamp)
|
||||||
+ ", newlength=" + newlength
|
+ ", newlength=" + newlength
|
||||||
+ ", newtargets=" + Arrays.asList(newtargets) + ") successful");
|
+ ", newtargets=" + Arrays.asList(newtargets) + ") successful");
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue