Skip to content

Conversation

@sankarh
Copy link
Contributor

@sankarh sankarh commented May 7, 2018

No description provided.

if (scheme == null) {
// no scheme - use default file system uri
scheme = fsUri.getScheme();
authority = fsUri.getAuthority();
Copy link
Contributor

Choose a reason for hiding this comment

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

Path makeQualified(URI defaultUri, Path workingDir) .does not use the same logic ..is it intentional ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is different in this logic?

if(bytes == null) {
throw new IllegalArgumentException("bytes == null");
} else {
StringBuilder s = new StringBuilder();
Copy link
Contributor

Choose a reason for hiding this comment

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

why hadoop's StringUtils.byteToHexString is not used ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Conflicting StringUtils classes if I import hadoop's class. So, just moved the implementation here as it is standalone metastore and even other methods does the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

+ "Source File: " + srcFile.getSourcePath());
throw new IOException("File copy failed and likely source file is deleted or modified.");
}
pathList.add(srcFile.getEffectivePath());
Copy link
Contributor

Choose a reason for hiding this comment

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

use srcPath instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

srcPath won't match with srcFile.getEffectivePath() as we changed the isUseSrcFile flag.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

}

// If files copy fail after several attempts, then throw error
if (!pathList.isEmpty() || isCopyError) {
Copy link
Contributor

Choose a reason for hiding this comment

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

in what scenario path list will be empty with copy error set to true ?

Copy link
Contributor Author

@sankarh sankarh May 7, 2018

Choose a reason for hiding this comment

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

not possible. I'm checking for path list not empty or copy error, then retry.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

int repeat = 0;
List<Path> pathList = Lists.transform(fileList, ReplChangeManager.FileInfo::getEffectivePath);
boolean isCopyError = false;
List<Path> pathList = Lists.transform(srcFileList, ReplChangeManager.FileInfo::getEffectivePath);
Copy link
Contributor

Choose a reason for hiding this comment

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

if we do transform here ..is it possible that some of the entries will be null ?
may be transform is not required here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope... here it won't return null. but just traverse through the list and get the effective path. So, cannot skip the transform.

if (!retryFileInfoList.isEmpty()) {
doCopyRetry(sourceFs, retryFileInfoList, destinationFs, destination, useRegularCopy);
}
// Copy files with retry logic on failure
Copy link
Contributor

Choose a reason for hiding this comment

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

retry logic on failure and source file modification

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix this if any code change needed for this patch. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

result = ReplChangeManager.encodeFileUri(files.get(i), chksums != null ? chksums.get(i) : null, null);
} catch (IOException e) {
// If thrown IOException, it means, CM root is not set. So, just return original path.
result = files.get(i);
Copy link
Contributor

Choose a reason for hiding this comment

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

i think .. ReplChangeManager should handle (null check is already there) ..cm_root not set scenario ..here in this layer we should throw exception for any failure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method is inherited and cannot change the definition. So, exception is caught and handle it. Yes, it is dead code for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants