ashishkumar50 commented on code in PR #6164:
URL: https://github.com/apache/ozone/pull/6164#discussion_r1483949570
##########
hadoop-ozone/ozonefs-hadoop3/src/main/java/org/apache/hadoop/fs/ozone/OzoneFileSystem.java:
##########
@@ -154,25 +157,41 @@ public boolean recoverLease(Path f) throws IOException {
}
// finalize the final block and get block length
- List<OmKeyLocationInfo> locationInfoList =
keyInfo.getLatestVersionLocations().getLocationList();
+ List<OmKeyLocationInfo> locationInfoList =
leaseKeyInfo.getKeyInfo().getLatestVersionLocations().getLocationList();
if (!locationInfoList.isEmpty()) {
OmKeyLocationInfo block = locationInfoList.get(locationInfoList.size() -
1);
try {
block.setLength(getAdapter().finalizeBlock(block));
} catch (Throwable e) {
- if (!forceRecovery) {
+ if (e instanceof StorageContainerException &&
(((StorageContainerException) e).getResult().equals(NO_SUCH_BLOCK)
+ || ((StorageContainerException)
e).getResult().equals(CONTAINER_NOT_FOUND))
+ && !leaseKeyInfo.getIsKeyInfo() && locationInfoList.size() > 1) {
+ locationInfoList =
leaseKeyInfo.getKeyInfo().getLatestVersionLocations().getLocationList().subList(0,
+ locationInfoList.size() - 1);
+ block = locationInfoList.get(locationInfoList.size() - 1);
Review Comment:
Yes code is duplicated across FileSystem classes, I will file a new Jira to
remove these duplication.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]