-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HDFS-17509. RBF: Fix ClientProtocol.concat will throw NPE if tgr is a empty file. #6784
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 5 commits
97bffaa
7b8c582
382c3f8
0aa6a1e
e1fea88
acc8139
61d08c5
0c3ea01
7a591b0
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 |
|---|---|---|
|
|
@@ -1224,6 +1224,17 @@ public void testProxyConcatFile() throws Exception { | |
| String badPath = "/unknownlocation/unknowndir"; | ||
| compareResponses(routerProtocol, nnProtocol, m, | ||
| new Object[] {badPath, new String[] {routerFile}}); | ||
|
|
||
| // Test when concat trg is a empty file | ||
|
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. we also need to check the empty source file.
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. When there is a empty source file, it will throw exception in namenode. This behaiver is as same as with dfsrouter.
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. Do the namenode and rbf throw the same Exception? Maybe RBF throws NPE, but NN throws
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. When srclist has a empty file ,both namenode and dfsrouter will throw the same IOException
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. Can you modify the UT to cover the case that one or more source files are empty?
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. Add test for a empty src file |
||
| createFile(routerFS, existingFile, existingFileSize); | ||
| String sameRouterEmptyFile = | ||
| cluster.getFederatedTestDirectoryForNS(sameNameservice) + | ||
| "_newemptyfile"; | ||
| createFile(routerFS, sameRouterEmptyFile, 0); | ||
| // Concat in same namespaces, succeeds | ||
| testConcat(existingFile, sameRouterEmptyFile, false); | ||
| FileStatus mergedStatus = getFileStatus(routerFS, sameRouterEmptyFile); | ||
| assertEquals(existingFileSize, mergedStatus.getLen()); | ||
| } | ||
|
|
||
| @Test | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
locationsonly contains one namespace, we can returns this namespace directly instead of getting the namespace throughgetFileInfo, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may not be true. Even locations only contains one namespace, it still cannot decide whether the file exists or not. So getFileInfo is better to execute at least once. Or it will send to namenode and namenode throw file is not found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RBF is simply responsible for locating the downstream namespace and then proxying the request.
So if the input path is only mounted to one namespace, RBF only needs to proxy it directly. RBF does not need to check if the file exists in this only one downstream namespace, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK