HDFS-17464. Improve some logs output in class FsDatasetImpl (#6724)

This commit is contained in:
hfutatzhanghb 2024-05-21 09:46:21 +08:00 committed by GitHub
parent be28467374
commit fb156e8f05
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1826,7 +1826,7 @@ public ReplicaInPipeline convertTemporaryToRbw(
if(rbw.getState() != ReplicaState.RBW) {
throw new IOException("Expected replica state: " + ReplicaState.RBW
+ " obtained " + rbw.getState() + " for converting block "
+ b.getBlockId());
+ b);
}
// overwrite the RBW in the volume map
volumeMap.add(b.getBlockPoolId(), rbw.getReplicaInfo());
@ -1977,7 +1977,7 @@ public void finalizeBlock(ExtendedBlock b, boolean fsyncDir)
b.getBlockPoolId(), getStorageUuidForLock(b))) {
if (Thread.interrupted()) {
// Don't allow data modifications from interrupted threads
throw new IOException("Cannot finalize block from Interrupted Thread");
throw new IOException("Cannot finalize block: " + b + " from Interrupted Thread");
}
replicaInfo = getReplicaInfo(b);
if (replicaInfo.getState() == ReplicaState.FINALIZED) {
@ -2016,7 +2016,7 @@ private ReplicaInfo finalizeReplica(String bpid, ReplicaInfo replicaInfo)
if (volumeMap.get(bpid, replicaInfo.getBlockId()).getGenerationStamp()
> replicaInfo.getGenerationStamp()) {
throw new IOException("Generation Stamp should be monotonically "
+ "increased.");
+ "increased bpid: " + bpid + ", block: " + replicaInfo);
}
ReplicaInfo newReplicaInfo = null;
@ -2028,7 +2028,7 @@ private ReplicaInfo finalizeReplica(String bpid, ReplicaInfo replicaInfo)
} else {
FsVolumeImpl v = (FsVolumeImpl)replicaInfo.getVolume();
if (v == null) {
throw new IOException("No volume for block " + replicaInfo);
throw new IOException("No volume for bpid: " + bpid + ", block: " + replicaInfo);
}
newReplicaInfo = v.addFinalizedBlock(
@ -2070,7 +2070,7 @@ public void unfinalizeBlock(ExtendedBlock b) throws IOException {
volumeMap.remove(b.getBlockPoolId(), b.getLocalBlock());
// delete the on-disk temp file
if (delBlockFromDisk(replicaInfo)) {
if (delBlockFromDisk(replicaInfo, b.getBlockPoolId())) {
LOG.warn("Block " + b + " unfinalized and removed. ");
}
if (replicaInfo.getVolume().isTransientStorage()) {
@ -2091,14 +2091,14 @@ public void unfinalizeBlock(ExtendedBlock b) throws IOException {
* @param info the replica that needs to be deleted
* @return true if data for the replica are deleted; false otherwise
*/
private boolean delBlockFromDisk(ReplicaInfo info) {
private boolean delBlockFromDisk(ReplicaInfo info, String bpid) {
if (!info.deleteBlockData()) {
LOG.warn("Not able to delete the block data for replica " + info);
LOG.warn("Not able to delete the block data for replica {}, bpid: {}", info, bpid);
return false;
} else { // remove the meta file
if (!info.deleteMetadata()) {
LOG.warn("Not able to delete the meta data for replica " + info);
LOG.warn("Not able to delete the meta data for replica {}, bpid: {}", info, bpid);
return false;
}
}