-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HADOOP-18596. Distcp -update to use modification time while checking for file skip. #5308
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
Changes from all commits
5d5228d
ee9a856
d23f13b
f094248
8c427bd
4ff7f36
d64e6b6
0f63b45
58d8f84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,7 @@ | |
| import org.apache.hadoop.tools.CopyListingFileStatus; | ||
| import org.apache.hadoop.tools.DistCpContext; | ||
| import org.apache.hadoop.tools.DistCpOptions.FileAttribute; | ||
| import org.apache.hadoop.tools.mapred.CopyMapper; | ||
| import org.apache.hadoop.tools.mapred.UniformSizeInputFormat; | ||
| import org.apache.hadoop.util.StringUtils; | ||
|
|
||
|
|
@@ -568,10 +569,12 @@ public static String getStringDescriptionFor(long nBytes) { | |
| * and false otherwise. | ||
| * @throws IOException if there's an exception while retrieving checksums. | ||
| */ | ||
| public static boolean checksumsAreEqual(FileSystem sourceFS, Path source, | ||
| FileChecksum sourceChecksum, | ||
| FileSystem targetFS, | ||
| Path target, long sourceLen) | ||
| public static CopyMapper.ChecksumComparison checksumsAreEqual( | ||
| FileSystem sourceFS, | ||
| Path source, | ||
| FileChecksum sourceChecksum, | ||
| FileSystem targetFS, | ||
| Path target, long sourceLen) | ||
| throws IOException { | ||
| FileChecksum targetChecksum = null; | ||
| try { | ||
|
|
@@ -585,8 +588,15 @@ public static boolean checksumsAreEqual(FileSystem sourceFS, Path source, | |
| } catch (IOException e) { | ||
| LOG.error("Unable to retrieve checksum for " + source + " or " + target, e); | ||
| } | ||
| return (sourceChecksum == null || targetChecksum == null || | ||
| sourceChecksum.equals(targetChecksum)); | ||
| // If the source or target checksum is null, that means there is no | ||
| // comparison that took place and return not compatible. | ||
| // else if matched, return compatible with the matched result. | ||
| if (sourceChecksum == null || targetChecksum == null) { | ||
| return CopyMapper.ChecksumComparison.INCOMPATIBLE; | ||
| } else if (sourceChecksum.equals(targetChecksum)) { | ||
| return CopyMapper.ChecksumComparison.TRUE; | ||
| } | ||
| return CopyMapper.ChecksumComparison.FALSE; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -613,8 +623,12 @@ public static void compareFileLengthsAndChecksums(long srcLen, | |
|
|
||
| //At this point, src & dest lengths are same. if length==0, we skip checksum | ||
| if ((srcLen != 0) && (!skipCrc)) { | ||
| if (!checksumsAreEqual(sourceFS, source, sourceChecksum, | ||
| targetFS, target, srcLen)) { | ||
| CopyMapper.ChecksumComparison | ||
| checksumComparison = checksumsAreEqual(sourceFS, source, sourceChecksum, | ||
| targetFS, target, srcLen); | ||
| // If Checksum comparison is false set it to false, else set to true. | ||
| boolean checksumResult = !checksumComparison.equals(CopyMapper.ChecksumComparison.FALSE); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this outcome right. as L632 should be reached for any outcome other than True.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll be setting "checksumResult" to be true for both "INCOMPATIBLE" and "TRUE" result from checksumsAreEqual() method else false and go through L632, so, we would be following the same flow as before since incompatible result from this method was true earlier too. |
||
| if (!checksumResult) { | ||
| StringBuilder errorMessage = | ||
| new StringBuilder(DistCpConstants.CHECKSUM_MISMATCH_ERROR_MSG) | ||
| .append(source).append(" and ").append(target).append("."); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.