Skip to content

Commit ffce9a3

Browse files
author
Colin Patrick Mccabe
committed
HDFS-7847. Modify NNThroughputBenchmark to be able to operate on a remote NameNode (Charles Lamb via Colin P. McCabe)
1 parent e4c3b52 commit ffce9a3

File tree

3 files changed

+137
-42
lines changed

3 files changed

+137
-42
lines changed

hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,9 @@ Release 2.8.0 - UNRELEASED
510510
HDFS-7758. Retire FsDatasetSpi#getVolumes() and use
511511
FsDatasetSpi#getVolumeRefs() instead (Lei (Eddy) Xu via Colin P. McCabe)
512512

513+
HDFS-7847. Modify NNThroughputBenchmark to be able to operate on a remote
514+
NameNode (Charles Lamb via Colin P. McCabe)
515+
513516
OPTIMIZATIONS
514517

515518
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/DFSTestUtil.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import java.net.HttpURLConnection;
4949
import java.net.InetSocketAddress;
5050
import java.net.Socket;
51+
import java.net.URI;
5152
import java.net.URL;
5253
import java.net.URLConnection;
5354
import java.nio.ByteBuffer;
@@ -64,6 +65,7 @@
6465
import java.util.Set;
6566
import java.util.UUID;
6667
import java.util.concurrent.TimeoutException;
68+
import java.util.concurrent.atomic.AtomicBoolean;
6769

6870
import org.apache.commons.io.FileUtils;
6971
import org.apache.commons.logging.Log;
@@ -129,12 +131,14 @@
129131
import org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider;
130132
import org.apache.hadoop.hdfs.server.protocol.DatanodeRegistration;
131133
import org.apache.hadoop.hdfs.server.protocol.DatanodeStorage;
134+
import org.apache.hadoop.hdfs.server.protocol.NamenodeProtocol;
132135
import org.apache.hadoop.hdfs.tools.DFSAdmin;
133136
import org.apache.hadoop.io.IOUtils;
134137
import org.apache.hadoop.io.nativeio.NativeIO;
135138
import org.apache.hadoop.net.NetUtils;
136139
import org.apache.hadoop.net.unix.DomainSocket;
137140
import org.apache.hadoop.net.unix.TemporarySocketDirectory;
141+
import org.apache.hadoop.security.RefreshUserMappingsProtocol;
138142
import org.apache.hadoop.security.ShellBasedUnixGroupsMapping;
139143
import org.apache.hadoop.security.UserGroupInformation;
140144
import org.apache.hadoop.security.token.Token;
@@ -147,6 +151,7 @@
147151
import org.junit.Assume;
148152
import org.mockito.internal.util.reflection.Whitebox;
149153

154+
import com.google.common.annotations.VisibleForTesting;
150155
import com.google.common.base.Charsets;
151156
import com.google.common.base.Joiner;
152157
import com.google.common.base.Preconditions;
@@ -1755,6 +1760,41 @@ public static void setNameNodeLogLevel(Level level) {
17551760
GenericTestUtils.setLogLevel(NameNode.blockStateChangeLog, level);
17561761
}
17571762

1763+
/**
1764+
* Get the NamenodeProtocol RPC proxy for the NN associated with this
1765+
* DFSClient object
1766+
*
1767+
* @param nameNodeUri the URI of the NN to get a proxy for.
1768+
*
1769+
* @return the Namenode RPC proxy associated with this DFSClient object
1770+
*/
1771+
@VisibleForTesting
1772+
public static NamenodeProtocol getNamenodeProtocolProxy(Configuration conf,
1773+
URI nameNodeUri, UserGroupInformation ugi)
1774+
throws IOException {
1775+
return NameNodeProxies.createNonHAProxy(conf,
1776+
NameNode.getAddress(nameNodeUri), NamenodeProtocol.class, ugi, false).
1777+
getProxy();
1778+
}
1779+
1780+
/**
1781+
* Get the RefreshUserMappingsProtocol RPC proxy for the NN associated with
1782+
* this DFSClient object
1783+
*
1784+
* @param nameNodeUri the URI of the NN to get a proxy for.
1785+
*
1786+
* @return the RefreshUserMappingsProtocol RPC proxy associated with this
1787+
* DFSClient object
1788+
*/
1789+
@VisibleForTesting
1790+
public static RefreshUserMappingsProtocol getRefreshUserMappingsProtocolProxy(
1791+
Configuration conf, URI nameNodeUri) throws IOException {
1792+
final AtomicBoolean nnFallbackToSimpleAuth = new AtomicBoolean(false);
1793+
return NameNodeProxies.createProxy(conf,
1794+
nameNodeUri, RefreshUserMappingsProtocol.class,
1795+
nnFallbackToSimpleAuth).getProxy();
1796+
}
1797+
17581798
/**
17591799
* Set the datanode dead
17601800
*/

0 commit comments

Comments
 (0)