Author: arp Date: Sun Nov 10 21:01:12 2013 New Revision: 1540549 URL: http://svn.apache.org/r1540549 Log: Merging r1540239 through r1540547 from trunk to branch HDFS-2832
Modified: hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-common/CHANGES.txt (contents, props changed) hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountEntry.java hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountResponse.java hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountdBase.java hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Base.java hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Constant.java hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcProgram.java hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpServer.java hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleUdpServer.java hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/Portmap.java Modified: hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-common/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1540549&r1=1540548&r2=1540549&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-common/CHANGES.txt (original) +++ hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-common/CHANGES.txt Sun Nov 10 21:01:12 2013 @@ -417,6 +417,9 @@ Release 2.3.0 - UNRELEASED HADOOP-9016. HarFsInputStream.skip(long) must never return negative value. (Ivan A. Veselovsky via jeagles) + HADOOP-10088. copy-nativedistlibs.sh needs to quote snappy lib dir. + (Raja Aluri via cnauroth) + Release 2.2.1 - UNRELEASED INCOMPATIBLE CHANGES Propchange: hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-common/CHANGES.txt ------------------------------------------------------------------------------ Merged /hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt:r1539737-1540547 Modified: hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountEntry.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountEntry.java?rev=1540549&r1=1540548&r2=1540549&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountEntry.java (original) +++ hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountEntry.java Sun Nov 10 21:01:12 2013 @@ -21,9 +21,9 @@ package org.apache.hadoop.mount; * Represents a mount entry. */ public class MountEntry { - /** Host correspoinding to the mount entry */ + /** Host corresponding to the mount entry */ private final String host; - /** Path correspoinding to the mount entry */ + /** Path corresponding to the mount entry */ private final String path; public MountEntry(String host, String path) { @@ -31,11 +31,11 @@ public class MountEntry { this.path = path; } - public String host() { + public String getHost() { return this.host; } - public String path() { + public String getPath() { return this.path; } @@ -49,7 +49,7 @@ public class MountEntry { } MountEntry m = (MountEntry) o; - return host().equals(m.host()) && path().equals(m.path()); + return getHost().equals(m.getHost()) && getPath().equals(m.getPath()); } @Override Modified: hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountResponse.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountResponse.java?rev=1540549&r1=1540548&r2=1540549&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountResponse.java (original) +++ hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountResponse.java Sun Nov 10 21:01:12 2013 @@ -54,8 +54,8 @@ public class MountResponse { RpcAcceptedReply.getAcceptInstance(xid, new VerifierNone()).write(xdr); for (MountEntry mountEntry : mounts) { xdr.writeBoolean(true); // Value follows yes - xdr.writeString(mountEntry.host()); - xdr.writeString(mountEntry.path()); + xdr.writeString(mountEntry.getHost()); + xdr.writeString(mountEntry.getPath()); } xdr.writeBoolean(false); // Value follows no return xdr; Modified: hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountdBase.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountdBase.java?rev=1540549&r1=1540548&r2=1540549&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountdBase.java (original) +++ hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountdBase.java Sun Nov 10 21:01:12 2013 @@ -18,7 +18,6 @@ package org.apache.hadoop.mount; import java.io.IOException; -import java.util.List; import org.apache.hadoop.oncrpc.RpcProgram; import org.apache.hadoop.oncrpc.SimpleTcpServer; @@ -34,6 +33,8 @@ import org.apache.hadoop.portmap.Portmap */ abstract public class MountdBase { private final RpcProgram rpcProgram; + private int udpBoundPort; // Will set after server starts + private int tcpBoundPort; // Will set after server starts public RpcProgram getRpcProgram() { return rpcProgram; @@ -41,10 +42,10 @@ abstract public class MountdBase { /** * Constructor - * @param exports + * @param program * @throws IOException */ - public MountdBase(List<String> exports, RpcProgram program) throws IOException { + public MountdBase(RpcProgram program) throws IOException { rpcProgram = program; } @@ -54,6 +55,7 @@ abstract public class MountdBase { rpcProgram, 1); rpcProgram.startDaemons(); udpServer.run(); + udpBoundPort = udpServer.getBoundPort(); } /* Start TCP server */ @@ -62,14 +64,15 @@ abstract public class MountdBase { rpcProgram, 1); rpcProgram.startDaemons(); tcpServer.run(); + tcpBoundPort = tcpServer.getBoundPort(); } public void start(boolean register) { startUDPServer(); startTCPServer(); if (register) { - rpcProgram.register(PortmapMapping.TRANSPORT_UDP); - rpcProgram.register(PortmapMapping.TRANSPORT_TCP); + rpcProgram.register(PortmapMapping.TRANSPORT_UDP, udpBoundPort); + rpcProgram.register(PortmapMapping.TRANSPORT_TCP, tcpBoundPort); } } } Modified: hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Base.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Base.java?rev=1540549&r1=1540548&r2=1540549&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Base.java (original) +++ hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Base.java Sun Nov 10 21:01:12 2013 @@ -33,6 +33,7 @@ public abstract class Nfs3Base { public static final Log LOG = LogFactory.getLog(Nfs3Base.class); private final RpcProgram rpcProgram; private final int nfsPort; + private int nfsBoundPort; // Will set after server starts public RpcProgram getRpcProgram() { return rpcProgram; @@ -40,20 +41,16 @@ public abstract class Nfs3Base { protected Nfs3Base(RpcProgram rpcProgram, Configuration conf) { this.rpcProgram = rpcProgram; - this.nfsPort = conf.getInt("nfs3.server.port", Nfs3Constant.PORT); + this.nfsPort = conf.getInt(Nfs3Constant.NFS3_SERVER_PORT, + Nfs3Constant.NFS3_SERVER_PORT_DEFAULT); LOG.info("NFS server port set to: " + nfsPort); } - protected Nfs3Base(RpcProgram rpcProgram) { - this.rpcProgram = rpcProgram; - this.nfsPort = Nfs3Constant.PORT; - } - public void start(boolean register) { startTCPServer(); // Start TCP server if (register) { - rpcProgram.register(PortmapMapping.TRANSPORT_TCP); + rpcProgram.register(PortmapMapping.TRANSPORT_TCP, nfsBoundPort); } } @@ -62,5 +59,6 @@ public abstract class Nfs3Base { rpcProgram, 0); rpcProgram.startDaemons(); tcpServer.run(); + nfsBoundPort = tcpServer.getBoundPort(); } } Modified: hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Constant.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Constant.java?rev=1540549&r1=1540548&r2=1540549&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Constant.java (original) +++ hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Constant.java Sun Nov 10 21:01:12 2013 @@ -26,7 +26,8 @@ public class Nfs3Constant { public final static int SUN_RPCBIND = 111; // The IP port number for NFS. - public final static int PORT = 2049; + public final static String NFS3_SERVER_PORT = "nfs3.server.port"; + public final static int NFS3_SERVER_PORT_DEFAULT = 2049; // The RPC program number for NFS. public final static int PROGRAM = 100003; @@ -213,4 +214,7 @@ public class Nfs3Constant { public final static String UNKNOWN_USER = "nobody"; public final static String UNKNOWN_GROUP = "nobody"; + + public final static String EXPORT_POINT = "dfs.nfs3.export.point"; + public final static String EXPORT_POINT_DEFAULT = "/"; } Modified: hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcProgram.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcProgram.java?rev=1540549&r1=1540548&r2=1540549&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcProgram.java (original) +++ hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcProgram.java Sun Nov 10 21:01:12 2013 @@ -40,7 +40,7 @@ public abstract class RpcProgram extends public static final int RPCB_PORT = 111; private final String program; private final String host; - private final int port; + private int port; // Ephemeral port is chosen later private final int progNumber; private final int lowProgVersion; private final int highProgVersion; @@ -68,23 +68,21 @@ public abstract class RpcProgram extends /** * Register this program with the local portmapper. */ - public void register(int transport) { + public void register(int transport, int boundPort) { + if (boundPort != port) { + LOG.info("The bound port is " + boundPort + + ", different with configured port " + port); + port = boundPort; + } // Register all the program versions with portmapper for a given transport for (int vers = lowProgVersion; vers <= highProgVersion; vers++) { - register(vers, transport); + PortmapMapping mapEntry = new PortmapMapping(progNumber, vers, transport, + port); + register(mapEntry); } } /** - * Register this program with the local portmapper. - */ - private void register(int progVersion, int transport) { - PortmapMapping mapEntry = new PortmapMapping(progNumber, progVersion, - transport, port); - register(mapEntry); - } - - /** * Register the program with Portmap or Rpcbind */ protected void register(PortmapMapping mapEntry) { Modified: hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpServer.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpServer.java?rev=1540549&r1=1540548&r2=1540549&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpServer.java (original) +++ hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpServer.java Sun Nov 10 21:01:12 2013 @@ -23,6 +23,7 @@ import java.util.concurrent.Executors; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jboss.netty.bootstrap.ServerBootstrap; +import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelFactory; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.channel.ChannelPipelineFactory; @@ -36,6 +37,7 @@ import org.jboss.netty.channel.socket.ni public class SimpleTcpServer { public static final Log LOG = LogFactory.getLog(SimpleTcpServer.class); protected final int port; + protected int boundPort = -1; // Will be set after server starts protected final SimpleChannelUpstreamHandler rpcProgram; /** The maximum number of I/O worker threads */ @@ -79,9 +81,16 @@ public class SimpleTcpServer { bootstrap.setOption("child.keepAlive", true); // Listen to TCP port - bootstrap.bind(new InetSocketAddress(port)); - - LOG.info("Started listening to TCP requests at port " + port + " for " + Channel ch = bootstrap.bind(new InetSocketAddress(port)); + InetSocketAddress socketAddr = (InetSocketAddress) ch.getLocalAddress(); + boundPort = socketAddr.getPort(); + + LOG.info("Started listening to TCP requests at port " + boundPort + " for " + rpcProgram + " with workerCount " + workerCount); } + + // boundPort will be set only after server starts + public int getBoundPort() { + return this.boundPort; + } } Modified: hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleUdpServer.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleUdpServer.java?rev=1540549&r1=1540548&r2=1540549&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleUdpServer.java (original) +++ hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleUdpServer.java Sun Nov 10 21:01:12 2013 @@ -23,6 +23,7 @@ import java.util.concurrent.Executors; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jboss.netty.bootstrap.ConnectionlessBootstrap; +import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.Channels; import org.jboss.netty.channel.SimpleChannelUpstreamHandler; import org.jboss.netty.channel.socket.DatagramChannelFactory; @@ -39,6 +40,7 @@ public class SimpleUdpServer { protected final int port; protected final SimpleChannelUpstreamHandler rpcProgram; protected final int workerCount; + protected int boundPort = -1; // Will be set after server starts public SimpleUdpServer(int port, SimpleChannelUpstreamHandler program, int workerCount) { this.port = port; @@ -61,9 +63,16 @@ public class SimpleUdpServer { b.setOption("receiveBufferSize", RECEIVE_BUFFER_SIZE); // Listen to the UDP port - b.bind(new InetSocketAddress(port)); - - LOG.info("Started listening to UDP requests at port " + port + " for " + Channel ch = b.bind(new InetSocketAddress(port)); + InetSocketAddress socketAddr = (InetSocketAddress) ch.getLocalAddress(); + boundPort = socketAddr.getPort(); + + LOG.info("Started listening to UDP requests at port " + boundPort + " for " + rpcProgram + " with workerCount " + workerCount); } + + // boundPort will be set only after server starts + public int getBoundPort() { + return this.boundPort; + } } Modified: hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/Portmap.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/Portmap.java?rev=1540549&r1=1540548&r2=1540549&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/Portmap.java (original) +++ hadoop/common/branches/HDFS-2832/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/Portmap.java Sun Nov 10 21:01:12 2013 @@ -31,14 +31,14 @@ public class Portmap { public static final Log LOG = LogFactory.getLog(Portmap.class); private static void startUDPServer(RpcProgramPortmap rpcProgram) { - rpcProgram.register(PortmapMapping.TRANSPORT_UDP); + rpcProgram.register(PortmapMapping.TRANSPORT_UDP, RpcProgram.RPCB_PORT); SimpleUdpServer udpServer = new SimpleUdpServer(RpcProgram.RPCB_PORT, rpcProgram, 1); udpServer.run(); } private static void startTCPServer(final RpcProgramPortmap rpcProgram) { - rpcProgram.register(PortmapMapping.TRANSPORT_TCP); + rpcProgram.register(PortmapMapping.TRANSPORT_TCP, RpcProgram.RPCB_PORT); SimpleTcpServer tcpServer = new SimpleTcpServer(RpcProgram.RPCB_PORT, rpcProgram, 1); tcpServer.run();