Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDFS-17150. EC: Fix the bug of failed lease recovery. #5937

Merged
merged 3 commits into from
Aug 15, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Feedback review.
  • Loading branch information
zhangshuyan0 committed Aug 10, 2023
commit 35eb68154529a0568e80d3ca94540225b1dda911
Original file line number Diff line number Diff line change
Expand Up @@ -3816,8 +3816,13 @@ boolean internalReleaseLease(Lease lease, String src, INodesInPath iip,
pendingFile.removeLastBlock(lastBlock);
finalizeINodeFileUnderConstruction(src, pendingFile,
iip.getLatestSnapshotId(), false);
NameNode.stateChangeLog.warn("BLOCK* internalReleaseLease: "
+ "Removed empty last block and closed file " + src);
if (uc.getNumExpectedLocations() == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here how about update to this judgment logic?

  if (lastBlock.isStriped()) {
    NameNode.stateChangeLog.warn("BLOCK* internalReleaseLease: "
              + "Removed last unrecoverable block group and closed file " + src);
  } else {
  NameNode.stateChangeLog.warn("BLOCK* internalReleaseLease: "
              + "Removed empty last block and closed file " + src);
  }```

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If uc.getNumExpectedLocations() is 0, regardless of whether it is a striped block or not, I think we should all consider it to be an empty block, not unrecoverable. So I think the code before is better. What's your opinion?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I understand your thoughts,

Perhaps it would be better to add some comment description.

NameNode.stateChangeLog.warn("BLOCK* internalReleaseLease: "
+ "Removed empty last block and closed file " + src);
} else {
NameNode.stateChangeLog.warn("BLOCK* internalReleaseLease: "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little weird that if we can determine it is EC file here when uc.getNumExpectedLocations() != 0, if not it will be ambiguity of this log print.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uc.getNumExpectedLocations() != 0 means minLocationsNum != 1, so it must be a EC file according to line 3806-3809.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally true, but poor readability. Any other way to improve it, such as lastBlock.isStriped() or others?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If uc.getNumExpectedLocations() is 0, regardless of whether it is a striped block or not, I think we should all consider it to be an empty block, not unrecoverable.

How about adding some comments here?

+ "Removed last unrecoverable block group and closed file " + src);
}
return true;
}
// Start recovery of the last block for this file
Expand Down