[
https://issues.apache.org/jira/browse/HDFS-15554?focusedWorklogId=477552&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-477552
]
ASF GitHub Bot logged work on HDFS-15554:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 02/Sep/20 01:19
Start Date: 02/Sep/20 01:19
Worklog Time Spent: 10m
Work Description: fengnanli commented on a change in pull request #2266:
URL: https://github.com/apache/hadoop/pull/2266#discussion_r481522484
##########
File path:
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterAdmin.java
##########
@@ -103,11 +113,39 @@ public static void globalSetUp() throws Exception {
createNamenodeReport("ns1", "nn1", HAServiceState.ACTIVE));
stateStore.refreshCaches(true);
+ setUpMocks();
+ }
+
+ private static void setUpMocks() throws IOException {
RouterRpcServer spyRpcServer =
Mockito.spy(routerContext.getRouter().createRpcServer());
Whitebox
.setInternalState(routerContext.getRouter(), "rpcServer",
spyRpcServer);
Mockito.doReturn(null).when(spyRpcServer).getFileInfo(Mockito.anyString());
+
+ mockRpcClient = Mockito.spy(spyRpcServer.getRPCClient());
+ Whitebox
+ .setInternalState(spyRpcServer, "rpcClient", mockRpcClient);
+ RemoteLocation remoteLocation0 = new RemoteLocation("ns0", "/testdir",
null);
+ RemoteLocation remoteLocation1 = new RemoteLocation("ns1", "/", null);
+ mockResponse0.put(remoteLocation0,
+ new HdfsFileStatus.Builder().build());
+ Mockito.doReturn(mockResponse0).when(mockRpcClient).invokeConcurrent(
+ Mockito.eq(Lists.newArrayList(remoteLocation0)),
+ Mockito.any(RemoteMethod.class),
+ Mockito.eq(false),
+ Mockito.eq(false),
+ Mockito.eq(HdfsFileStatus.class)
+ );
+ mockResponse1.put(remoteLocation1,
+ new HdfsFileStatus.Builder().build());
+ Mockito.doReturn(mockResponse1).when(mockRpcClient).invokeConcurrent(
Review comment:
After adding the new logic in addMount and updateMount, the current
tests would fail since they don't have the file created in destination ns. The
mock is to avoid the failure for existing tests.
I can add a negative test.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 477552)
Time Spent: 0.5h (was: 20m)
> RBF: force router check file existence in destinations before adding/updating
> mount points
> ------------------------------------------------------------------------------------------
>
> Key: HDFS-15554
> URL: https://issues.apache.org/jira/browse/HDFS-15554
> Project: Hadoop HDFS
> Issue Type: Improvement
> Reporter: Fengnan Li
> Assignee: Fengnan Li
> Priority: Minor
> Labels: pull-request-available
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> Adding/Updating mount points right now is only a router action without
> validation in the downstream namenodes for the destination files/directories.
> In practice we have set up the dangling mount points and when clients call
> listStatus they would get the file returned, but then if they try to access
> the file FileNotFoundException would be thrown out.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]